How to run cartridge dumps in PRG format

Discuss anything related to the VIC
User avatar
RobertK
Vic 20 Drifter
Posts: 22
Joined: Wed Oct 27, 2004 2:39 pm

How to run cartridge dumps in PRG format

Post by RobertK »

Hi folks,

having read the recent discussion on the Atarisoft titles, I checked out the PRG format cartridge dumps at ftp.zimmers.net and decided to open this new topic...

Now how do I get these games running on a real VIC?

I assume that I simply have to LOAD these files, and they automatically get loaded to the correct memory address. But how do I start the game? I assume by typing SYS...?

And how much memory do I need to run 8K or 16K games? I only have a non-switchable 16K expansion, i.e. only have the choice between an unxepanded system and a 16K extension - is this a problem?

Maybe you could explain to me step by step how to run a specific game from ftp.zimmers.net, let's say Choplifter (8k) and Pole Position (16k, two parts). If only I could see these running on my VIC...


Regards,

Robert
Boray
Musical Smurf
Posts: 4064
Joined: Mon May 03, 2004 10:47 am

Re: How to run cartridge dumps in PRG format

Post by Boray »

RobertK wrote: And how much memory do I need to run 8K or 16K games? I only have a non-switchable 16K expansion, i.e. only have the choice between an unxepanded system and a 16K extension - is this a problem?
t
Yes, it's a problem. 16K is all you need to play a copied 16k cart, but by default, the memory cart is mapped to block 1 and 2 while (almost) all 8k games needs memory in block 5 instead. 16K games needs memory in block 5 and in either 3 or 2. So you need to make your cartridge switchable or to permanently set it to for example block 1 and 5. That is quite easy. That way you will get 11K of basic memory plus 8K in block 5 for running cartridge images.

To load a game, just load it ,8,1 and then start it with SYS64802

For a 16K image you need to load both files before the reset sys...

Also read: http://sleepingelephant.com/ipw-web/bul ... .php?t=194

/Anders
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

I've always wondered how much work it takes to rewrite a cartridge game to run elsewhere. All the absolute references should be fairly easy to fix, but more tricky code getting high and low bytes from a table etc may be a tricky thing to solve. Some day I'll get some 8K image, preferrably one that doesn't use a lot of RAM, and see if I have the skills to turn into to a loadable program.
Anders Carlsson

Image Image Image Image Image
User avatar
RobertK
Vic 20 Drifter
Posts: 22
Joined: Wed Oct 27, 2004 2:39 pm

Re: How to run cartridge dumps in PRG format

Post by RobertK »

Ok, thanks! Now I begin to understand how it all works :)

I've now tried this in theory with VICE, and most of the games work beautifully. BTW, it took me some time to find out that for 16K carts you have to type NEW before loading the second part, because otherwise you get an "Out of memory" error message...

Donkey Kong works perfectly, but Pole Position doesn't :( I only get a blue screen with a pulsating green rectangle on the right. Or can any of you get this game running?

BTW, I just found out that there is some information on this topic in the file bits.txt from Ward Shrakes VIC-tech.zip archive.

For all other newcomers to this topic, here's a list of start addresses for each memory bank, so that you know which ones you have to activate:

Bank 1: $2000
Bank 2: $4000
Bank 3: $6000
Bank 5: $A000


Regards,

Robert
vic user
VicGyver
Posts: 1401
Joined: Thu Mar 25, 2004 9:40 am

Post by vic user »

Donkey Kong works perfectly, but Pole Position doesn't I only get a blue screen with a pulsating green rectangle on the right. Or can any of you get this game running?
i hope you get pole position running.

i have played the ROM images on a real vic, and no worries, and i just tried it out on vice, and i got it to work as well.

through vice, i went to the 'file' heading and attached the two cartridge images in their respective areas ($6000 and $A000) and then did a reset, and it worked fine

good luck!

chris
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

Pole Position is tricky to get to start - you need to disable IRQ. In VICE, you can use Alt+R to simulate a soft reset button. On a real VIC, try:

POKE 37166,PEEK(37166) AND 127:SYS 64802

The first POKE seems to disable IRQ and the SYS performs a soft reset.

Btw, simulating RAM expansion and load the files one by one is the "correct" way to do it if you want to practise how to play on a real VIC. Of course, if you burn your own EPROMs, the attach image method will correspond more closely. :wink:
Anders Carlsson

Image Image Image Image Image
User avatar
RobertK
Vic 20 Drifter
Posts: 22
Joined: Wed Oct 27, 2004 2:39 pm

Post by RobertK »

carlsson wrote:Pole Position is tricky to get to start - you need to disable IRQ. In VICE, you can use Alt+R to simulate a soft reset button.

On a real VIC, try:
POKE 37166,PEEK(37166) AND 127:SYS 64802
I've just tried this in VICE - and it works! :)

Thank you all. Now I'll take a screwdriver, and let's see what the inside of my 16K RAM cart looks like :wink:
tlr
Vic 20 Nerd
Posts: 594
Joined: Mon Oct 04, 2004 10:53 am

