VICE - 32K Cartridge Possible?

You need an actual VIC.

Moderator: Moderators

Post Reply
User avatar
Radical Brad
Vic 20 Devotee
Posts: 256
Joined: Sat Jun 24, 2017 8:18 pm
Website: http://www.AtomicZombie.com
Location: Kakabeka Falls, ONT
Occupation: hACKER

VICE - 32K Cartridge Possible?

Post by Radical Brad »

Greets fellow VIC freaks!

I am working on a project that requires a bit of testing in VICE (often away from my real VIC these days).

What I have in real hardware is a VIC 32 Expansion RAM with the Cartridge Auto-start Signature in Block 5.
I have Blocks 1,2,3, and 5 populated for a total of 32K.
This works perfectly on my real VIC, allowing my code to boot and run directly (no Basic start).

My code starts up at 40960 (block5), then jumps to 8192 (block1) to continue execution.
It is really just a 32K ROM cartridge.

I have tried all the cartridge load options of VICE and have not been able to get the same results.

Using my assembler, I create a binary image starting at $2000 (8192), and extending to $BFFF (49151).
I then try to load that as a cartridge image, but VICE fails to restart and read the Auto-start signature.
By poking around, I can verify that all of my code is in the correct place.

I even tried with Vice set to have RAM in blocks 1,2,3,5 although that would no really make sense.
Also tried all of the other possible cart images, and "add to generic carts".

Seems the only way I can get an auto-start cart to work is to save a single 8k image in block5.

Any ideas from the Emulation Nation?
Cheers,
Brad
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: VICE - 32K Cartridge Possible?

Post by Mike »

Radical Brad wrote:Using my assembler, I create a binary image starting at $2000 (8192), and extending to $BFFF (49151) [...]
Do you think having a memory dump write all over the video and I/O chips in $9000..$9FFF is such a good idea after all?

This is not a problem anyhow specific to emulation; load the dump into RAM in two parts, $2000..$7FFF and $A000..$BFFF, and it will work in both VICE and real h/w after performing a reset. If you have these two *.prg files, with load addresses $2000 and $A000 prepended, a boot loader is done as easy as this:

Code: Select all

1 DN=PEEK(186)
2 SYS57809"BLK123.PRG",DN,1:POKE780,0:SYS65493
3 SYS57809"BLK5.PRG",DN,1:POKE780,0:SYS65493
4 SYS64802
If you insist on the "cartridge in VICE" method, you'd first attach 3 *.prg files with load addresses $2000, $4000 and $6000 (all of them 8192+2 bytes in total) [1] with "Attach cartridge image ... > Generic images ..." (first file) and "Attach cartridge image ... > Add to generic cartridge ..." (subsequent files), and finally also add the $A000 section, so the cartridge autostart will find the complete data in memory when it starts up.



[1] VICE also allows to attach 16K cartridge images, so you could also attach a 16K file at $2000 together with an 8K file at $6000, alternatively an 8K file at $2000 together with a 16K file at $4000, for the lower 24K ROM. Take your pick.
User avatar
Radical Brad
Vic 20 Devotee
Posts: 256
Joined: Sat Jun 24, 2017 8:18 pm
Website: http://www.AtomicZombie.com
Location: Kakabeka Falls, ONT
Occupation: hACKER

Re: VICE - 32K Cartridge Possible?

Post by Radical Brad »

Thanks Mike.
Many good ideas and options as always!

I am working on a new type of "Video Mode", so the quickest way to go from compile to execute is needed.
Multiple images seems like a good choice, as I can just change one block, then reset VICE.

I am all charged up after spending 1 day reading the thread "New Frontiers".
For anyone considering VIC graphics, it should be required reading before disturbing a single pixel!
I am soon going to disturb a great many pixels!
Thanks for your efforts and advice.

Brad
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: VICE - 32K Cartridge Possible?

Post by Mike »

If all what the $A000 part of the cartridge image does is the autostart, you might quite as well consider using a single *.prg file starting at $1201 with a BASIC stub (like: 2018 SYS 4622) which gives you near 27K to play with - and what probably most other coders here use as well.

When you drag such a *.prg file into the main window of VICE, VICE will load it *) and then perform a RUN command. Can't be much slower than the attempt to simulate a cartridge - just the inclusion of further data in BLK5 will require yet another load operation, but that could be done from within your main program with a few lines of code.


*) in the Autostart settings, set "PRG autostart mode" to Virtual FS and tick off "Handle true drive emulation", so VICE can use the surrounding PC directory in VDrive. This is much faster than using disk images with true drive emulation.
User avatar
Radical Brad
Vic 20 Devotee
Posts: 256
Joined: Sat Jun 24, 2017 8:18 pm
Website: http://www.AtomicZombie.com
Location: Kakabeka Falls, ONT
Occupation: hACKER

Re: VICE - 32K Cartridge Possible?

Post by Radical Brad »

I managed to get something to work by using my standard auto-boot BLK5 image, and then using "Add to Generic Cartridge" in VICE to include my mostly fixed code in BLK1,2,3.

I am at the point now where I really need to continue on my real VIC.
Since I will be getting into some line-synce external RAM paging, VICE is not going to help me.

Thanks, I learned a few new things about using VICE here.
Brad
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: VICE - 32K Cartridge Possible?

Post by Mike »

Radical Brad wrote:Since I will be getting into some line-synce external RAM paging, VICE is not going to help me.
That's likely a matter of how much of the external h/w is written in stone, and how much of this can be abstracted into register read/writes, especially when cycle-exact timing is important. Otherwise one quickly runs into a shifting sands scenario.

I managed to implement the display routine for my VFLI mod *before* the hardware itself had been put to service, by judicious use of Excel and VICE.

It worked correctly on the first time. Yes, you read that right. No need for multiple debugging iterations between VICE and VIC-20.

8)
User avatar
Radical Brad
Vic 20 Devotee
Posts: 256
Joined: Sat Jun 24, 2017 8:18 pm
Website: http://www.AtomicZombie.com
Location: Kakabeka Falls, ONT
Occupation: hACKER

Re: VICE - 32K Cartridge Possible?

Post by Radical Brad »

VICE is certainly great when you are away from your VIC, and just want to bang out some ideas.
There are some limitations for us NTSC users though, mainly Interlace Mode.
I did find this one though, and it allowed some testing of Raster / Interlace code...

http://emutopia.com/index.php/emulators ... /1653-z64k

I figured I could take some of what I did here (512 byte AVR doing 204x240 VGA)...

https://hackaday.com/2018/03/08/racing- ... an-attiny/

and translate that to the VIC by cramming bytes just behind the beam.
During my research, I read through "New Frontiers" and seen that Tokra indeed make that work!

So I have been playing around with something like this, but taking it in a different direction.

The Z64 emulator has helped in testing code, but I am now ready to move back to the real hardware.
I will open a new thread when I have some proof of concept to show off.
Might be a while... my time is really scarce again.

Thanks,
Brad
Post Reply