Commit graph

68 commits

Author SHA1 Message Date
Bob Supnik
ef94dcbe93 SDS: Simplify MT operation check.
The SDS tape unit can't do write reverse (no magtape tape can, afaik).
So instead of testing for a particular write subop, the code just tests
that the write was done in BCD mode.
This is closer to how the hardware works.
2018-05-23 15:52:08 -07:00
Mark Pizzolato
b7b1f427d0 I1401, I7094, ID16, ID32, NOVA, SDS, SIGMA: CONST compatibility with 3.10 2018-03-09 15:55:22 -08:00
Bob Supnik
5b5e0f9c35 H316, I7094, NOVA, PDP1, PDP10, PDP8, SDS: Coverity singleton errors
Most history routines defined a local sim_eval of the proper length, but the
erroneous ones were fixed length machines that defined an integer variable
instead of an integer array of length 1. The VAX used the global sim_eval.
The changes follow the VAX practice.
2017-09-07 09:59:04 -07:00
Bob Supnik
33f02ae4d7 SDS: Add precise gap erase to MT device
As discussed in #152.  Still needs some additional sim_tape work.
2017-03-20 08:03:49 -07:00
Bob Supnik
fa62a00fd0 GRI, H316, I7094, NOVA, SDS, sigma: Annotate switch case fall through (COVERITY) 2017-03-13 10:44:51 -07:00
Bob Supnik
97a11f2b05 SDS: trap_P not set if mem mgt trap during fetch (COVERITY) 2017-03-09 19:47:19 -08:00
Mark Pizzolato
d8dbc7e6b5 SCP: Migrate all stdio writes to pass through SCP provided Fprintf() 2017-01-14 20:48:09 -08:00
Mark Pizzolato
c33abecf8b SDS, Sigma: Make sure breakpoint's don't advance sim_time 2016-08-30 15:51:45 -07:00
Mark Pizzolato
5531ccb175 ALL: Massive 'const' cleanup
These changes facilitate more robust parameter type checking and helps
to identify unexpected coding errors.

Most simulators can now also be compiled with a C++ compiler without
warnings.

Additionally, these changes have also been configured to facilitate easier
backporting of simulator and device simulation modules to run under the
simh v3.9+ SCP framework.
2016-05-15 15:25:33 -07:00
Mark Pizzolato
820d77ef69 GRI, I1401, PDP10, SDS: Fix compiler detected inconsistencies 2016-05-05 03:50:21 -07:00
Mark Pizzolato
41978eca80 All: Convert from C runtime library perror() to sim_perror so that all messages will arrive in the same place(s). 2015-04-03 19:56:37 -07:00
Mark Pizzolato
f2ca388f9c GRI, PDP1, S3, SDS: Forwardport of Bob Supnik's merge from the master branch (change to sim_printf) 2015-04-03 19:53:39 -07:00
Mark Emmer
f56ade6168 SDS: Adjust communication MUX inter-character timing
When stuffing the LOGOUT command to a pseudo-teletype, the command script processing program CCP encountered a race condition because the MUX timing was too slow.  The pseudo-teletype did not reliably log off as desired. Cutting the event wait time in half fixed the problem.
2015-03-01 22:59:03 -06:00
Mark Pizzolato
e768629009 SCP: Added the capability for EXAMINE command output to be written directly to a socket. 2015-02-21 12:40:36 -08:00
Mark Emmer
a67afa4a29 SDS: Do not stop simulator on paper tape reader error
The simulator stops when reading past EOF on the paper tape device's attached disk file (or if no file is attached to this device). The SDS timesharing system is capable of processing an end-of-record interrupt in these circumstances, resulting in proper error reporting to the user program that is reading paper tape.
2015-02-17 22:12:28 -06:00
Mark Pizzolato
54a4845fb2 ALL: Revert "ALL: make sure all useful state is in simh registers while processing events"
This reverts commit 5551a0dd9c.

