Unfortunately, there's a few gotchas
- DATA segment has been hard coded to 0x8000
- --data-loc switch only changes zero page (ZP)
- crt0.s has GSINIT before CODE section
- Changing vectors from 0xfffa, to say 0xbffa causes the binary to be the wrong size (short 8-16 bytes)!
- The release binaries for linux need an old verion of GLIBC - so rebuilding is usually the only option
Code: Select all
--- sdcc-4.2.0/src/mos6502/main.c 2022-02-24 20:52:17.000000000 +0000
+++ sdcc-4.2.0-patched/src/mos6502/main.c 2022-03-26 14:44:16.222182250 +0000
@@ -181,7 +181,11 @@
{
options.code_loc = 0x200;
options.data_loc = 0x20; /* zero page */
+#if 0
options.xdata_loc = 0x8000; /* 0 means immediately following data */
+#else
+ options.xdata_loc = 0x204; /* Vtech creatiVision data */
+#endif
options.stack_loc = 0x1ff;
options.omitFramePtr = 1; /* no frame pointer (we use SP */
Then the usual ./configure;make;make install.
For Windows x64, you can patch the sdcc.exe binary at these offsets
Code: Select all
003058DD: 00 04
003058DE: 80 02
Code: Select all
00329B95: 00 04
00329B96: 80 02
There's also the source to genrom.c which will convert the output .rom to a CV compatible .bin, which you need to compile on your platform.
Simple gcc -O2 genrom.c -o genrom
That's my Sunday done