cartconv

You need an actual VIC.

Moderator: Moderators

Post Reply
User avatar
chysn
Vic 20 Scientist
Posts: 1205
Joined: Tue Oct 22, 2019 12:36 pm
Website: http://www.beigemaze.com
Location: Michigan, USA
Occupation: Software Dev Manager

cartconv

Post 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.
VIC-20 Projects: wAx Assembler, TRBo: Turtle RescueBot, Helix Colony, Sub Med, Trolley Problem, Dungeon of Dance, ZEPTOPOLIS, MIDI KERNAL, The Archivist, Ed for Prophet-5

WIP: MIDIcast BASIC extension

he/him/his
User avatar
AndyH
Vic 20 Afficionado
Posts: 364
Joined: Thu Jun 17, 2004 5:51 am
Website: https://www.hewco.uk
Location: UK
Occupation: Developer

Re: cartconv

Post by AndyH »

What does this utility actually do (or meant to)? Relocate code to a new address and add a $a000 autostart header?
--
AndyH
HEWCO | Vic 20 blog
User avatar
beamrider
Vic 20 Scientist
Posts: 1452
Joined: Sun Oct 17, 2010 2:28 pm
Location: UK

Re: cartconv

Post by beamrider »

I don't think it will relocate, that's a job requiring hand-crafting.
User avatar
chysn
Vic 20 Scientist
Posts: 1205
Joined: Tue Oct 22, 2019 12:36 pm
Website: http://www.beigemaze.com
Location: Michigan, USA
Occupation: Software Dev Manager

Re: cartconv

Post 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".
groepaz
Vic 20 Scientist
Posts: 1187
Joined: Wed Aug 25, 2010 5:30 pm

Re: cartconv

Post 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 :)
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
User avatar
chysn
Vic 20 Scientist
Posts: 1205
Joined: Tue Oct 22, 2019 12:36 pm
Website: http://www.beigemaze.com
Location: Michigan, USA
Occupation: Software Dev Manager

Re: cartconv

Post 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
User avatar
chysn
Vic 20 Scientist
Posts: 1205
Joined: Tue Oct 22, 2019 12:36 pm
Website: http://www.beigemaze.com
Location: Michigan, USA
Occupation: Software Dev Manager

Re: cartconv

Post 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!
groepaz
Vic 20 Scientist
Posts: 1187
Joined: Wed Aug 25, 2010 5:30 pm

Re: cartconv

Post 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
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
User avatar
chysn
Vic 20 Scientist
Posts: 1205
Joined: Tue Oct 22, 2019 12:36 pm
Website: http://www.beigemaze.com
Location: Michigan, USA
Occupation: Software Dev Manager

Re: cartconv

Post 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
groepaz
Vic 20 Scientist
Posts: 1187
Joined: Wed Aug 25, 2010 5:30 pm

Re: cartconv

Post by groepaz »

Thanks, added to my testfiles :)
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
User avatar
chysn
Vic 20 Scientist
Posts: 1205
Joined: Tue Oct 22, 2019 12:36 pm
Website: http://www.beigemaze.com
Location: Michigan, USA
Occupation: Software Dev Manager

Re: cartconv

Post by chysn »

groepaz wrote: Wed Mar 09, 2022 4:20 pm Thanks, added to my testfiles :)
Thanks for your help!
Post Reply