Open AugustoRuiz opened 6 years ago
Good idea! That 16k ROM competition in 2013 was a great idea! I regret my work did not let me enough time to make a prod at the time. But I started cpc-dev-tool-chain so it gave a good impulse.
IIRC this is a natural job for a crt0.s file.
There is a downside here: many routines in cpctelera are optimized assuming code runs in RAM and can self-modify. Just deploying such code to a ROM obviously won't work, and need:
The special handling can be of two kinds:
So, not obvious because different projects may need different cases.
In all cases you have to take care of address range where ROM appears. If you never read video RAM then code in ROM at C000 is fine, etc.
Incidentally, I've been thinking to do a ROM-targetting crt0.s in cpc-dev-tool-chain for a while. There, no assumption of code in RAM, things would run pretty smoothly by default.
@cpcitor Yes, @AugustoRuiz and I agree with your analysis. We have been discussing it for a while. Just some things to take into account:
As a first step, giving users the possibility to create ROMs seems not difficult. As you say, something like a crt0.s with ROM header code would be enough for enabling this ability. After that, many other improvements can be worked out as per request basis.
Working example for lower-ROM (the simplest one, except for the hardware initialization required). sf2rom.zip
It would be nice to be able to specify at project creation that the output of the build is a ROM.
The ROM should be linked at 0xC000, and must have a header with the following data:
See:
CPCWiki forum thread