The original idea was that the state being put into simh registers would be required to have all useful information available when remote console executed commands.  These steps were taken from the code that sim_instr() executed as it was exiting.  After this change was made it was realized that once a remote console command executed it might change state that directly affected instruction execution.  To solve this, the logic that executes before the instructions in sim_instr() would then need to be executed whenever the event dispatch processing completed.  This approach is messy, burdensome and potentially a lot of overhead for every event dispatch even though almost none of the event dispatches would be for remote console command execution.  A completely different approach was suggested by J. David Bryan.  That alternative approach would be to have remote console commands execute outside of the sim_instr() routine.  Thus allowing the existing prelude and postlude code in sim_instr() to be performed naturally and let the remote console activities run in the same context as all other simh commands.  Recent changes to scp and sim_console implement this alternative approach and thus these original changes are completely irrelevant and are thus being removed.
2015-02-15 12:42:32 -08:00
Mark Emmer
3b33804327 SDS: Fix overflow test instructions OVT and OTO
Improper implementation of the OVT and OTO instructions. OV is always zero or one, so the Boolean AND in the  original if statement would always fail. Also, these instructions are supposed to skip if overflow is not set, the opposite of the way it was coded.
2015-02-05 17:42:04 -06:00
Mark Emmer
4bd2eb72de SDS: Corrections to memory trap logic
1. In sim_instr, if an Unauthorized Memory Access trap occurs, the code was enforcing the 940 Reference Manual's admonition that:
    "The instruction in the trap location must be a MARK PLACE AND BRANCH (BRM) instruction."
Normally there is a BRM TRAPM in location 041, but when exploring a memory trap, the TSS monitor code at CEX (SMEM) temporarily puts a BRU CEX2+1 in location 041.

Clearly the hardware allows BRU in the trap transfer vector, because the system uses that feature. Change simulator to allow BRM or BRU in Unauthorized Memory Access Trap vector word in location 041.

2. Page 17 of the 940 reference manual specifies special actions when the target address of a BRU, BRX, BRM or BRR instruction cannot be accessed because it's not in the memory map. The simulator was not doing this, causing TRAPM to operate with the address of the BR? instruction instead of its target address.   The result was to allocate a page of zeros, which then trapped when the branch completed and transferred to a HLT instruction.

By modifying the code in sds_cpu.c to provide the correct trap address, monitor code TRAPM does not allocate a page, and instead allows any user-defined trap to fire off.  This fixes the problem with DDT, which relies on this trap to then map in the DDT SBREK page to 34000 and then complete the transfer to it for command processing.
2015-02-02 21:00:05 -06:00
Mark Emmer
b63b3953d2 SDS: Allow display or entry of NOP with optional operands
While debugging DDT subsystem of 940 time-sharing system, discovered NOP opcode used with indirection, non-zero operand address and tag field. I_V_OPO (opcode only) was redundant with I_V_NPN (no operand) opcode classes. Convert I_V_OPO to new "operand optional" class and use it for NOP, and add code to detect presence or absence of operand or tag for this class for machine code display and entry.
2015-01-31 23:30:17 -06:00
Mark Emmer
84e816dfaa SDS: Add different 6-bit internal to/from ASCII character conversion tables for 940 mode
The existing conversion tables were for the 930 and earlier models of SDS computers. The SDS 940 altered these tables. This change selects the appropriate table based upon the current CPU mode -- whether operating as a 930 or a 940. See Appendix A of both the 930 and 940 reference manuals for detailed character conversion information.  Correct 930 ASCII to internal table for ASCII input value 0140.
2015-01-31 23:18:04 -06:00
Mark Emmer
7dfc409da3 SDS: Fix intermittent I/O data errors when two or more I/O channels active
When reading from paper tape on the W channel and writing the drum on the E channel, intermittent errors and premature end-of-record were observed. The TST_XFR macro was failing to properly quality that a data character was available for a particular device and channel. Thus, a data ready condition for the drum would cause a bad transfer for another active device on a different channel.
2015-01-19 19:29:28 -06:00
Mark Pizzolato
5551a0dd9c ALL: make sure all useful state is in simh registers while processing events 2015-01-15 12:37:07 -08:00
Mark Emmer
e48cb518e8 SDS: Correct ill-formed statement
VMS compiler objected to variable ch being modified in two places in the same statement. Expand into full if statement instead.
2014-10-23 21:43:55 -05:00
Mark Emmer
f597da0a98 SDS: Refine Next command for subroutine branch
1. Treat the SBRM SysPOP like the BRM opcode for calling a subroutine.
2. If the -a (atomic) switch is present with a BRM or SBRM instruction, place a breakpoint at EA+1 rather than EA, since the return link is placed at EA (BRM) or at *EA (SBRM) with subroutine execution commencing at EA+1.
2014-04-23 20:51:24 -05:00
Mark Emmer
6f9f387c39 SDS: Add more complex (but optional) Next behavior
Allow -f switch with Next to move forward in code.
Allow -a switch with Next for "atomic" behavior that excludes interrupts for all instructions.

