Recent

Author Topic: Z80 ZX Spectrum and System.pp  (Read 353 times)

Cascade

  • Jr. Member
  • **
  • Posts: 73
Z80 ZX Spectrum and System.pp
« on: February 10, 2026, 03:30:13 pm »
I've been having fun playing with FPC cross-compiling to a Z80 target (specifically the ZX Spectrum).  It's working, and some test programs are loading fine.

The major problem encountered so far is an empty program compiles to around 32KB, even with optimisations and smart-linking enabled.  The target machine only has 48KB of RAM in total, and over 6KB of that is reserved for the screen.  Basically there's - almost - no room left for my program.

Is there a way to trim some features away from the target's system.pp ?  Perhaps some {$defines} to exclude features.  I don't need floating point math or heap memory management.  Exception handling might not be necessary either.  A stack is required, and records would be nice.  But otherwise a fairly bare-bones setup would be fine, as I'll be writing procedures and functions containing assembly language, and calling the built in ROM.  I'm really using Pascal for structure and encapsulation only.

I've spent a few weeks on and off hacking away at system.pp both starting from scratch (via the Wiki) and adding things FPC needs, and also taking the existing ZX Spectrum system.pp and removing things a bit at a time - but unfortunately neither approach has yet yielded a stripped down system.ppu that will compile a simple program.

Maybe I'm going about this wrong.  Does anyone have any tips for using FPC to target the ZX Spectrum in a practical 'bare-bones' way?

 

TinyPortal © 2005-2018