[Simh] attaching a tape virtual file without stopping simulation

Brian Knittel brian at quarterbyte.com
Tue Jan 22 13:24:14 EST 2008


Hello François,

> How can I attach a tape virtual file to the TQ0 simulated
> device in simh without stopping simulation with CTRL-E? 

You can't do this with SIMH as written. You'll have to
modify SIMH. But, it isn't terribly difficult to do so. 
I did this with the IBM1130 simulator, so that its 
(Windows-only) GUI could perform mounts and dismounts 
for the card reader and printer, and could start and 
stop the CPU.

A very simple method would be to have the CPU loop check 
for the existence of a file with a specific name every 1/10 
of a second, or 10000 CPU instructions, etc. If found,
process the file using the "do" command handler. Then delete
the file. Suppose the file was to be named simh_remount_command. 
The code could look like this:

  if (a reasonable time has elapsed) {
     FILE *fcmd;
     static char special_filename[] = "simh_remount_command";
     if ((fcmd = fopen(special_filename, "r")) != NULL) {
         fclose(fmd);
         sim_switches = SWMASK('V');    /* tell SIMH to echo the commands */
         do_cmd(1, special_filename);
         remove(special_filename);        
     }
  }

You'd want the "a reasonable time has elapsed" test to
be something very cheap to compute. I'm not familiar with
the VAX simulator so I don't know what that might be.
I suppose you could also put this inside the line-frequency
clock routine. If you perform the test only every 10 clock 
ticks it won't impact performance at all.

Then, a tape change might look like this, from another 
terminal window, set to the same default directory:

    cat >xxx
    attach tq0 tape3.tap
    attach tq1 tape4.tap
    ^D
    mv xxx simh_remount_command

(Creating the file under a different name prevents SIMH
from seeing it before it's complete). You could easily
write a batch file or script to assist this process --
have it create the special file, then wait for it to
be eaten by simh.

The advantage of the file technique is that
it doesn't require setting up a separate thread. You
could also use RPC, raw TCP/IP, pipes, or some such, 
which would be handled by a separate thread, which 
could then communicate the presence of mount/dismount 
instructions to the CPU loop by setting a flag.

Regards,
Brian

On 22 Jan 2008 at 10:26, Boucher, François wrote:

> 
> Hi to all!
> 
> I am testing the simh magnetic tape device, and I encountered a difficulty.
> To attach a simulated tape file to the simulator, I need to go to the simh console,
> by typing ctrl-E then type the attach command, ex: attach tq0 tape.tap
> and then continue the simulation with cont.
> 
> The problem is that when I stop the simulator, with ctrl-E as my simulator is in a cluster,
> other nodes stop seeing it and start a vaxcluster modification that removes the node in
> question from the cluster, as they believe it is unavailable. 
> The cluster heartbeat is stopped as the simulation is stopped.
> If I do a CONT command then, VMS makes the stopped/started node crash abruptly and reboot.
> This behaviour is ... annoying! ;)
> Of course, if the simulator is running as a single instance, or is not part of a VMS cluster, this 
> problem
> does not show up.
> 
> Another thing to note, is that when VMS does a dismount mua0: of the tape, the attached file is 
> then
> getting detached by simh. This behaviour is perfectly correct, as in the physical world, when a 
> real tape 
> is given the unmount command, the tape drive effectively ejects it, unless the switch /nounload is 
> specified.
> That behaviour is also perfectly reproduced in simh.
> 
> My question is:
> How can I attach a tape virtual file to the TQ0 simulated device in simh without stopping 
> simulation with CTRL-E ?
> Is there a software signal that can be sent to the simulator to activate the tapefile attach ?
> Note that I can accept to have the tape filename to be a constant.
> 
> Thanks,
> 
> Francois Boucher ing.
> 


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
_| _| _|  Brian Knittel
_| _| _|  Quarterbyte Systems, Inc.
_| _| _|  Tel: 1-510-559-7930
_| _| _|  http://www.quarterbyte.com




More information about the Simh mailing list