1. 13
  1. 5

    I remember using this in 2003 to write a poor ZX Spectrum game. This felt super convenient and high-level compared to builtin Basic on ZX Spectrum (I didn’t try to write something non-trivial in assembly at the time). It has nice libraries, for example for sprites.

    But AFAIK, using C for ZX Spectrum and similar old computers is still rare. I heard that machine code generated with z88dk or sdcc is still very inefficient, and that these compilers tend to use IX and IY registers heavily, and instructions for them are slow. I didn’t check for myself but maybe it’s still possible to write code differently: less structs, mostly 8 bit arithmetic, global vars for most state, taking inspiration from assembly code practices for such systems.

    1. 3

      Many years ago I tried to write a gameboy color game with sdcc, 8 bit arithmetic is indeed a challenge (the conclusion I came to was just use assembler). I couldn’t tell from a cursory glance if this project is related to sdcc, it does mention ‘small c compiler’.

      1. 2

        I don’t think Z88DK is related to SDCC, but I might be wrong.

        I’d totally recommend checking out SDCC as well, which has Z80 and Z180 support as well as many other platforms, which is usually the compiler I use (but not on Z80).. I don’t have a lot of Z88DK nor Z80 experience. I’m sure each system has it’s advantages.

        If you want to see some really inefficient code (while not Z80), take a look at the output of cc65, a C compiler for 6502 systems. I can’t fault it though, it’s amazing they were able to such a nice C implementation on that CPU at all. Check out their coding hints for an idea of how to get somewhat more efficient code.

        I’m sure with better knowledge of the Z80 and the compiler and using similar techniques you can get somewhat decent code to be generated.

      2. 2

        I’m looking forward to trying the PC-8801 port of this. It’s awesome that there is such a dedicated community on this project.