Developer's Diary
Software development, with Terry Ebdon
08-May-2019 Scripting simulations
Author
Terry Ebdon
Date
08-MAY-2019

Wednesday 8th May, 2019

For the last few months I've been re-writing old-school gaming software in Groovy. My Trk21 project is now working better than the original code, so I've been looking for another interesting project. Trk21 came about when I installed TREK on my simh simulation of a PDP-11/73 running RSTS/E V7. This is pre-generated ELVIRA system, that I've always found annoying. I couldn't find a distribution kit, so put up with. But two years later there are a lot of interesting distros out there. I decided to install RSTS/E V8 on the latest simh. That didn't go as well as I'd expected, possibly because the distro's tape image isn't a verbatim copy of the original tapes. I documented every step of the failed build; I'm one of those odd developers that loves writing documentation. I now have very basic V8 system running, with none of the system programs (CUSPs) or patches installed.

At this point I stepped back and started thinking about scripting the build, and importing / exporting the configuration files. This is where things start to get interesting.

Scripting simh

The simulators command language (SCP?) has improved a lot since I last looked. It's now possible to interact with the simulation. So far I've managed to script the hardware simulation and boot sequence, and interact with Init on the booted system. I had to insert a temporary break-point to get my post-boot input accepted. This is rather hacky and, shouldn't be necessary. I'll re-visit this once I'm more familiar with the scripting language.

It looks like the boot DP0 command inactivates the preceeding send command. i.e. this command sequence does not work:

send "ID\r"
boot RP0

How did I know where to insert the break-point? Inspired guess-work! The nice thing about a simh is that everything's easy to backup and there's no hardware to break. If I could work out where Init displays the "Option: " prompt, once it's booted, then I could put a one-off breakpoint there and push my commands into the queue. That's ridiculously easy:

  1. Boot the system.
  2. Wait for the "Option: " prompt.
  3. Hit CTRL+E to escape to the simulator.
  4. The simulator displays the current program counter.
  5. Use the displayed PC value to set a break point in the script.

Running these steps by hand gives:

17-MAR-2019 👈 Top of page 👉 10-MAY-2019

© 2020 Terry Ebdon.

Find me coding on GitHub, networking on LinkedIn, answering questions on Stack Exchange and hanging out on twitter.