Update sds_doc.doc to describe the new behavior.
2014-04-19 14:50:15 -05:00
Mark Emmer
2df2f33352 SDS: Add -f switch to Next command to force step-over mode
Add -f switch ("force") to the Next command to set the temporary breakpoints regardless of instruction type.  This is useful at
the bottom of loops or to avoid going off into unrelated code should an interrupt or memory paging trap occur.
2014-04-17 07:55:12 -05:00
Mark Emmer
c4438e15f4 SDS: Support simulator's new NEXT command to step over subroutine calls
Step over BRM, POP or SYSPOP by planting temporary (dynamic) breakpoints at P+1 and P+2.
2014-04-17 00:09:11 -05:00
Mark Emmer
fcbd91f146 Merge git://github.com/simh/simh 2014-04-09 22:18:06 -05:00
Mark Emmer
bf06cb4f87 SDS: Clean up CPU modes and record CPU mode in instruction history record
The three CPU modes -- normal, monitor and user were represented by two binary flags (nml_mode and usr_mode). The code is simpler and easier to read if the three modes are represented by one three-valued variable, cpu_mode. In addition, record the CPU mode in the instruction history record, and add the mode to the history display.

In addition, add an optional flag to the SET CPU HISTORY=n command to *not* record instructions executed in a particular CPU mode.  Flags are -n, -m and -u for normal, monitor and user mode respectively.  For example, SET -m CPU HISTORY=n will only record instructions executed in normal or user mode, and will not record instructions executed in monitor mode. This change aids user-mode program debugging by not filling the history with monitor-mode service functions and interrupt activity.
2014-04-09 22:11:55 -05:00
Mark Emmer
be18514beb SDS: Add assembly/disassembly support for common SYSPOPs.
Add new instruction class -- I_V_SPP for SYSPOPs and definitions for the standard ones provided by the time sharing system. Add instruction name annotation to the opc_val array.
2014-04-09 22:00:57 -05:00
Mark Pizzolato
6ce8d99cd8 SCP: Added generic output routine sim_printf to output to stdout and sim_log (and sim_deb when enabled)
The goals here being to simplify calling code while getting consistent output delivered everywhere it may be useful.

Modified most places which explicitly used sim_log or merely called printf to now avoid doing that and merely call sim_printf().
2014-03-28 08:20:05 -07:00
Mark Emmer
d04e909d5f SDS: Further refinement to bootstrap from RAD, update SDS documentation
Instead of conditionally compiling in bootstrap support depending upon attached channel, determine dynamically based on RAD's current assignment to channel W or channel E.  This allows using "set rad channel=W" for purposes of bootstrapping, and then relocating the RAD with "set rad channel=E" for running a TSS monitor that expects to find the RAD on channel E.
2014-03-17 17:48:59 -06:00
Mark Emmer
0b69e4e4d9 SDS: Allow console bootstrap from RAD if connected to W channel
Normally the RAD is connected to the E channel and there is no bootstrap capability (because of hardwired WIM instruction). However, for completeness, add code to allow booting from the RAD if it is connected to the W channel. Add RAD_CHAN definition to define which controller the RAD is connected to.

