millfork

Millfork: a middle-level programming language targeting 6502- and Z80-based microcomputers and home consoles

This project is maintained by KarolS

< back to index

ROM vs RAM targets

By default, Millfork assumes that the target platform loads the program into RAM. Code, read-only data and preinitialized writable data are all mixed together. The program after loading can modify its contents, including preinitialized variables, almost immediately and without any extra preparation.

When compiling for a cartridge based target, the preinitialized data cannot be writable, as they are not loaded into RAM, but stored in ROM. To make working with preinitialized data easier, Millfork can create a copy of preinitialized writable date in ROM, which can then be loaded into RAM when the program starts.

The steps are as follows:

If the default implementation of init_rw_memory is unsatisfactory for your needs, consider implementing your own and putting it in the init_rw_memory module in the same directory as your main source file, to override the standard one.

Using the ram_init_segment option adds the following restrictions: