<div dir="ltr">David,<div><br></div><div>I went through a similar exercise a couple of years ago when I wanted to add an additional massbus controller to the VAX-11/780 code in simh for RM and RP disk drives.</div><div><br></div><div>I convinced myself that the "right" approach was to adopt the approach taken for the rq disk controller, which can handle multiple controllers in a single set of source code functions. However, this looked like a lot of work.</div><div><br></div><div>What I actually did was to copy the file pdp11_rp.c to pdp11_rpb.c and rename the functions in pdp11_rpb.c to be rpb_xxxxx, rather than rp_xxxxx. There are many global variables defined in this file that would cause name clashes if not handled, but actually, none of them need to be global, so I defined them as static in pdp11_rpb.c.</div><div>There were a few other changes, but mainly just adding a DEVICE rpb_dev to go alongside the DEVICE rp_dev. I am not proud of the approach, but the resulting system worked.<br></div><div><br></div><div>If you are interested, I can send you the detailed list of the changes that I made as an example.</div><div><br></div><div>Cheers</div><div><br></div><div>Peter Allan</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 29 December 2015 at 20:03, Mark Pizzolato <span dir="ltr"><<a href="mailto:Mark@infocomm.com" target="_blank">Mark@infocomm.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Wednesday, December 23, 2015 at 5:17 PM, David Gesswein wrote:<br>
>    I was looking at adding a second TD controller to the PDP-8. It did<br>
> not appear that simh has an easy way of adding another copy of a device it<br>
> already knows about with a new device code etc.<br>
><br>
> My guess is I would need to modify the existing driver to duplicate<br>
> DEVICE td_dev and all structures referred to by it. It also looks like the<br>
> code directly references some of file global data so all direct references<br>
> would need to be changed. Is this the general approach?<br>
<br>
</span>HI David,<br>
<br>
Adding an additional device instance to the code which implements a simulated device after the fact can be messy.<br>
<br>
Depending on how the device is connected to (and addressed by) the CPU there are several different approaches to supporting multiple instances of the same device.  This is best considered when the initial simulator for that particular device type is implemented.<br>
<br>
Numerous examples exist in the current PDP11 codebase.  The pdp11_xq and pdp11_rq devices create separate DEVICE instances for each of the independent device controllers that are simulated.  These are handled this way since Qbus/Unibus devices are memory mapped and the DEC address conventions for device addresses have each controller with independent device addresses.  Meanwhile, the pdp11_td, pdp11_dz, pdp11_dl, pdp11_dc and pdp11_vh devices each support simulating multiple controllers while they only have a single simh DEVICE structure.  For these devices this is possible since the memory mapped buss addressing conventions say that multiple independent controllers will occupy adjacent memory addresses in the I/O page, therefore increasing the number of supported controllers merely expands the size of the I/O page address window for successive controllers.   Depending on the needs of the device in question different relationships between the DEVICE and its related UNIT structures are possible.  You may want to look closely at pdp11_td.c for some ideas since it is a cartridge tape simulator and supports from 1 to 16 controllers with up to 32 drives.<br>
<span class="HOEnZb"><font color="#888888"><br>
- Mark<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
Simh mailing list<br>
<a href="mailto:Simh@trailing-edge.com">Simh@trailing-edge.com</a><br>
<a href="http://mailman.trailing-edge.com/mailman/listinfo/simh" rel="noreferrer" target="_blank">http://mailman.trailing-edge.com/mailman/listinfo/simh</a></div></div></blockquote></div><br></div>