The issue is that the system rom needs to be selected by having the system pio port A bit 7 high to enable the bios. The bios uses port A as a 1-byte register and just flips or adjust whatever bits need to be changed. However this new implementation sets the bits low (port->output = 0), disabling the bios.
I can enable the bios in the machine reset, but this doesn't set the port->output variable. So, at some stage the bios reads the port, gets 0, does what it needs to do, and outputs the modified value. So, the bios is now disabled causing an instant crash in the emulated machine.
edit: added the motor emulation is case it is needed
edit 2: the initial state of the machine is determined by pullup resistors on port A. Perhaps the initial value in the pio register is determined by this. Whatever, i don't believe there is anything more i can do unless i change the pio code.