Improve parentheses in bootstrap code that allows an optional word count (while also permitting the canonical bootstrap sequence).
2014-03-17 16:36:28 -06:00
Mark Emmer
c256894b62 SDS: Allow LOAD command to accept a more flexible boot sequence
The canonical boot sequence uses WIM 0,2 in location 5 and an initial load address in location 11 (and in the X register). This is limiting for devices like RAD that do not report an end-of-file, or for paper tape that report EOF too late and cause the WIM to fail. A simple load address in location 11, with bit 9 set to satisfy the BRX, doesn't do any word counting.  The BRX always branches back to location 5.

This change allows a true negative word count to be placed in location 11 to work with a WIM XXXXX,2 where XXXXX is one location past the region to be loaded by the boot sequence.  XXXXX plus the negative count in location 11 (buf[3]+buf[7]) initially points to the first location to be loaded, and the BRX will not branch when the word count is exhausted (register X=0) allowing the branch to the start address to be executed.

Old allowable boot sequence:
location  2 = WIM 12,2
location  3 = BRX 2
location  4 = LDX 11
location  5 = WIM 0,2
location  6 = SKS 21000
location  7 = BRX 5
location 10 = BRU Transfer Address
location 11 = Load address with bit 9 set to force BRX to branch

New allowable boot sequence:
location  2 = WIM 12,2
location  3 = BRX 2
location  4 = LDX 11
location  5 = WIM [end load address + 1],2
location  6 = SKS 21000
location  7 = BRX 5
location 10 = BRU Transfer Address
location 11 = Negative count to number of words to load
2014-03-05 19:08:33 -06:00
Mark Emmer
91c78b79ef SDS: Install better fix for 2x real-time clock speed problem
Received better fix from Mark Pizzolato for the problem of having 120 clock interrupts per second instead of 60. Tested for several hours and verified that wall-clock time matches TSS monitor time.
2014-03-04 17:39:34 -06:00
Mark Emmer
cf56b11321 SDS: Adjust real-time clock pulse interrupt period
Clock is running twice as fast as it should -- 120 interrupts per second instead of 60.  Cannot find problem in initialization or calibration or count-down code, so for now, divide rtc_tps by 2 prior to invoking sim_rtcn_calb.  Now 940 Executive reports wall-clock time advancing at proper rate.
2014-03-02 22:49:04 -06:00
Mark Emmer
396e78cb26 SDS: Allow specifying breakpoints as being in monitor, user or normal mode only
Breakpoint logic now allows four execution-type breakpoints:
 -E  as before, break if PC equals address, unqualified by mode
 -M break if PC equals address and machine is in monitor mode
 -N break if PC equals address and machine is in normal (SDS 930) mode
 -U break if PC equals address and machine is in user mode
2014-03-02 22:47:39 -06:00
Mark Emmer
614fe87af4 SDS: Alter display and entering of ASCII data
SDS internal ASCII differs from standard external ASCII. Alter the examine and deposit functions with -A switch to properly adjust between the two forms. Also allow strings rather than one-character per word as was in the original code.  Clean up six-bit character display logic to use a loop.

Remove superfluous trailing blanks from lines in file.
2014-03-02 22:44:35 -06:00
Mark Emmer
0c6c4c7916 SDS: Fixed head disk addressing corrected when start new sector
rad_adjda was setting sba=0 at a sector boundary, which did not reflect that the first 12-bits of the sector have already be read or written. Must set sba=1 for proper addressing.

Removed superfluous end-of-line spaces from file.
2014-03-02 22:27:45 -06:00
Mark Emmer
a07addf5fa SDS: Various fixes to asynchronous communication mux
1. In pot_fork, the permanently asserted interrupt, the interrupt bits were assigned in the wrong order -- bit 8 is interrupt 0 and bit 23 is interrupt 017 in each group of 16. Also, the group number was incorrectly calculated -- need to subtract 0200 before dividing by 020.

