I did come across a couple of interesting things along the way.
1. The routine loop0 in the PDP11 core (pdp11.c) would execute as long as tubeContinueRunning() returned true. For integration into b-em I had defined this as:
Code: Select all
static inline int tubeContinueRunning() {return tubecycles > 0;}
Code: Select all
static inline void tubeUseCycles(int c) {tubecycles -= c;}
2. The interrupt handling seems odd. The PDP11 core defines a routine pdp11_interrupt() so I had the tube ULA interrupt code call this when R4 was written to. This almost worked in that the first write to R4 for a host->parasite transfer generates the interrupt on the parasite side but then so did each subsequent write to R4, i.e. the transfer address etc. Looking more closely it seems some "glue code" in the PiTubeDirect copro-pdp11 is checking the PDP11's interrupt priority mask before calling pdp11_interrupt(). This is what seems a little strange - normally I would expect a processor to check it's own interrupt mask/priority before accepting an interrupt. Is this a drop off in the PDP11 core or is the PDP11 odd?
3. The PDP11 client ROM fails to defend against it's own data areas being overwritten by incoming data from the tube. This means it crashes with MOS 3.50 because this transfers a (useless to the PDP11) version of BASIC across that is being relocated to run in high memory (on the 6502) and therefore sits just below the ROM on the 6502 co-pro and on top of workspace on the PDP11. It works fine on MOS 3.20 and the non-master OSes.
On this last point I had a previous discussion with JGH. His view was that the host should be able to transfer to any address in the parasite but it seems to me this is not possible. If the host crashes the parasite by overwriting the workspace of the code that is receiving the transfer then the tranfer will fail just as surely as if the parasite had chosen to ignore the incoming data with the additional anoyance of crashing the parasite so having the client ROM check the incoming address and simply discard anything that would overwrite it seems like the best solution to me. If an OS want to replace the client ROM and use its own drivers for the tube hardware then it would need to transfer to a lower address initially and then relocate itself.