Page 1 of 1
cartconv
Posted: Fri Feb 25, 2022 4:22 pm
by chysn
This invocation claims that the conversion is successful:
Code: Select all
/Applications/vice-x86-64-gtk3-3.6.2-dev-r41706/bin/cartconv -t vic20 -i file.prg -o file.crt -p
But when I "attach cartridge image..." in VICE, the memory at $A000 isn't changed at all. I've tried it with Block 5 RAM on and Block 5 RAM off. What's the correct way to convert a PRG file into a CRT file, and then use the CRT file in VICE?
Update: I set the "CRT" checkbox at the bottom of the window and it didn't do anything but bring up a bunch of settings.
Update: Oh! "Cathode Ray Tube!" Never mind. But I still have the CaRTridge problem.
Re: cartconv
Posted: Wed Mar 09, 2022 4:47 am
by AndyH
What does this utility actually do (or meant to)? Relocate code to a new address and add a $a000 autostart header?
Re: cartconv
Posted: Wed Mar 09, 2022 6:34 am
by beamrider
I don't think it will relocate, that's a job requiring hand-crafting.
Re: cartconv
Posted: Wed Mar 09, 2022 8:50 am
by chysn
AndyH wrote: ↑Wed Mar 09, 2022 4:47 am
What does this utility actually do (or meant to)? Relocate code to a new address and add a $a000 autostart header?
People have asked for a CRT image of wAx, which is 8K in block 5 with no autostart. So I'm trying to construct pretty much exactly what's in block 5, but as a CRT file instead of a PRG file. Nothing needs to be added nor relocated.
In other words, I
think I'm struggling with the simplest-possible cartconv use case. As far as I can tell, that cartconv command should take the PRG file at block 5 and turn it into a CRT for block 5. -t means the cartridge type (vic20), and -p means "pad the code to 8192 bytes".
Re: cartconv
Posted: Wed Mar 09, 2022 10:21 am
by groepaz
OK! You must be the first user besides me :=)
first, after you converted, you can use the -f option to see what the .crt actually contains, like
Code: Select all
$ cartconv -f 0-generic-6000-a000-JungleHunt.crt
CRT Version: 2.0 (VIC20 CARTRIDGE)
Name: Jungle Hunt
Hardware ID: 0 (Generic VIC20 Cartridge)
Hardware Revision: 0
offset sig type bank start size chunklen
$000040 CHIP ROM #000 $6000 $2000 $2010
$002050 CHIP ROM #000 $a000 $2000 $2010
total banks: 2 size: $004000
i suspect it used a different start address (i dont remember what it uses by default if no address is given).
Now when the address is wrong there are two things you can do: a) use .prg files with load address in the first two bytes. I find that the easiest myself. or b) use the -l option to set the address.
If the address is actually correct and the file contains what it should contain (you may also look at it with a hexeditor, or convert the crt back to prg and then compare) then something in the vic20 cartridge mounting code is wrong.
It would also be cool if you could attach that binary - apparently in my testcases directory i dont have any cartridge that lives at A000 (only) at all - there is a chance i screwed something up somewhere and didnt notice

Re: cartconv
Posted: Wed Mar 09, 2022 12:10 pm
by chysn
Thanks! The first two bytes of the PRG file are 00,a0, but I get this:
Code: Select all
CRT Version: 2.0 (VIC20 CARTRIDGE)
Name: Generic VIC20 Cartridge
Hardware ID: 0 (Generic VIC20 Cartridge)
Hardware Revision: 0
offset sig type bank start size chunklen
$000040 CHIP ROM #000 $0000 $2000 $2010
total banks: 1 size: $002000
When I do this command:
Code: Select all
/Applications/vice-x86-64-gtk3-3.6.2-dev-r41706/bin/cartconv -t vic20 -i wax2.prg -o wax2.crt -p -l a000
The output of -f is exactly the same... So I don't seem to be able to set the start address properly...
Binary:
https://github.com/Chysn/VIC20-wAx2/blo ... c/wax2.eep
Re: cartconv
Posted: Wed Mar 09, 2022 12:41 pm
by chysn
Okay, got it!
(1) It doesn't work with PRG files. The two-byte address header was actually being used in the CRT code. Instead of using the PRG file, I used the binary EEPROM file.
(2) -l needs a base-10 address (40960) rather than a hex address (a000)
With those changes, I got a functioning CRT file.
Thanks!
Re: cartconv
Posted: Wed Mar 09, 2022 12:54 pm
by groepaz
> It doesn't work with PRG files.
it does - i think the trap you were falling into was that your prg file wasnt 0x2000+2 bytes - if you use the padding option, cartconv cant determine if this is prg file. i should perhaps emit a warning in this case
> -l needs a base-10 address (40960) rather than a hex address (a000)
try 0xa000 - that should work
When you are done, could you post the file? I'd still add it to my testcases
Re: cartconv
Posted: Wed Mar 09, 2022 1:02 pm
by chysn
groepaz wrote: ↑Wed Mar 09, 2022 12:54 pm
> It doesn't work with PRG files.
it does - i think the trap you were falling into was that your prg file wasnt 0x2000+2 bytes - if you use the padding option, cartconv cant determine if this is prg file. i should perhaps emit a warning in this case
Oh! Okay. I'd prefer to build CRT images from binary files, anyway, and be explicit with the starting address. It seems much cleaner that way. I think PRG should be a cul-de-sac.
When you are done, could you post the file? I'd still add it to my testcases
Which file, the CRT image? That's here in the repo now, along with the other build products:
https://github.com/Chysn/VIC20-wAx2/tree/main/vic
Re: cartconv
Posted: Wed Mar 09, 2022 4:20 pm
by groepaz
Thanks, added to my testfiles

Re: cartconv
Posted: Thu Mar 10, 2022 6:22 am
by chysn
groepaz wrote: ↑Wed Mar 09, 2022 4:20 pm
Thanks, added to my testfiles
Thanks for your help!