The TRS-80 Model II support in Kermit is missing hardware flow control support however which means that it’s very prone to dropping characters. I started to look into what it might take to add hardware flow control and this sent me down a rabbit hole of trying to figure out how the TRS-80 hardware works, how the Z80 SIO works, learning Z80 assembly, and of course, how the heck you even build CP/M Kermit 4.11 from source.

The instructions for building Kermit are buried somewhere around the middle in the documentation file that describes how to use Kermit. The source is in 8080 assembler and targets Microsoft’s M80 or LASM, originally made by Ward Christensen. He reverse engineered the assembler that came with CP/M and made improvements to it. There seems to be some confusion over the copyright on LASM, and I’m not certain Ward’s original assembly source was ever released. About all I found about the source was a message from 1989 where a Kermit distributor was trying to hunt it down.

I was able to build the TRS-80 overlay for Kermit on CP/M. At first I tried doing it on the TRS-80 itself, but I was having too many issues with bad sectors and seek errors. Not sure if it’s bad media or bad drives. Since trying to build on retro hardware was becoming too difficult I got z80pack and was able to use the CP/M simulator to do the build.

While building inside of a CP/M environment works, it’s inconvenient. It’s a hassle moving files in and out of disk images. Editing files under CP/M would also be torture, I’d much rather use emacs which can take advantage of my screen real estate. Even back when CP/M was still king development was often done on faster more powerful computers with more resources available whenever possible. Cross assembling under Linux would also allow me to setup a nice Makefile. I tried out half a dozen different cross assemblers under Linux, but not one of them accepted the LASM syntax.

I thought if I could find the source for LASM it would make it easier to write a new program in C or Python to make a Linux cross assembler. I did find source for LASM-TDL but it is a different animal and even though it claims to be a derivative of LASM it is not compatible. Yesterday I realized there was probably an easier way. Instead of writing an assembler from scratch I decided to massage the 8080 LASM-style source into something that one of the other assemblers that runs on Linux would accept. Of all the different assemblers I had tried under Linux† I found that the AS Macroassembler was the best fit. The others were too simple to understand conditional directives or insisted that ORG had to be set before you could even define any macros!

It took most of the day but before I went to bed I had something that would pre-process all the Kermit ASM files, rewrite mnemonics, fix up string constants, and in the end spit out a hex file that was identical to what I was getting from LASM running on CP/M. This morning I had to make a few more tweaks to it and then I was able to assemble the 8080 CP/M 2.2 source too.

You can also use cpmtools to move files back and forth between a huge variety of CP/M formats, not just a single emulator. However as I said above, moving files back and forth between an emulator is much more of a hassle than simply assembling the source directly on Linux. With my version of LASM that runs on Linux I don't need to jump through hoops to build the project, I can do it with a single button in my preferred IDE.