home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Emulators / Ersatz-1.1beta / Version1.0 / e11.doc next >
Encoding:
Text File  |  1994-11-15  |  41.8 KB  |  820 lines

  1.                            ERSATZ-11 BETA VERSION 1.0
  2.                             PDP-11 SYSTEM SIMULATOR
  3.                            Release date: 14-Nov-1994
  4.                        Copyright (C) 1994 by John Wilson
  5.                               All rights reserved
  6.         
  7.              E11.EXE is a beta test version of a full system emulator
  8.         for the PDP-11.  It runs on any AT-class machine with an 80186
  9.         or better CPU, and requires around 350KB of free memory.  It is
  10.         intended to boot and run any PDP-11 operating system (it has
  11.         been tested with RT-11 (all flavors), RSX-11M, RSTS/E, 2.9BSD
  12.         UNIX, Fuzzball, and XXDP+;  it seems to have some problems with
  13.         IAS, and no attempt has been made to test DOS/BATCH, TSX+,
  14.         MUMPS, or any flavor of UNIX other than 2.9BSD;  2.11BSD will
  15.         definitely not work due to its need for "cadillac" hardware).
  16.  
  17.         Emulated configuration:
  18.  
  19.         * PDP-11/34a CPU with selectable extensions
  20.         * FP11A floating point processor
  21.         * 248KB main memory
  22.         * RL11/RL01-02 disk drives (up to 4)
  23.         * RK611/RK06-07 disk drives (up to 8)
  24.         * RX211/RX02 or RX11/RX01 8" floppy (using image files and/or
  25.           1.2MB floppies)
  26.         * DL11 terminal ports;  console and up to 15 others (VT100,
  27.           and/or uses COM ports and/or LPT ports)
  28.         * LP11 printer ports;  up to 4 (same devices as DL11)
  29.         * KW11L line clock (50/60 Hz, settable)
  30.         
  31.              The emulator speed depends on the application (changing MMU
  32.         registers is an expensive operation so multiuser OSes tend to
  33.         run more slowly than RT-11FB does, for example), but in general
  34.         it runs noticeably above the speed of a real PDP-11/34a (with
  35.         cache) on a 486-DX2/80.  Your mileage may vary.  It has
  36.         successfully booted and run RT-11FB on a 4.77 MHz IBM PC with a
  37.         V20 processor (80186-compatible), but it barely stayed ahead of
  38.         the clock interrupts.
  39.         
  40.              The FP11 emulation requires a math coprocessor.  If the PC
  41.         has none, then the emulated PDP-11 will have no FPP either.
  42.         
  43.              I consider this program to be a beta test release because
  44.         there are still some reported bugs that I've been unable to
  45.         duplicate, and there are many unfinished or unstarted features
  46.         that I plan to add, most of which hinge on porting the program
  47.         to run in 80386 protected mode so as to be able to implement
  48.         22-bit addressing efficiently.  My apologies to anyone who wants
  49.         to run it on an 80286 or earlier, the final version will most
  50.         likely require a 386.  Besides the program is growing so rapidly
  51.         that nothing has been left untouched long enough to be
  52.         considered 100% tested.  However in my own experience the
  53.         emulator has been very reliable, I wish I could say the same for
  54.         my real PDP-11s.
  55.  
  56.         Known problems:
  57.  
  58.         * IAS doesn't work with the emulator for some reason.  I don't
  59.           know why yet.
  60.  
  61.         Planned additions:
  62.  
  63.         * Network hardware.  Started but not yet finished.  The idea I'm
  64.           toying with is having the init file say which protocol numbers
  65.           the 11 needs to receive and then registering those with a packet
  66.           driver, then simulating a DELUA which "hears" only those packet
  67.           types.  That way it wouldn't interfere with other network
  68.           software on the same PC.
  69.  
  70.         * MSCP disks.  Don't get me started on this one...  (DEC is
  71.           still cagey about documentation even though all the competitors
  72.           that they were trying to fool got their clones working years
  73.           ago.)  It might be cute to simulate these using their own
  74.           partitions on the hard disk, then write real DSRs for a few
  75.           popular controllers (i.e.  bypassing DOS) so that disk I/O would
  76.           be truly asynchronous (like real hardware), that would speed
  77.           things up considerably, as well as stop the emulator from
  78.           pausing emulation for a few seconds during drive spin-ups on
  79.           "Green" PCs.  But remember, this section deliberately omitted.
  80.  
  81.         * Some kind of tape support.  My first goal will be to support
  82.           QIC-40/QIC-80 drives with a format compatible with Linux's FTAPE
  83.           package (which makes them act like 9-track magtapes).  Don't
  84.           hold your breath though, I have no understanding at all of
  85.           Reed-Solomon ECC and the QIC documents have a lot of holes in
  86.           them anyway.  A longer range goal (although probably easier)
  87.           will be supporting SCSI 9-track drives attached to the PC.  The
  88.           main holdup there is that I don't have one.
  89.  
  90.         
  91.              The system has been tested under the XXDP+ diagnostic
  92.         monitor.  It passes the KD11EA diagnostics DFKAA, DFKAB, and
  93.         DFKAC, and the FP11A diagnostics DFFPA, DFFPB, and DFFPC.  It
  94.         fails all MMU diagnostics due to the absence of the maintenance
  95.         mode.
  96.  
  97.  
  98.         COMMANDS
  99.         
  100.              Ersatz-11 recognizes a number of keyboard commands.  These
  101.         are entered at the "E11>" prompt, which appears when the PDP-11
  102.         is halted but may be brought up at any time by pressing
  103.         Alt-SysReq (or by pressing the BREAK key on a serial terminal if
  104.         the console terminal (TT0:)  has been ASSIGNed to a COM port).
  105.         Commands (and parameters and switches) may generally be
  106.         shortened to any unique abbreviation.
  107.  
  108.         INITIALIZATION FILE
  109.         
  110.              When E11 is first started, it looks for a file named
  111.         "E11.INI" first in the current directory, and then in the
  112.         directory where E11.EXE is located (or, it searches the PATH if
  113.         you're still running DOS V2.X).  If this file exists than a
  114.         command is read from the file each time E11 would otherwise
  115.         prompt for a user command;  input for the console DL11 still
  116.         comes from the keyboard, so the init file may be used both to
  117.         start up the system and to shut it down (E11 will continue after
  118.         the BOOT command if you type Alt-SysReq).  If a line's first
  119.         non-blank character is ';' or '!', it is treated as a comment.
  120.  
  121.         Typical E11.INI file:
  122.         
  123.         mount dl0: rt11.dsk
  124.         ; uncomment the ASSIGN command to use a COM port for console I/O
  125.         ; (baud rate must have been initialized from DOS using a MODE command)
  126.         ;assign kb0: com3: /irq5
  127.         boot/rt11 dl0:
  128.         ; control returns to the next line when the user presses Alt-SysRq
  129.         quit
  130.         COMMAND DESCRIPTIONS
  131.         ======= ============
  132.  
  133.  
  134.         ASSIGN ddu:  Fn
  135.         ASSIGN ddu:  COMn:  [/IRQn [/SHARE]]
  136.  
  137.         Assigns a physical PC device to emulate a particular DL11
  138.         (TT0:-TT15:)  or LP11 port (LP0:-LP3:).  The first (and possibly
  139.         only) argument after the PDP-11 device name may be either the
  140.         name of a function key F1-F12, or a serial port COM1:-COM4:, or
  141.         a line printer port LPT1:-LPT4:.
  142.  
  143.         If a function key is given, then the specified port is connected
  144.         to a simulated VT100 which can be put up on the screen by
  145.         pressing Alt and the specified function key (note that the
  146.         screens assigned to F11 and F12 are not accessible if you still
  147.         have the 84-key AT keyboard, sorry;  but look at the bright
  148.         side, at least you get the keypad comma key).  When one screen
  149.         is being displayed on the PC screen, the others (up to 11) are
  150.         maintained invisibly in memory, so they will be up to date when
  151.         you switch the display to them by pressing Alt and the function
  152.         key for the screen you want.
  153.  
  154.         UNTESTED FEATURE:  If there are two video adapters on the PC
  155.         (e.g.  an SVGA and a Hercules mono card), then one DL11/LP11
  156.         pseudo VT100 may be displayed on each.  The Alt-function keys
  157.         choose which of the 12 possible screens is displayed on the
  158.         primary monitor, and the Ctrl-function keys choose which is on
  159.         the secondary monitor.  Note that it is not possible to display
  160.         the same port on both monitors at once.  I no longer have such a
  161.         setup so the code is untested.
  162.  
  163.         If the name of a COM port is given, then the specified DL11/LP11
  164.         port is connected to that port.  Any IRQ from IRQ0 to IRQ15 may
  165.         be specified, or if the IRQ is omitted then IRQ4 is used for COM
  166.         ports whose I/O base address is 300h or more, IRQ3 for 2FFh or
  167.         less.  These defaults have been in use since XTs were the
  168.         standard, and most multi I/O boards will be set up this way.
  169.         However it's not uncommon with newer boards for COM3 to use IRQ5
  170.         and COM4 to use IRQ2 (or IRQ9 really, which is effectively the
  171.         same on an AT);  you will have to use the /IRQ5 and /IRQ2
  172.         switches in this case.  The /SHARE switch (the /IRQn switch is
  173.         required if /SHARE is given) means that the serial port has
  174.         special IRQ sharing hardware (as documented in the IBM AT
  175.         Technical Reference Manual) so that more than one device may use
  176.         the same IRQ at once;  this hardware is relatively rare, so if
  177.         you don't know whether you have it, you probably don't.  Note
  178.         that without this hardware it's not possible for more than one
  179.         device to be actively using the same IRQ at the same time;  so
  180.         for example if you have a mouse attached to COM1 using IRQ4 and
  181.         it has been initialized by MOUSE.COM, E11 will not be able to
  182.         use COM3 if it also uses IRQ4.
  183.  
  184.         The baud rate, number of data bits, etc.  for a COM port should
  185.         be set with a MODE command from DOS before Ersatz-11 is run.
  186.  
  187.         If the name of an LPT port is given, then the specified
  188.         DL11/LP11 port is connected to that port.  /IRQn and /SHARE may
  189.         be given as for COM ports;  the default IRQ for all LPT ports is
  190.         IRQ7.  E11's LPT handler uses interrupts;  I've seen vague
  191.         references to interrupts not working correctly with some LPT
  192.         ports, or maybe it was with some printers, but having polled I/O
  193.         as an option would be horribly slow (either printing speed or
  194.         CPU emulation or both would suffer) so it's not supported.
  195.         Interrupts work great with my brand-X LPT port and 13-year-old
  196.         NEC Spinwriter.  Trouble is most likely if you have multiple LPT
  197.         ports, since they may all try to drive IRQ7 at once.
  198.  
  199.         LPT output is passed transparently, so you'll need to make sure
  200.         that your OS and printer agree on whether lines end in <CRLF> or
  201.         just <LF>, and on whose responsibility it is to interpret tabs
  202.         and form feeds.
  203.  
  204.         Note that it is possible to ASSIGN a TT:  port to a printer, or
  205.         to ASSIGN an LP:  port to a screen.  Why you'd want to do this I
  206.         don't know but who am I to stop you.  The reason for making them
  207.         both use the same pool of devices was so that they could both
  208.         access COM ports, since serial terminals and serial printers are
  209.         both reasonable devices.  LP:  ports attached to COM ports or
  210.         screens respond to XON/XOFF flow control.
  211.  
  212.         The ASSIGN command fails if the specified COM or LPT port
  213.         doesn't exist, or if the specified (or default) IRQ is already
  214.         in use and the /SHARE switch is not given, or if you're trying
  215.         to steal TT0:'s device for some other port (there must always be
  216.         a TT0:  since that's E11's console terminal).
  217.  
  218.  
  219.         BOOT ddu:  [/switches]
  220.  
  221.         Boots the system from the specified disk.  The disk must have
  222.         been mounted with the MOUNT command.  The optional switch is an
  223.         OS name;  for now the only meaningful ones are /RT11 and /RSTS,
  224.         /RSX is defined too but has no effect.  This has to do with the
  225.         method used to pass time and date information to a newly booted
  226.         monitor.  RT-11 ignores the time and date passed at 005000
  227.         unless the NOP in the first word of the bootstrap is cleared to
  228.         0 (HALT) and the bootstrap is entered at 000002.  RSTS believes
  229.         the time and date at 001000 (in a different format from RT-11)
  230.         regardless of whether its NOP was nuked, but later versions of
  231.         RSTS save the first word of the bootstrap and execute it later
  232.         (anyone know why?), so they will halt if the system was booted
  233.         the RT-11 way.  Hence the need for the switch.  If you like
  234.         typing the time and date manually (or your PC has no RTC) then
  235.         don't worry about the switch.  I don't know enough about RSX or
  236.         any other OS to set up the time/date for it, if that's even
  237.         possible (although, simulating a made-up RTC device would be
  238.         easy, to be read by a privileged program during OS startup;  but
  239.         making an emulator emulate hardware that never existed and never
  240.         will seems somehow like cheating to me).
  241.  
  242.         There is also a /HALT switch, which means to go as far as
  243.         loading block 0 into core and setting up the registers, but to
  244.         stop there.  This can be handy for debugging boot blocks.
  245.  
  246.  
  247.         CALCULATE expr (& expr is a synonym)
  248.  
  249.         Calculates the value of a 32-bit octal expression and displays
  250.         the result in octal, decimal, ASCII and radix-50.  The operators
  251.         are */+-, unary +-, and (), with the usual precedence.  Numbers
  252.         are either octal digit strings, or decimal if they contain 8 or
  253.         9 or end in ".", or radix-50 triplets if preceded by "^R", or
  254.         general register contents if the names R0-R5 are given (with a
  255.         "'" suffix to indicate the other register set) or SP or PC, R$
  256.         or PS means the process status word, and something of the form
  257.         "'a" means the ASCII value of a.
  258.  
  259.  
  260.         DEASSIGN ddu:
  261.  
  262.         Disables the specified DL11 port (TTn:)  or LP11 port (LPn:).
  263.         Deassigning TT0:  is not allowed (either explicitly, or
  264.         implicitly by ASSIGNing its PC device to another PDP-11 device).
  265.  
  266.  
  267.         DEPOSIT addr val
  268.  
  269.         Deposits the word <val> at absolute 18-bit address <addr>, which
  270.         is forced even.  An error message is returned if an attempt is
  271.         made to access a nonexistent CSR in the I/O page.
  272.  
  273.  
  274.         EXAMINE addr
  275.  
  276.         Examines the word at absolute 18-bit address <addr>, which is
  277.         forced even.  An error message is returned if an attempt is made
  278.         to access a nonexistent CSR in the I/O page.
  279.  
  280.  
  281.         FPREGISTER [r v1 v2 [v3 v4]]
  282.  
  283.         Sets or displays the FPP registers.  r is the FP accumulator
  284.         number, 0-5, and v1-v4 are two or four 16-bit octal words to
  285.         write in the register (sorry, no decimal).  If no arguments are
  286.         given then the octal contents of all six ACs are given, along
  287.         with octal displays of the FPS, FEC, and FEA, and also a
  288.         bit-by-bit display of FPS.
  289.  
  290.  
  291.         GO [addr]
  292.  
  293.         Starts the machine at the specified address, or at the address
  294.         currently in the program counter if none is given.
  295.  
  296.  
  297.         HALT
  298.  
  299.         If the machine is running, halts it and displays the registers.
  300.         Otherwise a no op.
  301.  
  302.  
  303.         HELP [command]
  304.  
  305.         Explains use of Ersatz-11 commands.  Just type "HELP" for a
  306.         list.
  307.  
  308.  
  309.         INITIALIZE
  310.  
  311.         Initializes all emulated I/O devices, disables the MMU, sets the
  312.         CPU mode to "kernel."
  313.  
  314.  
  315.         LOG ddu:  [filename]
  316.  
  317.         Logs all output to the specified character device (TTn:  or
  318.         LPn:)  in the specified file.  If no filename is specified, any
  319.         existing log file for that device is closed.
  320.  
  321.  
  322.         LIST [addr]
  323.  
  324.         Disassembles eight instructions starting at the specified 16-bit
  325.         address (within the current I-space map) if it is given, or
  326.         otherwise at the first address following the last one
  327.         disassembled by the most recent LIST or REGISTER command.
  328.  
  329.  
  330.         MOUNT devu:  path/filename.ext [/switches]
  331.  
  332.         Mounts the specified DOS file on the specified PDP-11 disk drive
  333.         (DL0:-DL3:, DM0:-DM7:, or DY0:-DY1:);  that is, PDP-11 reads and
  334.         writes to that drive access the specified file, which is a
  335.         byte-by-byte image of a disk, which you presumably loaded from a
  336.         real PDP-11 using Kermit or DECnet or some equivalent, or built
  337.         using FLX.EXE or RT11.EXE or PUTR.COM.
  338.  
  339.         For DL:, the drive is set up to emulate an RL01 or RL02
  340.         depending on the size of the file;  each drive is set
  341.         separately, so you can have a mix of RL01s and RL02s.  The
  342.         /RONLY switch has the same effect as pressing the WRITE PROT
  343.         button on a real drive (/WPROTECT is a synonym).
  344.  
  345.         For DM:  things are similar to DL:, each of the 8 drives can be
  346.         either an RK06 or RK07 depending on the file size.  /RONLY works
  347.         as above.
  348.  
  349.         For DY:  (DX:  is a synonym), the drive is set up to emulate an
  350.         RX01, RX02, or RX03 disk depending on the size of the file or
  351.         whether the /SSSD, /SSDD etc.  switch was given.  The file size
  352.         is also used to determine whether the file is a block-by-block
  353.         image of the PDP-11 floppy starting at logical block 0 (such as
  354.         one gotten by using Kermit to read the disk under a PDP-11 OS),
  355.         in which case the interleave needs to be un-done since the
  356.         PDP-11 device handler will re-do it;  or a sector-by-sector
  357.         image starting at track 0, side 0, sector 1.  The latter format
  358.         yields a slightly larger file because the PDP-11 floppy device
  359.         handlers skip track 0 (something to do with proposed ANSI
  360.         compatibility that never materialized as far as I know).
  361.  
  362.         A second option for DY:  is to give the name of a 1.2MB floppy
  363.         drive instead of the name of a DOS image file, i.e.  A:  or B:.
  364.         Accesses to that RX02 unit will be redirected to the specified
  365.         floppy drive (and there's no need to re-MOUNT the drive when you
  366.         change disks) using a 26-sector format equivalent to that of a
  367.         real 8" disk drive.  In fact, if you somehow connect an 8" drive
  368.         to your PC floppy controller then it should be able to handle
  369.         RX01 media directly (I haven't had an opportunity to test this
  370.         though).  DEC's MFM format is weird so RX02 disks wouldn't be
  371.         compatible.  The RX211 "set density" command is implemented as a
  372.         full format, so you can format the weird 1.2MB disks using
  373.         FORMAT.SAV or SPEC%() or whatever you'd use on your real PDP-11.
  374.         Two problems:  (1) On a 1.2MB 5.25" drive the index hole is in
  375.         the same place for SS and DS media (8" drives use the index hole
  376.         to tell them apart) so E11 decides whether to report the disk as
  377.         double-sided by depending on the /SSxx or /DSxx switches to the
  378.         MOUNT command (/SSDD is the default);  the program detects disk
  379.         density changes like a real RX211 (well, more or less,
  380.         occasionally it takes a few tries to notice a change because the
  381.         PC controller doesn't have a "wrong density" error flag, it's
  382.         not that simple with IBM-style MFM) but still needs to be told
  383.         if the number of sides changes.  (2) Many, if not most, PC
  384.         floppy controllers have broken single density modes (the PC BIOS
  385.         is hard coded for double density so no one cares), so
  386.         FORMAT/SINGLE or anything else to do with actual single-density
  387.         media may not work on your PC.  FDC chips made by SMC are known
  388.         OK (FDC37C65LJP for one, the kind that takes one 16/32MHz xtal
  389.         and one 9.6MHz one), as are at least some by Goldstar.  In my
  390.         testing Intel's 82077 can't write SD disks but seems to be able
  391.         to read them with some retries;  according to the data sheets
  392.         for the NS PC8477B (which is supposed to be compatible) this is
  393.         because the chip requires an external pin (MFM) to be grounded
  394.         to enable SD mode, and for normal AT use it would be reasonable
  395.         to let it float high (required by RESET mode ID anyway) so I
  396.         imagine that's what most designers do.
  397.  
  398.         *** IMPORTANT NOTE ***
  399.         The simulator has no control over any caching of disk writes
  400.         that DOS may do, so it is important that you QUIT out of the
  401.         simulator to make sure all the pseudo-disk files get closed
  402.         properly, rather than simply switching the computer off, after
  403.         shutting down your PDP-11 OS.  Otherwise there is no guarantee
  404.         that all data written to disk by the PDP-11 has really made it
  405.         onto the DOS disk (in practice I've had no problems, but trouble
  406.         is theoretically possible so you've been warned).  But, the
  407.         RX211 1.2MB floppy emulation controls the hardware directly (in
  408.         fact it even intercepts INT 13h to keep DOS's fingers out of
  409.         things so you can't crash the machine by trying to MOUNT an
  410.         image file located on a DOS floppy while 1.2MB floppy emulation
  411.         is active) so as long as the PDP-11 is done with the disk it's
  412.         OK to take it out of the drive.
  413.  
  414.         Also, the simulator has no control over "Green PC" BIOSes which
  415.         spin down hard drives after a specified period of inactivity.
  416.         When E11 accesses the drive after it's been shut down, the BIOS
  417.         will pause several seconds while it spins the drive back up.
  418.         During this period E11 is not running, so the simulated PDP-11
  419.         may drop incoming characters (but maybe not, E11 maintains a
  420.         small FIFO buffer on each line) and its clock will lose a few
  421.         seconds.  If this is a problem you may have to disable this BIOS
  422.         feature.  If anyone knows of a way for E11 to handle spinning
  423.         the drive up asynchronously after a timeout, without confusing
  424.         the BIOS, I'd love to hear about it, what little APM
  425.         documentation I have appears to be wrong, at least from my
  426.         testing (that and/or my BIOS is broken).  That way the PDP-11
  427.         could keep running and it would just see a slow disk transfer
  428.         once in a while.
  429.  
  430.  
  431.         PROCEED [break]
  432.  
  433.         Continues PDP-11 execution at the address currently in the
  434.         program counter.  If <break> is specified, then it is the
  435.         virtual address of a single hard breakpoint, where the PDP-11 is
  436.         guaranteed to stop if an instruction fetch is attempted starting
  437.         at that address, regardless of what mode the computer is
  438.         executing in, and regardless of whether the contents of that
  439.         location have changed since the breakpoint was set.  This can be
  440.         handy for tracing code that hasn't been loaded yet.  Note that
  441.         hard breakpoints and single stepping with the STEP command
  442.         interfere with the operation of the CPU T bit, so don't combine
  443.         them with a debugger (or CPU traps diagnostic program) running
  444.         on the PDP-11.
  445.  
  446.  
  447.         QUIT
  448.  
  449.         Exit the simulator, closing all image and log files and
  450.         resetting all devices that were in use.
  451.  
  452.  
  453.         REGISTER [r val]
  454.  
  455.         If <r> and <val> are given, sets register <r> (0-7) in the
  456.         current register set to contain <val>.  Otherwise displays the
  457.         values of all eight registers, the condition codes, the current
  458.         and previous processor modes, and the current interrupt priority
  459.         level.  Note that the only way to set the PSW value is by
  460.         depositing it into location 777776.
  461.  
  462.  
  463.         SET CPU item [item...]
  464.  
  465.         This command changes the emulated CPU type, either by changing
  466.         to a new model all at once, or on a feature-by-feature basis.
  467.         SET CPU 34A sets the emulation to be 11/34a compatible, SET CPU
  468.         35 sets it to be 11/35 compatible (mostly -- the 11/20-style
  469.         weirdness with MOV SP,-(SP) pushing the decremented SP, etc.  is
  470.         not emulated).  EIS and NOEIS tell whether the EIS instructions
  471.         exist, FPP and NOFPP turn the FPP emulation on or off (it's
  472.         permanently off if your PC has no 80x87), and MXPS and NOMXPS
  473.         enable/disable the MFPS and MTPS instructions.
  474.  
  475.         There are many other items but they correspond to features that
  476.         either don't exist yet (so even though they appear in SHOW CPU
  477.         you get an error message when you try to turn them on), or
  478.         haven't had serious testing.  If you want to try them please let
  479.         me know how it turns out, I believe they work, but it wouldn't
  480.         be fair to claim I'm sure, that's why this is a beta release.
  481.  
  482.         CPUERR    CPU error register.
  483.         CSM       CSM instruction (requires SUPMODE to work).
  484.         DSPACE    Split I/D space.
  485.         DUALREGSET  Dual register set.
  486.         MMTRAPS   11/45,55,70-style memory management traps, 3-bit ACF.
  487.         PIRQ      11/45-style 7-level software interrupts.
  488.         SPL       SPL instruction.
  489.         SUPMODE   Supervisor mode.
  490.         TSTSET    J-11 TSTSET, WRTLCK instructions.
  491.  
  492.         This gives you the ability to roll your own CPU, which may not
  493.         correspond to any actual existing PDP-11 model.  This may annoy
  494.         your OS, and changing CPU types while running will almost
  495.         definitely startle it.  Anyway SHOW CPU will show you what
  496.         you've done.  The list of configurable features will grow in
  497.         future versions to include more actual PDP-11 models, this is
  498.         just what I have now.
  499.  
  500.  
  501.         SET DISPLAY NONE
  502.         SET DISPLAY PORT n
  503.         SET DISPLAY LPTn:
  504.  
  505.         If PORT is specified, specifies the octal 80x86 I/O address of a
  506.         word port which when written as a word, sets the 16-bit display
  507.         register.  Building the trivial hardware to support this is left
  508.         as an exercise to the reader.
  509.  
  510.         If a PC LPT port name is given, it specifies a port which has a
  511.         multiplexed LED board plugged into it, and E11 will refresh each
  512.         half on alternate 60Hz (50Hz) clock ticks;  there's a little
  513.         flicker but it works and requires no chips or power supply, just
  514.         build your board so that the D0-D7 lines (pins 2-9 of the DB25)
  515.         drive the anodes of the both the D0-7 and D8-15 LEDs (through
  516.         the same set of eight 100 ohm resistors since only one set of
  517.         LEDs will have their cathodes grounded at a time).  Then add two
  518.         NPN switching transistors (2N3904 etc.)  with the emitters
  519.         grounded (pin 25), the collectors connected to the cathodes of
  520.         all 8 LEDs for that byte, and the bases connected through a 1K
  521.         current limiting resistor to either /STROBE (pin 1) for the
  522.         D0-D7 LEDs or /INIT (pin 16) for the D8-D15 LEDs.
  523.  
  524.         If NONE is specified, then the current DR value is available
  525.         only from the SHOW DISPLAY command (the default condition).
  526.  
  527.  
  528.         SET FLOPPY RX[2]11
  529.  
  530.         Sets the type of floppy controller that will be emulated.  This
  531.         command is necessary because the RX11 and the RX211 use the same
  532.         CSR and vector addresses, otherwise E11 could just emulate one
  533.         of each.  The default is RX211 (with a so-called "RX03" drive);
  534.         the RX11 is inferior in every way to the RX211 (and probably
  535.         doesn't work with your floppy controller anyway so you'll be
  536.         stuck with image files) so normally you wouldn't use this
  537.         command, but if you're trying to boot something that expects an
  538.         RX11 (e.g.  an RT-11 distribution with RX01 boot blocks) you'll
  539.         need this command since the RX211 is not software-compatible
  540.         with the RX11 (although it's very similar).
  541.  
  542.  
  543.         SET HERZ {50 | 60}
  544.  
  545.         Sets the frequency of the KW11L line clock (startup default is
  546.         60);  Ersatz-11 reprograms the PC timer chip for this rate to
  547.         simulate line time clock interrupts, and then maintains a count
  548.         in software so that it knows when to trigger BIOS 18.2 Hz
  549.         interrupts (there is some jitter due to the BIOS interval being
  550.         rounded down to the previous KW11L interrupt, but there is no
  551.         cumulative error so the DOS clock is still correct when you exit
  552.         out of E11).
  553.  
  554.  
  555.         SET KEYBOARD [NO]SWAP
  556.  
  557.         SWAP sets the keyboard handler to exchange the functions of the
  558.         Caps Lock and left Ctrl keys for people who (understandably)
  559.         don't like the IBM Enhanced Keyboard.  NOSWAP sets the handler
  560.         back so that the keys work as marked.
  561.  
  562.  
  563.         SET [NO]SCOPE
  564.  
  565.         Sets whether the console terminal is a scope or a hardcopy
  566.         terminal, for the purpose of handling rubout characters typed at
  567.         the "E11>" prompt.  Mainly useful if the console is redirected
  568.         to a COM port with a DECwriter (etc.)  plugged into it.
  569.  
  570.  
  571.         SET SCROLL {HARD | SOFT}
  572.  
  573.         Selects the mechanism used for video scrolling.  HARD scrolling
  574.         offers superior performance (it works by programming the video
  575.         board(s) to change the start address of the screen each time a
  576.         full-screen scroll is needed), but exposes a bug in the DOS box
  577.         of a certain GUI system.  SOFT scrolling does things the slow
  578.         obvious way, by copying the whole screen a line up on each line
  579.         feed, and ought to work with anything.  HARD scrolling is the
  580.         default;  you should try putting SET SCROLL SOFT in your E11.INI
  581.         file if your display goes nuts a screen or so into each
  582.         attempted E11 session.
  583.  
  584.  
  585.         SET SWITCH n
  586.         SET SWITCH PORT n
  587.  
  588.         If PORT is specified, specifies the octal 80x86 I/O address of a
  589.         word port which when read as a word, gives the current 16-bit
  590.         switch register value.  Otherwise (PORT not specified), sets the
  591.         value of the emulated SR to the octal number n.
  592.  
  593.  
  594.         SET TTn:  CSR=nnnnnn VECTOR=nnn
  595.  
  596.         Sets the octal CSR and/or vector addresses for the specified
  597.         DL11 port (values will be saved for use when the port is created
  598.         using ASSIGN if it doesn't currently exist, otherwise effect is
  599.         immediate).
  600.  
  601.  
  602.         SHOW CPU
  603.  
  604.         Shows emulated CPU type, along with breakdown of features.
  605.  
  606.  
  607.         SHOW MMU [ {KERNEL | SUPERVISOR | USER} [INSTRUCTION | DATA] ]
  608.  
  609.         If the MMU is enabled, shows the current mapping for the
  610.         specified space.  Defaults are kernel and instruction space.
  611.  
  612.  
  613.         SHOW ddu:
  614.  
  615.         Shows the configuration of the specified device;  this is the
  616.         function key or COM port, CSR and vector if it's a DL11 or LP11
  617.         port, or the disk type and write protect flag for disks.
  618.  
  619.  
  620.         STEP
  621.  
  622.         Executes a single instruction step and displays the updated
  623.         registers.
  624.         HISTORY:
  625.  
  626.         V0.8 BETA, 29-Mar-1994;  initial release.
  627.  
  628.         V0.9 BETA, 05-Jul-1994;  many bug fixes (mainly trap handling,
  629.         MMU emulation, DIV instruction, and VT100 reverse video), added
  630.         RX211 emulation, multiple DL11s, and 50 Hz KW11L mode.
  631.  
  632.         V1.0 BETA, 14-Nov-1994;  more bug fixes, added FP11A,
  633.         RK611/RK06-07, LP11, D-space, and supervisor mode emulation.
  634.         Also CALC, HELP, INIT, LOG, SET/SHOW CPU, SET DR LPTn:, SET
  635.         SCROLL, SHOW MMU commands, VT100 graphics/underline, changed to
  636.         .EXE file (ran out of space in unified code/data segment in .COM
  637.         file).
  638.  
  639.  
  640.  
  641.         NOTES:
  642.  
  643.         This program is dedicated to RSTS V7.0-07 Digby's Bitpile.
  644.         Ad Majorem Digby Gloriam.
  645.  
  646.         INTERRUPTS:
  647.         The interrupt system ended up having to be a little weird, due
  648.         to some shameful assumptions in DEC OSes (mainly RSX and RT-11
  649.         SJ) about how many instructions are guaranteed to be executed
  650.         after writing a command to a device CSR, before the device will
  651.         complete the operation and interrupt.  Since MS-DOS doesn't
  652.         support asynchronous I/O (unless you go to extremes which
  653.         wouldn't have made sense in a CPU hog like an instruction set
  654.         simulator), it's natural to have all emulated device I/O appear
  655.         to the PDP-11 to be instantaneous (not really, the PC takes a
  656.         break between PDP-11 instructions to do the transfer), with the
  657.         completion interrupt occurring on the instruction following the
  658.         one that started the transfer.  Unfortunately this catches some
  659.         OS code with its pants down;  in my testing, RSX appeared to
  660.         issue WAIT instructions for TTY output which was assumed not to
  661.         have completed yet a few dozen instructions after writing a
  662.         character to a DL11 (thus hanging the system), and similarly the
  663.         RT-11 SJ (but not FB/XM) keyboard interrupt service routine runs
  664.         with interrupts enabled on the assumption that another keyboard
  665.         interrupt couldn't possibly happen before the current ISR
  666.         finishes (when this does happen the ISR recurses and the
  667.         characters are put in the buffer in reverse order, which was
  668.         happening with VT100 keypad keys in E11).  My solution to these
  669.         problems was to put in a queueing system, so that the interrupt
  670.         (and in some cases the transfer itself) doesn't occur until a
  671.         set number of instruction fetches (which in most cases I set on
  672.         the order of hundreds) after the instruction that started the
  673.         transfer.  This slightly slows down I/O, and at some point I may
  674.         add commands to make each of the delays settable, for tuning in
  675.         cases where my hard-coded delays turn out not to be enough, or
  676.         cases of "clean" code which makes no assumptions in which case
  677.         things can be sped up by setting the all delays to 1.  I'd be
  678.         interested to see how these OSes handle really fast serial lines
  679.         on actual slow PDP-11s.  All of this applies to disks too,
  680.         although I haven't run into any cute problems yet of code that
  681.         executes within a buffer that a disk is reading to and counts on
  682.         the CPU's ability to "outrun" the disk and JMP out in time;  but
  683.         just to be safe the disk code delays actually doing the transfer
  684.         until it's about to post the interrupt anyway.  RK06/07 seek
  685.         attentions are delayed still further beyond acknowledging the
  686.         seek command so as not to confuse overlapped seek drivers;
  687.         however you'll get faster results using a non-overlapped driver
  688.         if one is supplied with your OS.  Since usually all your
  689.         emulated disks are on one physical DOS disk with one head
  690.         carriage, there's nothing to overlap anyway.
  691.  
  692.         KEYBOARD:
  693.         The keypad layout may take a little getting used to but it's
  694.         intended to be familiar if your fingers are already comfortable
  695.         using KED or EDT on a real VT100;  just don't look at it.  The
  696.         digits and '.' key work as marked in Num Lock mode (otherwise
  697.         only the arrows work).  The keys around the top and right edges
  698.         of the keypad are *not* as marked, but correspond to the
  699.         PF1-PF4, hyphen, comma, and ENTER keys of the VT100 (the comma
  700.         key is missing unless you have an 84-key AT keyboard;  Northgate
  701.         Omnikey 102 keyboards have an = key where the VT100 comma
  702.         belongs but unfortunately it transmits the same scan code as the
  703.         =/+ key on the main keyboard so E11 can't use it as a comma).
  704.         To get the normal function of the Num Lock key (and Esc, Scroll
  705.         Lock, and Sys Req on an 84-key AT keyboard), press Alt, Ctrl, or
  706.         Shift at the same time.  The keypad hyphen, comma, ENTER, and
  707.         period keys are also available as F6, F8, F10, and F9 keys.
  708.  
  709.         DISK IMAGES:
  710.         Getting a snapshot of a bootable disk for your OS into a huge
  711.         DOS file is Your Problem, I don't want to get involved in
  712.         pirating software from a company whose legal department is
  713.         probably bigger than any *company* I've ever worked for.  BTW,
  714.         my local (Albany, NY) DEC office has no conceptual problem with
  715.         selling a real license for a PDP-11 that doesn't really exist.
  716.         Anyway I used Kermit to slurp the disk images out of a real
  717.         PDP-11, and I've heard of people using Process Software TCP/IP
  718.         with a live PDP-11, or DECnet and Pathworks, or Mark Aitchison's
  719.         RT11.EXE (a fine program) with an RX50 distribution kit.  Paul
  720.         Koning (former RSTS developer) has written a very nice program
  721.         named "flx" for manipulating files in RSTS disk images, among
  722.         other things it can build a bootable disk given the files from
  723.         [0,1].  It's available from FTP.UPDATE.UU.SE in
  724.         pub/pdp11/rsts/utils/flx and is written in portable C, so it can
  725.         be used with any emulator (or with real disk packs on a VAX).  A
  726.         DOS executable is included with the sources.  I'm working on a
  727.         separate utility program to manipulate DEC file systems, stay
  728.         tuned if you care but don't hold your breath, it's gotten
  729.         somewhat out of hand with frivolous features that have delayed
  730.         my finishing the useful ones.
  731.  
  732.         *** WATCH OUT ***
  733.         The RT-11 DL:  and DM:  device handlers expect to find a bad
  734.         block replacement table in block 1 of a disk.  If something else
  735.         is there (like the pack label in Files-11 and RDS 1.1 and later,
  736.         or the MFD in RDS 0.0), they will replace blocks at random and
  737.         you'll get a corrupted disk image (yes, I'm sure :-).  So either
  738.         hack your Kermit (etc.)  to use the appropriate .SPFUN instead
  739.         of .READ, or don't use RT-11 to read non-RT-11 disks.
  740.  
  741.         HOST SYSTEMS:
  742.         "Why didn't you write a version to run on the {machine} under
  743.         {OS}?"  The program is written entirely in 80x86 assembly
  744.         language (over 21,000 lines);  porting the devices, debugger,
  745.         interrupt system etc.  to another architecture would be
  746.         straightforward but the instruction set processor depends
  747.         heavily on similarities between the 80x86 and the PDP-11 (most
  748.         notably byte order and the condition flags;  correcting the byte
  749.         order and/or deriving condition flags "by hand" on another
  750.         machine would be very inefficient).  The FP11 simulation
  751.         likewise relies heavily on the 80x87 data formats.  Also the
  752.         VT100 emulator gets pretty intimate with the video hardware.  So
  753.         it seems a little unreasonable for you to ask me to spend months
  754.         MORE for no pay, writing the whole thing over again for your
  755.         machine, just to save you paying a couple of hundred bucks for
  756.         some cheesy mono 486DLC machine if you don't already have one.
  757.         Of course, if someone with a financial interest in keeping
  758.         PDP-11 code alive at above full speed wants to donate an Alpha
  759.         or PowerPC system to motivate me to port the whole mess to it,
  760.         that's another story!
  761.  
  762.         Meanwhile, if what you want is a UNIX-based PDP-11 emulator in
  763.         C, three (or more?)  have already been released, by Bob Supnik
  764.         of DEC (J-11, in /pub/mbg/simulators on FTP.STD.COM), Eric
  765.         Edwards of RIT (11/40?  /pub/csh/mag/pdp.tar.Z on
  766.         FTP.CSH.RIT.EDU) and der Mouse of McGill (FP-less J-11?
  767.         /pub/people/mouse/pdp11 on FTP.CIM.MCGILL.CA).  You'll need a
  768.         faster machine to get the same results.
  769.  
  770.         SOURCES:
  771.         At this time I am not making a public release of the source
  772.         code, because it contains proprietary code from a possible
  773.         forthcoming commercial product.  Also the program is changing
  774.         rapidly and I like having all the bugs where I can see them.
  775.  
  776.         COPYRIGHT NOTICE:
  777.         Ersatz-11 is Copyright (C) 1994 by John Wilson.  All rights
  778.         reserved.  Distribution of this document and/or the E11.EXE
  779.         executable file, in unmodified form, without charge, is allowed
  780.         without restriction.  Anything else is strictly forbidden unless
  781.         you contact me to work something out first.
  782.  
  783.         ACKNOWLEDGMENTS:
  784.         That should cover most of the important stuff.  A lot of stuff
  785.         has gone right since the initial beta release, mostly thanks to
  786.         input either from people who have experience with PDP-11
  787.         emulation (Bob Supnik at DEC and Alan Sieving at QED), or from
  788.         people who have helped me debug Ersatz-11 with their
  789.         configuration (many people, Frank Borger's (U.  Chicago) efforts
  790.         with RT-11SJ and IAS have been particularly impressive, as have
  791.         Paul Koning's (Chipcom) insights into RSTS).
  792.  
  793.         FEEDBACK:
  794.         I would really appreciate continued feedback on the program,
  795.         good and bad;  bad news is usually more useful (I'm very eager
  796.         to fix bugs, but I have to find them first), but I'm always
  797.         happy to hear that things work right too, especially if you've
  798.         gotten it working with an OS that hasn't been tried before, or
  799.         if you've found a novel way to bootstrap a PDP-11 OS onto your
  800.         PC.  Also I'd be very interested in hearing suggestions for
  801.         improvements (besides the obvious 22-bit addressing).
  802.  
  803.         AS ALWAYS, MAKE A BACKUP OF ANYTHING YOU'D REGRET LOSING BEFORE
  804.         RUNNING THIS PROGRAM.  Yeah I know you won't (I didn't) but
  805.         think about how you'll feel if something important gets
  806.         destroyed...  Anyway once you're set up it's a nice change being
  807.         able to throw a couple of dozen RL02 images on a QIC-80 tape for
  808.         safekeeping, might as well do your other data the same favor.
  809.  
  810.  
  811.         John Wilson
  812.         11 Bank Street
  813.         Troy, NY  12180
  814.         USA
  815.         +1 (518) 271-1982
  816.         
  817.         wilsonj@rpi.edu
  818.         John_Wilson@MTS.RPI.EDU  (if RPI.EDU is in AFS never-never land)
  819.         USERHA8G@RPITSMTS.BITNET (if *you're* in never-never land)
  820.