Page 1 of 1

Status Emulator and Crt-Files

Posted: Sun Jul 14, 2024 5:20 pm
by SunSailor
Hi,
I'm fiddling around with building a toolchain to create crts with CC65. I got quite far, where I'm now able to create a bin file with a simple program (Changes system font, sets screen mode and ouputs some text) to be embedded in a cart file. From here, I ran into troubles, as the produced cart file didn't do anything for the emulator.
- Can anybody confirm, that the current emulator (R47) already supports auto starting cart files?
- By examining the crt file produced by makecart, I found that the payload for bank 32 starts at byte 480 instead of 512, like the documentation says. Which of both are correct?
- Can anybody confirm, that at $c000, where the "CX16" magic bytes are expected, are represented by $c3 $d8 $31 $36 or is the wrong charmap used here anyway?

Help would be greatly appreaciated, thank you advance!

Edit: Did some peek into the cart tool, and as it uses the same types as the emulator to save and load, the error is not to be found there, it is the documentation, which is false here. The field for the program version is 32 bytes, but the location is given as 128-191. As 128+32 is 160 instead, the issue starts here. Fields add up to 480 until the payload, not 512, which is exactly, what my hex editor shows in the actual file.

Edit2: Ok, figured it out myself by cramping into the ROM file, then correct magic number is $43, $58, $31, $36. At least now the emulator does something. Hope these findings can help somebody else and maybe someone could update the makecart docs. Or tell me how to do it, always happy to contribute :-)

Edit3: Just successfully started CC65 code from a cart file, great success! :D

Re: Status Emulator and Crt-Files

Posted: Tue Jul 23, 2024 11:14 pm
by fraggintarget
I have been looking for a tutorial to do this exact thing, any chance you could put a tutorial together for the community?

Re: Status Emulator and Crt-Files

Posted: Sat Jul 27, 2024 4:42 pm
by SunSailor
Currently definitely not, because of lack of time. I even had to put this project aside for a while now, but I can compile some information, when I'm done getting the CC65 code running in rom and system ram as well. But it really isn't very hard, if you go for assembler code only. Create a bin file, which has those four magic bytes upfront and have your code ready to run from $c004 then. Keep in mind, that you have to copy some code into the fixed ram, if you want to switch away from bank 32 then.
That's exactly what I'm currently working on, getting the CC65 runtime to work for cart space and fixed RAM.
But if you have specific questions, please feel free to ask, time to answer I definitely will find ;-)