Close

"It's the little things" -- FDC formatting (write track) now working

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/02/2016 at 17:500 Comments

OK, after spending some quality time with the disassembler, disassembling TRSDOS 2.3 FORMAT/CMD, and stepping through the emulator, I found a bug: I failed to invert a bit being used in an AND mask. Obviously this caused all the other bits to be reset, one of which was 'Track 0 detect'. So.... a one-character ('~') fix, but hours of debugging. It's the little things, no?

So, I'm formatting in TRSDOS 2.3 and LDOS 5.3.1 in single, double, mixed, 1 and 2 sides, and semi-arbitrary number of tracks. And I can reformat (oh that failed too, for coincidentally a different AND mask reason - there I forgot to mask off some flags from an offset value).

So, I am nearly done with this FDC journey. TRSDOS 2.7 is not formatting properly for some reason. Well, it's formatting, per se, but hangs at 'writing system information'. I can verify that the disk image is properly formatted at that point, but the directory track is not written and the track 0 'mixed density' track has not been reformatted. Hmm. Well, I guess I should probably download and test other OSs as well -- NewDOS, UltraDOS, MultiDOS come to mind. Hopefully they work as is.

One additional challenge with 2.7 is that it does not reference the 'system' files (the OS) in the directory, like previous versions, and all other OSs do. I am guessing that this is either to free those directory slots for the user, or perhaps less charitably, to make reverse-engineering more difficult. So, disassembling that OS will be an extra challenge just in setting up to disassemble it. Fortunately, I had written a tool to dump the floppy image in a low-level form (basically, a sorted extraction of the sector images with hexdump and some drive metadata about them). So I will first 'disassemble' the floppy to find the 'hidden' OS 'files', and then go back and forth between that and the code disassembly following from boot until I can glean how 2.7 is put together. Sounds like slow going, alas. Fortunately, I am Number 5's nemesis, and I love to disassemble!

LDOS has definitely become my go-to OS, so I could possibly punt, but I really want to get these last cases put to bed (so that I can be put to bed) and move on to other things. Namely:

* along the way I implemented Newclock-80 emulation. It seemed trivial to do -- and it was -- but what is not trivial is that a hardware RTC was a fancy thing in 1980. None of the OS recognize it out-of-box, and require patches to actually make use of it. I did find a patch for LDOS 5.1.3, but not 5.3.1. Most of that patch is reuseable with simple ORG changes, but the last thing is an internal routine named 'PACKIT', which I cannot find in the 5.3.1 code. So I need to spend some more time with the disassembly to see what I can do about it, which means also understanding the surrounding code better, as well.

* serial port emulation. The USB serial is in-place, but I need to implement the emulator parts and wire it to it.

* depending on mood, I may do hard drive and printer. I can easily punt on those for a while.

* more important is porting it all to the new hardware platform. As mentioned before, this is going to be a little more work than I initially had expected, but c'est la vie, it's required. I'll miss the color, though.

Discussions