Close

Finally finished with FDC....

A project log for TRS-80 Model 1 on a PIC32

TRS-80 Model I emulated on a PIC32MX processor; VGA, PS/2, and SD for tape and disk images. Oh, and glourious cassette sound.

ziggurat29ziggurat29 09/06/2016 at 21:130 Comments

OK, I think I am truly done with the FDC emulation now. My problem in TRSDOS 2.7 formatting turned out to be due to the (emulated) disk interrupt coming in way sooner than (actual code of) TRSDOS expected during the 'writing system information' phase, and because the TRSDOS 2.7 ISR does not ack the fdc IRQ any more (unknown why they dropped this). The net result is that during that phase, a 'restore' is done to seek to track 0, and the IRQ is issued immediately (because we're virtual hardware), but the TRSDOS is not in a position to ever acknowledge that interrupt, so it infinite loops re-interrupting itself.

This implementation defect is probably masked in the real world, because the 'restore' would take a finite amount of time, which would allow the code to move forward a few instructions to reach the point where it is polling the status bit, which does clear the irq. So, I introduced a 'deferred' interrupt request on Type I commands (seeks, etc) to simulate the non-zero amount of time that the FDC would take to execute the commands.

So now that can be considered 'done' I hope. Now it's time for some serial port emulation. My intent is to use the USB CDC as my serial port, rather than the physical UARTS. I'm a little bit concerned, though. The USB involves code execution, which might slow down the emulator too much. If so, then I have at least two choices: 1) invoke the code only periodically, instead of every pass through the cyclic executive loop, and 2) punt on USB and use the hardware ports. I really hope I can get the USB option working, though. The hardware UART would probably mean needing some more parts -- probably a FTDI interface board -- and really I don't want to add any more parts since I've got a perfectly serviceable USB connector on-board already.

Discussions