2. In case 3 of EOM and SKS when in SDS mode, it does not dispatch properly. The device table is set for Genie mode.  Add test for device 077 in SDS mode and switch to device 1, which is Mux in Genie mode.

3. Add test to PIN to verify that scanner is locked before returning PIN data.

4. Mux should not queue a new interrupt for a flag type if it is already queued and pending for a different channel. If do so, when the CPU clears the interrupt, the second interrupt is lost.

5. If POT specifies interrupt but no Tx character present, queue a Tx interrupt immediately if the transmitter is not active. This technique is used by the 940 monitor to start output of the transmit character buffer.

6. Per the 940 reference manual, after servicing the highest priority interrupt on a particular channel, the scanner should look at all other channels before looking for additional interrupt types on the first channel. Change scanner to always resume scan with the Rx interrupt on the next channel from where the scanner paused.

Also removed superfluous trailing blanks from lines in file.
2014-03-02 22:26:44 -06:00
Mark Emmer
5b479c7ab2 SDS: Do not reload channel interlace register if already alerted
From actual monitor code, sequence used to read drum:
             EOD*  10000B   Alert Interlace
GDAC3: EOD    14202    I/O control mode EOD (mode 1)
                                        A=0  High order memory address bits
                                        Hicount=2 (Word count=04000=2KW)
             POT      GDBCL+2  Low-order memory address bits.
             RRF                    (EOD 2226) Read RAD file (mode 0)

Problem is that RRF is clearing the interlace information saved by the previous POT and sets up for a new POT. That is, in sds_io.c, mod 0 of op_eomd always assumes that a POT will follow if the channel is C or greater. Have to add tests of chan_flag.  If interlace is active, do not capture new information from this EOM/EOD.

Also removed superfluous trailing blanks from lines in file.
2014-03-02 22:24:28 -06:00
Mark Emmer
d5acbc6f7a SDS: Fix clock pulse interrupt bug
The single-instruction Clock Pulse interrupt (75 octal) may be a MIN or SKR instruction. The function rtc_inst increments (MIN) or decrements (SKR) the operand and tests for zero and generates a Clock Sync interrupt (74 octal) if so. However, the SDS 940 reference manual is incorrect; in the SKR case, the test should be if the result is negative.
2014-03-02 22:22:20 -06:00
Mark Emmer
5270c44117 SDS: Fix bugs in Monitor-to-User Transition
1. When transitioning from monitor to user mode with the trap enabled, the trap was latching the monitor address of the transferring branch rather than the user-mode address of the branch target.

2. When executing a BRU, BRX or BRM in monitor mode, if the effective address was in user mode, the code neglected to transition the machine to user mode. And after doing so, it is necessary to check for an armed monitor-to-user trap.

Also removed superfluous trailing blanks from lines in file.
2014-03-02 22:21:13 -06:00
Mark Pizzolato
4e5f910fed Compiler nits for void * assignments from Bob Supnik 2013-09-04 19:50:47 -07:00
Mark Pizzolato
6401a371ba Compiler suggested cleanup 2013-05-23 11:27:53 -07:00
Mark Pizzolato
d5ca542102 Changed use of compile #defines which start with a _ character to not do this since defined symbols starting with _ are reserved to local compiler/runtime implementations in the C language. This addresses issue #32 2013-03-12 11:07:58 -07:00
Mark Pizzolato
95033cee15 Declare the console port input and output polling units for most simulators to potentially allow asynchronous console I/O. 2013-01-21 11:31:29 -08:00
Mark Pizzolato
dac73b9381 Migrating scp and library global variables to be declared as extern in the appropriate library include file and remove repetitive declarations in referencing modules. 2013-01-10 13:29:15 -08:00
Mark Pizzolato
7b6f7a9871 Set device flags indicating DEV_DISK, DEV_TAPE, DEV_MUX and DEV_ETHER for all simulator devices which use the sim_disk, sim_tape, sim_tmxr, and sim_ether libraries 2013-01-07 12:47:24 -08:00
Mark Pizzolato
b466bdc9c6 Compiler warning cleanup 2012-12-13 13:41:57 -08:00