Binary -> CRT format

You need an actual VIC.

Moderator: Moderators

Post Reply
Linzino
Vic 20 Dabbler
Posts: 83
Joined: Fri Nov 06, 2015 4:13 pm
Website: http://retrocomputingarchive.blogspot.fr/
Location: France

Binary -> CRT format

Post by Linzino »

Hi

I would like to create cartridge images that can be loaded by Vice from a binary or prg created by CC65.
I know that there is no real standard crt format for the Vic20. I only need something that can be loaded by Vice.
Secondarily I would like to create something that could be burnt into an eprom to make a physical cartridge.
In particular I would like to know how to create 8k and 16k cartridge images. I am coding in C with CC65.

Vice has the cartconv, which is supposed to work only on C64 binaries.
I guess something similar could be made for the Vic 20 (and the C16).
What is the header used in cartridge images for the Vic 20? Are they just raw binaries starting at $A000 with no header at all?
groepaz
Vic 20 Scientist
Posts: 1188
Joined: Wed Aug 25, 2010 5:30 pm

Re: Binary -> CRT format

Post by groepaz »

there is no format comparable with .crt for the vic20 (yet) - you'll have to use plain .bin files (raw binaries with no headers)

as for making a vic20 cartridge from your code, you generally have two options: either reconfigure the cc65 linker to produce an actual cartridge image (designed to run from a cartridge rom), or you make a small startup routine which just copies your .prg file to ram and then jumps to it.

(cartconv does really only add the .crt header to raw binary files, btw - you cant use it to create cartridges from runable .prg files)
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
Linzino
Vic 20 Dabbler
Posts: 83
Joined: Fri Nov 06, 2015 4:13 pm
Website: http://retrocomputingarchive.blogspot.fr/
Location: France

Re: Binary -> CRT format

Post by Linzino »

Thanks groepax!
I am not sure I understand "reconfigure the cc65 linker to produce an actual cartridge image".
Telling the linker to create an 8k code block at $A000?
I don't even know the details on how to do this but knowing what to do would be a good starting point.

Is an 8k image (to be run from (e)rom) just a raw binary located at $A000?
What is a 16 image? Just two 8k blocks where one is at $A000 and the other elsewhere? Where?

Your second solution is not viable for 8k and 16k cartridges, I guess, unless the Vic 20 has some sort of internal memory expansion or a multiple cartridge slot.
groepaz
Vic 20 Scientist
Posts: 1188
Joined: Wed Aug 25, 2010 5:30 pm

Re: Binary -> CRT format

Post by groepaz »

unfortunately noone created a proper linker configuration for cartridges yet... so what you need to is basically:

- find out what the "header" for a vic20 cartridge is. this should be fairly easy (on the C64 there are two vectors, followed by "CBM80" - iirc this is very similar on vic20)
- create a linker config that will put the header first, followed by the code/data
- probably create extra startup code that initializes the vic20, then copies the DATA section to RAM, and then starts the program. - that means a modified crt0

that said, i think someone asked this before here, and perhaps even found a solution

i would try to make it work with a simple assembler program first, perhaps even not using cc65 but a simple assembler like acme - once you got that working you will know where to put what at least, and it will be much easier to debug what goes wrong with cc65 config ;)
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
Post Reply