Post by tlr »

carlsson wrote:I've always wondered how much work it takes to rewrite a cartridge game to run elsewhere. All the absolute references should be fairly easy to fix, but more tricky code getting high and low bytes from a table etc may be a tricky thing to solve. Some day I'll get some 8K image, preferrably one that doesn't use a lot of RAM, and see if I have the skills to turn into to a loadable program.
If you want to do it VIC-style, you should know that HES-Mon has a command (N = New Locate) that does this kind of stuff. It parses machine code in a selected address range and adds an offset to relevant absolute accesses. I used to do this a lot on the c64 to relocate ripped music players to somewhere that fitted my demo better. :) But ofcourse 8Kb is slightly bigger than any music player I've relocated so far, not much though...
6502dude
megacart
Posts: 1581
Joined: Wed Dec 01, 2004 9:53 am

Post by 6502dude »

Rather than relocate code to run in RAM, I burn ROM image to eprom, insert in socket in old cartridge housing, and test game / application on real Vic-20 hardware.
User avatar
RobertK
Vic 20 Drifter
Posts: 22
Joined: Wed Oct 27, 2004 2:39 pm

Re: How to run cartridge dumps in PRG format

Post by RobertK »

Boray wrote:To load a game, just load it ,8,1 and then start it with SYS64802
For a 16K image you need to load both files before the reset sys...
One final qustion: how do I make a loader program for multipart games?

For 8k carts, it looks like this:

Code: Select all

0 IFA=1THENSYS64802
10 A=1:LOAD"CONGOB",8,1
But how do I make this for 16K carts? The problem is that I somehow have to make NEW before loading the second part, but I can't do that in the middle of the loader program. Any ideas?

Regards,

Robert
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

What really happens when you load a file ,8,1 into the upper memory is that the pointers to start of variable space move to the last address of the loaded segment, i.e. Basic pointers 45/46, 47/48 and 49/50.

Apart from the fact I have not tested this program, something like this may work, possibly with some modifications:

1 ON A GOTO 10,20,30
10 A=1:FOR I=0 TO 5:POKE 7680+I,PEEK(45+I):NEXT
15 LOAD"PARTA",8,1
20 A=2:FOR I=0 TO 5:POKE 45+I,PEEK(7680+I):NEXT
25 LOAD"PARTB",8,1
30 SYS 64802

Line 10 will copy the current pointers to the top of the screen memory, and line 20 will copy the pointers back. Maybe it would work to store it into variables too, but better not tempt luck..
Anders Carlsson

Image Image Image Image Image
User avatar
RobertK
Vic 20 Drifter
Posts: 22
Joined: Wed Oct 27, 2004 2:39 pm

Post by RobertK »

carlsson wrote:Apart from the fact I have not tested this program, something like this may work, possibly with some modifications:
Almost! The first line should be "...GOTO 20,30", but then it works!

Here's the loader for Donkey Kong:

Code: Select all

1 ONAGOTO20,30
10 A=1:FORI=0TO5:POKE7680+I,PEEK(45+I):NEXT
15 LOAD"DONK2000",8,1
20 A=2:FORI=0TO5:POKE45+I,PEEK(7680+I):NEXT
25 LOAD"DONKA000",8,1
30 SYS64802 
And for Pole Position, we can disable IRQ in line 30:

Code: Select all

1 ONAGOTO20,30
10 A=1:FORI=0TO5:POKE7680+I,PEEK(45+I):NEXT
15 LOAD"POLE6000",8,1
20 A=2:FORI=0TO5:POKE45+I,PEEK(7680+I):NEXT
25 LOAD"POLEA000",8,1
30 POKE37166,PEEK(37166)AND127:SYS64802 
Thanks again!

Robert
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

Ayep, I forgot that A=0 to start with, and that ON..GOTO will not have a case for zero. Good that you found a way to make it work. Theoretically, one could disassemble the routine for NEW and maybe find an entry point somewhere in the middle of Basic ROM to SYS into, but the manual resetting of pointers works fine.
Anders Carlsson

Image Image Image Image Image
tlr
Vic 20 Nerd
Posts: 594
Joined: Mon Oct 04, 2004 10:53 am

Post by tlr »

Code: Select all

POKE37166,PEEK(37166)AND127 
is probably better written as:

Code: Select all

POKE37166,127 
37166 is the Interrupt enable register of VIA2.
MSB (bit 7) selects if bits shall be cleared or set.
bits 6-0 selects which bits to affect.

The difference between the above is subtle... The former disables all interrupts that are enabled. The latter disables all interrupts, even those that are already disabled, and it is shorter. :)
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

Ah. I based the POKE upon this document:
http://www.geocities.com/rmelick/6522e.txt

which is not as clear as this document:
http://www.ftp.funet.fi/pub/cbm/documen ... 22-VIA.txt

Thus, I assume POKE 37166,0 will not do anything at all? I wonder which of the seven interrupts really is the magic one for Pole Position.
Anders Carlsson

Image Image Image Image Image
Post Reply