As I was building an 8085 SBC with a relatively large memory space compared to the microcrontrollers I had previously used, I desired a C compiler for it to develop substantial standalone programs. The 8085, as explained in that project, is basically a 8080 with easier electrical interfacing, and a couple of extra instructions, RIM and SIM. There are also some undocumented instructions, and they may be added to the assembler table but use by the compiler should be optional, for when you do have a 8085.
Casting around for existing free compilers led to a few candiates. For CP/M or DOS there are Dunfield C, and also Hitech C. But these require old development environments (though one could use a virtual machine) and also only support old C standards. There may be other deficiencies due to the limitations of the hosting environment. As they are proprietary, they cannot be developed further.
The Amsterdam Compiler Kit (ACK) is currently being maintained by David Given and does work. The software is rather awkward to install as it has many components. The build process is terrible though getting better through developer efforts. Also it accepts an older standard for C, though there are efforts to bring that up to date. It is used by the 8080/8085 ports of FUZIX by Alan Cox. One advantage of ACK is fhat it also supports a couple of other languages like Pascal, if that is desired.
SDCC is the most modern of the candidates. It supports recent standards for C and is actively maintained. In fact it was a post by Alan Cox (I'm guessing also the lead of FUZIX) in the SDCC mailing list that got me thinking about hacking SDCC to generate 8080 code. If I could pull this off I could develop on Linux.
I tossed all of this in my mind in 2018. All these factors came to my mind:
- Was I sane to do this? The Z80 code generator module gen.c is about 13,000 lines of code. Although I wouldn't have to rewrite all of it from scratch. In fact since the 8080 has some similarities to the Gameboy Z80, I could get a free ride on some of that code.
- Will it be of any use? Very few people have only the 8080 or 8085 these days. If they develop for retro CPUs it's more likely to be the Z80 or its faster and more capable descendants for which SDCC works fine. Few people care about the 8080 anymore. In the worst case, just me.
- What are the steps I should take?
As it turned out, I did some steps fairly quickly and had long hiatuses for others. It's not usable yet and there is a possibility it might never be. I agonised if I should post this as a project. In the end I've decided to present it as is. It:
- Will probably remain an ongoing project forever even if I get it to work acceptably as some bugs may take a long time to surface or nobody will use it enough to tickle the bug
- Will not be easy to install as you have to build from a git clone
- May never be accepted in the mainstream SDCC as I may have done too much violence to the Z80 code generator module (but it might be acceptable if separated into another module, if anybody cares)
- May not be of use to anybody, including myself
- May be instructive for anybody wanting to augment the work or do something similar with another Instruction Set Architecture
Now that I have accepted the software condition (an analogue of the human condition) I shall present a series of logs. This is not happening in real-time. Some steps were completed months ago, and some are still in progress. I will also update the status in this description according to progress.
Thanks for the effort. I have been looking for a compiler to build software for the Tandy Model 100/NEC8201 series computers.