simh / simh

The Computer History Simulation Project
http://simh.trailing-edge.com
Other
1.67k stars 303 forks source link

I1620: Enhancement: "IO in progress" message includes instruction #470

Closed DaveWise2 closed 6 years ago

DaveWise2 commented 7 years ago

It would be nice if the message printed when you interrupt deferred IO contained the instruction, like other SIMH halts.

I think I have it working. Here are code snippets, with a little bit of context.

i1620_defs.h

#define STOP_FPDVZ      39                              /* divide by zero */
#define STOP_IOINP      40                              /* **NEW** IO in progress */

i1620_sys.c

const char *sim_stop_messages[] = {
    "Unknown error",
   ...   /* more messages */
    "Floating point divide by zero",
    "IO in progress",                                   /* **NEW**, corresponds to STOP_IOINP */
    };

i1620_cpu.c

if (cpuio_inp != 0)                                     /* flag IO in progress */
    {                                                   /* **NEW BLOCK**, replaces sim_printf() */
    saved_PC = ADDR_S(saved_PC, INST_LEN);              /* back up to IO instr */
    run_cmd_message(NULL, STOP_IOINP);
    saved_PC = ADDR_A(saved_PC, INST_LEN);              /* restore */
    }

IBM 1620 simulator V4.0-0 Beta git commit id: c389573c sim> show ver IBM 1620 simulator V4.0-0 Beta Simulator Framework Capabilities: 32b data 32b addresses no Ethernet Idle/Throttling support is available Virtual Hard Disk (VHD) support RAW disk and CD/DVD ROM support FrontPanel API Version 4 Host Platform: Compiler: Microsoft Visual C++ 18.00.40629.00 Simulator Compiled as C arch: x86 (Debug Build) on Jun 7 2017 at 09:30: 16 Memory Access: Little Endian Memory Pointer Size: 32 bits Large File (>2GB) support SDL Video support: No Video Support PCRE RegEx support for EXPECT commands OS clock resolution: 1ms Time taken by msleep(1): 1ms OS: Microsoft Windows [Version 6.1.7601] Architecture: x86 on AMD64, Processors: 36 Processor Id: Intel64 Family 6 Model 63 Stepping 2, GenuineIntel, Level: 6, Revision: 3f02 git commit id: c389573c sim>

Local build, using Microsoft Visual Studio 2013.

Current (stock) behavior:

sim> d 0 dnty 0
sim> set throttle 50/10
sim> g 0
35000000010048000000000000000000000000000000000000000000000000000000000000000000
0000000000000000
/* ^E pressed */
IO in progress
Simulation stopped, PC: 12 (H   )
sim>

Desired behavior (what I get with the modifications above):

sim> d 0 dnty 0
sim> set throttle 50/10
sim> g 0
35000000010048000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000010
/* ^E pressed */
IO in progress, PC: 0 (DNTY 00000)
Simulation stopped, PC: 12 (H   )
sim>
ghost commented 7 years ago

Denied. run_cmd_message doesn't exist in 3.X.

DaveWise2 commented 7 years ago

How about fprint_stopped?

ghost commented 7 years ago

As I pointed out to Mark, input IO instructions can write all over themselves. Therefore, using what's at PC-12 is an unreliable indicator of what's going on.

The IO instruction can be reconstructed from the saved opcode, PAR, and the device number, which is not currently saved. I'll add this in the next major code drop.

DaveWise2 commented 7 years ago

Aha, quite right. It happens all the time - the boot command for paper tape is rnpt 0 at address 0, which is overwritten by the first instruction on the tape.

Thanks, I'll be looking forward to it.