WHAT IS A PDP-8 SIMULATOR? The simulator attempts to duplicate all PDP8 functions (including IO device timings) so that the results of starting any program in either the Simulator or an actual PDP8 will be identical. To do this we have simulated core which conains PDP8 12bit words which are the PDP8 program. These "PDP8 words" are then read, decoded, and executed as PDP8 instructions. Under favourable conditions the simulation proceeds at a rate approximately 1/30 the rate an actual PDP8 could execute the code. THE FOLLOWING DEVICES MAY BE SIMULATED: CONSOL TELETYPE KEYBOARD AND TELEPRINTER HIGH SPEED PAPER TAPE AND PUNCH CALCOMP PLOTTER DDF32(MINI) DISK Page -1- USING THE PDP8 SIMULATOR For our discussion we will assume the reader is familiar with the programming and console operation of the PDP8. Further some knowledge of PDP-10 commands is assumed. Be sure to read the section TTY.MAC in this file before actually running the simulator. To run the simulator we type: "RUN DTAN:DEMO" The simulator will identify itself and indicate its readiness to accept commands by typing an *. The commands which are currently implemented are: BINARY :Run the Binary Loader from the high speed paper tape reader. See the example. BOOTSTRAP :Load the first block from the DF32 into the high page of core.(used to load the disk monitor if it is on the disk) C :Equivalent to depressing the CONTINUE switch on the console of a PDP8. D n1:n2,n3 :Deposit the 12bit number n2 in location n1 and the number n3 in location n1+1. D n1:n2,n3:n4 :Deposit n2 in location n1 and deposit n4 in location n3. DDT :Exit to DDT if DDT was loaded with the SIMULATOR. To return control to the SIMULATOR type OPR$G. DISPLAY :Display the state of the major registers and the Flags. See the examples. DP :Equivalent to depressing the Deposit switch on the console of a PDP8. E :Equivalent to depressing the Examine switch on the console of a PDP8. Page -2- EX n1,n2-n3 :Type out the contents of the locations n1, and locations n2 through n3. DUMP :Dump all of the PDP8's core locations on the line printer file as an octal dump. DUMP n1,n2-n3 :Dump the contents of core location n1 and locations n2 through n3 as an octal dump on the line printer file. EXIT :Closes all opened files. Used if changing files on simulated devices (e.g. binary loading an overlay to a program with a second tape) FILES :Starts a dialogue which permits changing file names and logical devices. See the examples. INTERRUPT &n :Will set the DRIVER to interrupt when the simulated running time has increased n microseconds. INTERRUPT n :Set the driver to interrupt when the running time reaches n. L :Equivalent to depressing the load-address switch on the console of a PDP8. SR n :n is an octal number six digits long. Load the data field switches with the first octal digit, load the instruction field switches with the second octal digit, and load the data switches with the four low order octal digits. PC n :n is an octal number six digits long. Load the data field switches with the first octal digit, load the instruction field register with the 2nd digit, load the address register with the four low order octal digits. ST n :Start the simulated PDP8 with the address registers initialized with n. S :Equivalent to depressing the START switch on the console of a PDP8. Page -3- SS :Single-Step. The simulator will execute one PDP8 instruction and then halt showing its registers. ZIP :starts a diAlogue which changes the simulated speed of some preipherials. See examples. RIM :Run the RIM Loader from the high speed paper tape reader. Note: When a special character such as - : , . follows a number, it must follow immediately after the number with no intervening blanks. NOTE: WHEN EVER USING PDP-10 PIP TO TRANSFER FILES BETWEEN DEVICES FOR USE BY THE SIMULATOR, IT IS GERNERALLY GOOD PRACTICE TO USE THE /I (IMAGE MODE) SWITCH. NOTE: IF THE TELETYPE SEEMS TO GO DEAD WHEN YOU STOP THE SIMULATOR TYPE CONTROL S AND CONTROL B TO RETURN TO NORMAL OPERATION. Page -4- SAMPLES AND EXAMPLES ^C .RUN DTAn:DEMO.SAV YOU HAVE A 4K SIMULATED PDP8(INLINE VERSION) WITH AN UNPACKED MEMORY. PLOTTER *EX 7756 7756 6014 *EX 7760-7763 7760 5357 7761 6016 7762 7106 7763 7006 *RIM END OF FILE ON PTR *DISPLAY PC 7762 AC 0377 IR 0006 MA 7761 MB 6016 SR 0 0 0000 SIMULATED RUNTIME 3.034,221,75 SECONDS RUNNING TIME 84.600 SECONDS * Page -5- Since some programs may have loops such as: RSF /READER READY? JMP .-1 /NO SO LOOP BACK AND TEST AGAIN to read characters, it may be desireable to increase the apparent speed of some of the peripherial devices to reduce the work load on the simulator. This is acomplished using the ZIP command as demonstrated in the following example: *ZIP READER SPEED WAS 454cps CHANGE TO 1000 PUNCH SPEED WAS 77cps CHANGE TO KEYBOARD SPEED WAS 12cps CHANGE TO TELEPRINTER SPEED WAS 12 cps CHANGE TO 500 PLOTTER SPEED WAS 454cps CHANGE TO In the above dialogue we changed the high speed paper tape speed from 300 Characters per second to 512. (Note again that most numbers accepted or typed by the DRIVER are octal) The speeds of the PLOTTER and high speed paper tape punch were not changed. From reading about the STRUCTURE of the simulator you know that every 1/10 of a second the teletype is polled for input. This polling is a significant overhead so avoid speeding the keyboard up unnecessarily. The PDP-10 is a file oriented system. The SIMULATOR has two commands specifically related to this structure, "EXIT" and "FILES". The first is used to close any opened files, the second is used to select the devices and file names for input and output by the various simulated peripherials. An example of the "FILES" command follows: *FILES READER PTR:PTR.RIM modify this with PUNCH PTP:PTP.OUT modify this with DSK:PUNCH.FIL PRINTER LPT:FILE.LST modify this with DSK: PLOTTER PLT.PLOTS.gph modify this with .EXT DF32 DSK:DF32.FIL modify this with disk2 In the above example we: 1. Left the PAPERTAPE READER file device and file name unchanged 2. Changed the punch file name and extension to PUNCH.FIL, and changed it to output to the disk. 3. Changed the line printer file to the disk, but left the file name and extension the same. 4. Changed the extension of the plotter file to "EXT" 5. Changed the "MINI" disk file name to DISK2. Page -6- Now let's run a demonstration. Mount the dectape from DECUS on a drive with logical name "FOO".(.ASSIGN DTA FOO) Then type: 1. .RUN FOO:DEMO 2. When the simulator is ready, change the speed of the paper tape reader to 1000000 cps. 3. Then change the paper tape input file name to FOO:FOCAL.TPE. ALTHOUGH WE ARE USING THE DISK, ANY SIMULATED DEVICE(WITH THE EXCEP- TION OF THE DF32 AND TELETYPE) COULD USE ANY PDP-10 DEVICE. 4. when the simulator is ready, run the BINARY loader. 5. When the simulator announces that the PDP8 has halted see if the AC is 0 (link will be 1). 6. If it is type C to continue running the binary loader and read the second half of the binary 'FOCAL' tape into the PDP8. 7. Again see if the AC is 0. 8. Then start the simulator at 200. 9. 'FOCAL' will now run on the simulated PDP8, and start typing "CONGRATULATIONS" 10. You will quickly notice that the type out is very slow. 11. So type "^.". This will return control to the DRIVER. 12. Now change the speed of the TELEPRINTER to 500cps and then continue running the program. 'FOCAL' is now running!! SECOND DEMONSTRATION 1. PIP DF32.FIL TO THE DISK WITH THE /I(IMAGE MODE) SWITCH. 2. .RUN FOO:8KPDP8 3. SPEED THE TELETYPE TO 500CPS AND THE KEYBOARD TO 100 CPS. 4. BOOTSTRAP THE DISK MONITOR INTO CORE 5. RUN PIP TO GET A DIRECTORY OF THE DISK, I.E.: .PIP *OPT-L *INP-S: Page -7- STRUCTURE OF THE PDP8 SIMULATOR The PDP8 simulator consists of 14 macro subroutines and 2 common Macro10 files(P.MAC and F.MAC). The file PDP8.MAC contains the basic simulator. It keeps track of time, sets some flags, handles the PI system and Data Break (RM08 only) and almost all memory references. A time flow is: A.TIME CONTROL a. (CYCLE:)Check for flags to be set and special routines to be executed(keyboard input, DF32 Data Break etc.) b. RM08 Data break handling. c. Check for interrupts if the PI is on B.INSTRUCTION CYCLE a. (INSFET:)instruction fetch. b. Effective address calculation c. Indirect address calculation d. (DISP:)Dispatch to individual instruction routines(by OP code) e. If not an IOT, the instruction is executed in PDP8.MAC. If the instruction is an IOT a dispatch is executed to its OPcode in its device subroutine. f. Return to time control for the next instruction cycle. Page -8- The other subroutines are: P.MAC Provides the definitions of several conditional assembly parameters, TTCALL UUO's, certain Macro definitions, accumulator assignments and some bit definitions, such as the bits in the flags. F.MAC Provides definitions of other common bits and words associtiated with the file structure, such as bits in CFSTAT and CDSTAT, and word definitions in File Data Blocks and Device Data Blocks. CORE.MAC The simulated core for the PDP8. The RIM and BINARY loaders for the PDP8 are always assembled in the high page of core. If the conditional assembly parameter PACK (in P.MAC) is a 0, then simulated PDP8 words are packed 3 words to a PDP10 word, otherwise they are placed one PDP8 word to one PDP10 word. MEMORY.MAC Contains the memory extension IOT'S. The instruction field (IF), and data field (DFF) are words in this routine. CONSOL.MAC Contains the functions of most of a PDP8's consol switches S(start),C(continue),L(load address),DP(deposit), E(examine),SS(single step)and the routines EXIT and INI which respectively close all files, and initialize all files. COMMON.MAC The Paper Tape Reader, Paper Tape Punch, PLOT- ter, and Printer use PDP-10 data files serviced by COMMON.MAC. Any PDP-10 device may be substituted for any of these simulated devices provided only that it can handle IO in the proper direction. Page -9- TTY.MAC Handles all IOT's for the TTY. The Keyboard is always active and every .1 seconds(assuming 10cps speed) input is attempted via the TTCALL UUO's. If a character was received the Keyboard flag is set(See P.MAC and F.MAC for a definition of flags). The PDP-10 Monitor intercepts certain special characters so we must resort to subterfuge if we are to be able to type the full character set on the simulatted PDP8 teletype. We accomplish this by saying that: ^^ is given to the PDP8 as an ^ ^_ is given to the PDP8 as a rubout ^C is given to the PDP8 as a control C In fact a ^ followed by any alphabetic character will give the PDP8 the corresponding control character. ^. will immediately return control to the DRIVER ROUTINE.(Since the teletype is polled infrequently this may not actually happen quickly.) The PDP-10 Monitor further meddles by echoing characters and inserting linefeeds after carriage returns. But again we persevere by having the simulator initiate half duplex, and tape modes of operation just prior to running a PDP8 program. If you stop the SIMULATOR while the PDP8 was running, typing control B, control S will return the teletype to normal operation. (I have assumed that the teletype controlling the job will be full duplex, if it isn't, you should make a change in the DRIVER, at OPR+2) PTAPE.MAC Handles the IOT's for a high speed paper tape reader and a high speed paper tape punch. Because paper tape is generally 8 channel, the simulation uses Image mode, therefore to Pip a paper tape to the disk use: .R PIP *DSK:FILE.EXT/I_PTR: and equivalently to Pip a file from the disk to paper tape. LPTSER.MAC Was intended to handle Line Printer IOT's but due to a lack of Line Printer IOT spec's was never written. It does handle the file for the DUMP command. PLOTER.MAC Handles the IOT's for an incremental plotter. Page -10- DF32.MAC Handles all of the IOT's for a simulated DF32. The value of DDF32(defined in P.MAC) is the number of mini disks in the system. The simulation uses a PDP-10 disk file to simulate the storage of the disk. Three 12bit words are stored in one PDP10 word, hence each simulated DF32 disk takes up approximately 256 PDP-10 disk blocks. The simulation may alternately use a dectape for the simulated disk storage. But if a DECTAPE is used, the normal PDP-10 file structure is not observed. Hence the file may not be transferred with PIP, and will probably overwrite any files which were previously on the DECTAPE. One DECTAPE is sufficient for the simulation of up to 2 mini disks. RM08.MAC Handles the IOT's for a drum type RM08. It is assembled only if DRM08(defined in P.MAC) is 0.(doesn't run) LINE.MAC Handles the simulation of 680 lines. Its assembly is conditional on the value of dcs680 in P.MAC.(doesn't run) PATCH.MAC Is patching space for the simulator. Most users will not find they need it and won't want to load it with the other routines. DRIVER.MAC Is the front end for the PDP8 simulator. It provides the command decoding etc. Page -11- ASSEMBLING THE PDP8 SIMULATOR The steps for assembling a simulator are as follows: A. PIP all files to the disk .R PIP *DSK:/X/B_DTAn:*.* B. Assemble all of the files .R MACRO *SIM.CCL@ C. Load the files together .R LOADER *PDP8,CORE,MEMORY,CONSOL,COMMON,TTY, *PTAPE,LPTSER,PLOTER,DF32,DRIVER$ D. Save the loaded program. .SAVE DSK:SIM E. CREF Listings can now be obtained by: .R CREF *LPT:_A *LPT:_B etc. to *LPT:_N Page -12- CONDITIONAL ASSEMBLY PARAMETERS There are a number of conditional assembly parameters defined in P.MAC which are: A. Variety of PDP8. These affect the operate instruction and simulated runtimes. a.PDP8 ;if 0 a PDP8 is simulated b.PDP8I ;If 0 an 8I is simulated c.PDP8S ;if 0 an 8S is simulated B. Core utilization and simulator speed which are unfortunately inversely related. a.INLINE ;if 0 IOT dispatches and memory references are faster but requires another 1K of PDP10 core to run in. b.PACK ;if 0 3PDP8 words are packed into one PDP10 word, if not 0 one PDP8 memory word is placed in one PDP10 word. (packed takes at least 4us longer per PDP8 memory access, but takes 1/3 the core) C. IO Device simulation a.PLOTER ;if 0, IOT's are simulated for a calcomp ploter. b.DDF32 ;if not 0 the value is the number of mini-disks to be simulated. If = 0 the IOT's are not simulated D. Action for error conditions a.ESTOP ;If = 0, then 4 conditions will cause an automatic trap to the DRIVER after execution. These are: 1. execution of an unrecognized IOT 2. micro programing right and left rotates in a single instruction. 3. EAE type instructions. 4. CYCLING IN MEORY,I.E. EXECUTING A NONJUMP INSTRUCTION IN LOCATION 7777. If ESTOP=1, no trap occurs and in any event the instruction is executed with the proper execution time accumulated. E. Memory size. a. MEMSIZ is the number of words in the PDP8's memory. i.e. ^D4096, ^D8192, etc. Page -13- MAINDECs To test the SIMULATOR all of the following MAINDECs have been run when the proper assembly parameters were used. MAINDEC-8I-D01B-PB 3/25/68 INSTRUCTION TEST 1 MAINDEC-8I-D02b-PB 3/21/68 INSTRUCTION TEST 2 MAINDEC-08-D02B-PB 1/3/68 INSTRUCTION TEST Part 2B MAINDEC-08-D07B-PB 12/26/67 RANDOM ISZ TEST MAINDEC-08-D04B-PB 2/8/67 RANDOM JMP-TEST MAINDEC-08-D05B-PB 12/28/67 RANDOM JMP-JMS TEST MAINDEC-08-D6CB-PB 6/1/67 CALCOMP PLOTTER TEST MAINDEC-08-d5DB-PB 8/22/68 DF32 MULTI DISK MAINDEC-08-D5CC-PB 4/4/68 DF32 DISK DATA MINI DISK, INTERFACE, ADDRESS, DATA TEST Comments may be directed to: DAVID McCLURE NORTHEAST REGIONAL OFFICE DIGITAL EQUIPMENT CORP. 15 LUNDA STREET WALTHAM, MASS Page -14-