How load games from Gamebase20 to a real VIC-20?

Discussion, Reviews & High-scores

Moderator: Moderators

Post Reply
Commodorianen
Vic 20 Drifter
Posts: 22
Joined: Fri Jun 02, 2017 11:56 am
Location: Sweden

How load games from Gamebase20 to a real VIC-20?

Post by Commodorianen »

Hi,

I'm pretty new to the VIC-20 and I'm wondering how to load games from gamebase20_v03 to a real VIC-20...

If a game has a000 in the file name, such as Galaxian-a000.prg, I guess it should be loaded to the cartridge area (a000), which must contain expansion RAM, but how do you do that in practise? I guess you have to change the load vector somehow before issuing LOAD to load the game to a000. How do you do that? Which SYS command do you then issue to start the game?

Some games contains two files, such as Buck Rogers-6000.prg and Buck Rogers-a000.prg. I'm not sure if that means that you have to load both files, one to 6000 and the other to a000, before starting the game.
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: How load games from Gamebase20 to a real VIC-20?

Post by Mike »

That issue is not specific to files from Gamebase20, but applies to all cartridge ROM dumps for the VIC-20.
Commodorianen wrote:If a game has a000 in the file name, such as Galaxian-a000.prg, I guess it should be loaded to the cartridge area (a000), which must contain expansion RAM, but how do you do that in practise? I guess you have to change the load vector somehow before issuing LOAD to load the game to a000. How do you do that? Which SYS command do you then issue to start the game?
First of all, you need a RAM expansion that covers all necessary blocks. In the two given cases, BLK5 (at $A000, for both), and for Buck Rogers, additionally in BLK3 (at $6000). A +32K RAM expansion covers all blocks normally used by ROM game cartridges.

Second, you'd need a CBM floppy drive or a SD2IEC device. With a SD2IEC, ensure that the file names are in lower case on the PC - you don't want to have these mixed up on the VIC-20 (the file names are then supposed to show up in all upper case when you do LOAD"$",8 and LIST on the VIC-20).

Then a small BASIC batch file loads both files and autostarts them as follows:

For Galaxian (single file):

Code: Select all

1 POKE55,0:POKE56,30:CLR:DN=PEEK(186)
2 READN$:IFN$=""THENSYS64802
3 SYS57809(N$),DN,1:POKE780,0:SYS65493:GOTO2
4 DATA "GALAXIAN-A000.PRG",""
For Buck Rogers (multiple files):

Code: Select all

1 POKE55,0:POKE56,30:CLR:DN=PEEK(186)
2 READN$:IFN$=""THENSYS64802
3 SYS57809(N$),DN,1:POKE780,0:SYS65493:GOTO2
4 DATA "BUCK ROGERS-6000.PRG","BUCK ROGERS-A000.PRG",""
With a CBM floppy drive you'll most probably have to shorten the file names due to the 16 character limit.

Short explanation:

Line 1 minimizes RAM available for the BASIC program to ensure a copy of the file name (automatically produces by the BASIC interpreter at the end of memory available for BASIC) won't shoot the loaded cartridge file data. Also, PEEK(186) holds the last used device (so #8 works, but also #9 or #10, etc.)

Line 2 reads all involved file names from the DATA in line 4. An empty string ends the list, the cartridge is then started by calling the reset routine in the KERNAL (with SYS64802).

Line 3 is a somewhat complicated, but nonetheless functional method to load any memory block from a file. The first two bytes of a PRG file contain the load address, which is 'honored' by ",DN,1" in the first SYS57809 (which supplies the parameters as for LOAD/SAVE). SYS65493 then calls the KERNAL LOAD routine with A=0 (load, not verify).

Line 4: see Line 2 above.

Unlike apparently simpler methods (doing the LOADs by hand or using strange constructs with "IFA=0THEN...LOAD" in a program) this batch procedure is guaranteed to work and also generalises for more complex load procedures.

Source: How to run cartridge dumps in PRG format? (slightly edited for given purpose)

Merry Xmas,

Michael
Commodorianen
Vic 20 Drifter
Posts: 22
Joined: Fri Jun 02, 2017 11:56 am
Location: Sweden

Re: How load games from Gamebase20 to a real VIC-20?

Post by Commodorianen »

Thank you Mike!

So, I think a key point in your answer to my question is that the address to load to is stored in the PRG files so I don't need to specify that explicitly.

So, basically, if I want to load and run Buck Rogers, I assume that I could just give the following commands in direct mode, assuming that the device number is 8, and that I have removed ".PRG" from the file names:

Code: Select all

LOAD"BUCK ROGERS-6000",8,1
LOAD"BUCK ROGERS-A000",8,1
SYS64802
Btw, I'm using a CBM floppy drive (I have 1541-II, 1571, and 1581). To transfer the .d64 to a floppy drive, I'm using MMC64. It is a C64 cartridge so I have to use a C64 to do that. For memory expansion, I have a Penultimate Cartridge.
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: How load games from Gamebase20 to a real VIC-20?

Post by Mike »

Commodorianen wrote:So, I think a key point in your answer to my question is that the address to load to is stored in the PRG files so I don't need to specify that explicitly.
In principle yes, but there's more to it.
So, basically, if I want to load and run Buck Rogers, I assume that I could just give the following commands in direct mode, assuming that the device number is 8, and that I have removed ".PRG" from the file names:

Code: Select all

LOAD"BUCK ROGERS-6000",8,1
LOAD"BUCK ROGERS-A000",8,1
SYS64802
If you try this, you'll be greeted by an ?OUT OF MEMORY error when issuing the second LOAD command. The first load sets the end address of the loaded program file to the very top of available BASIC memory. While executing LOAD, the BASIC interpreter produces a temporary copy of the file name at the top of memory, but now all memory is allocated, hence the error.

When you change the procedure to the following, you introduce yet another problem:

Code: Select all

!! DO NOT USE !!

LOAD"BUCK ROGERS-6000",8,1
NEW
LOAD"BUCK ROGERS-A000",8,1
SYS64802

!! DO NOT USE !!
The NEW 'silences' the ?OUT OF MEMORY error, but now the temporary copy of the file name overwrites the end of the cartridge dump that has been loaded before to $6000..$7FFF! You simply don't want this. You can only be sure that this quite possibly destroys vital parts of the soft-loaded cartridge, leading to difficult to track down crashes (i.e. game 'runs', and when accessing the overwritten part it suddenly behaves unexpectedly).

Next try:

Code: Select all

LOAD"BUCK ROGERS-A000",8,1
NEW
LOAD"BUCK ROGERS-6000",8,1
SYS64802
Now this one works - by loading "%-6000" as second file, the temporary file name does do no harm, as it is in turn overwritten by the correct data of the "%-6000" file.

...

Now you have three different, apparently 'identical' methods. One of them doesn't work at all, one of them 'seems' to work but might lead to unexpected crashes, and only one of them actually does as supposed.

Do you think you remember which of these three methods is the right one after one half a year? No?

That's the reason I posted the boot program in my first reply. You can save it on disk in addition to the cartridge dump files and easily adapt it to other cartridges. :)
Commodorianen
Vic 20 Drifter
Posts: 22
Joined: Fri Jun 02, 2017 11:56 am
Location: Sweden

Re: How load games from Gamebase20 to a real VIC-20?

Post by Commodorianen »

Thank you, Mike! I feel that I'm learning quite a lot by your explanations :-) .
Commodorianen
Vic 20 Drifter
Posts: 22
Joined: Fri Jun 02, 2017 11:56 am
Location: Sweden

Re: How load games from Gamebase20 to a real VIC-20?

Post by Commodorianen »

Now I've tried some cartridge games. Some of them are positioned wrongly on the screen with the leftmost part outside of the visible screen. Is it possible to change that? I thought I could use the cursor keys but it has no effect.

Also, I think there is something wrong with the Buck Rogers image because I only come to a white screen with black border when I start the game, or when I've lost all lives. I would guess that it is supposed to be a high-score list rather than just a white screen.
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: How load games from Gamebase20 to a real VIC-20?

Post by Mike »

Commodorianen wrote:Some of them are positioned wrongly on the screen with the leftmost part outside of the visible screen. [...] I thought I could use the cursor keys but it has no effect.
This happens for all cartridges that program the video chip with the NTSC default values even when run on a PAL VIC-20. As you know, many of them can reposition their display window with the cursor keys, but not all of them.
[...] Is it possible to change that? [...]
That requires patches, which unfortunately are different for all cartridges. Sometimes, they're quite involved (if even possible!) when the game utilises raster effects.

Some years ago, nbla000 put quite some work into fixing most cartridges to be PAL/NTSC neutral, for Mega-Cart. Alas, Mega-Cart is no longer produced, and even though ROM dumps are out there, they rely on the Mega-Cart hardware to work correctly: with some cartridges, memory was so tight that it was necessary to provide a "sideways" ROM holding the patches.
Also, I think there is something wrong with the Buck Rogers image because I only come to a white screen with black border when I start the game, or when I've lost all lives. I would guess that it is supposed to be a high-score list rather than just a white screen.
It's quite possible, that Buck Rogers can't cope with RAM present in BLK1.

That behaviour is known also from other cartridges (notably, Bug Crusher): the cartridges in question duplicate part of the KERNAL reset routine which then errorneously relocates the screen to $1000 (with RAM in BLK1) even though the rest of the game expects it to be at $1E00 (as it would be, when the cartridge was used on its own).

The simplest solution would be write-protecting BLK1. Other than that, I'll take a look at the ROM dump.

'til later,

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

Re: How load games from Gamebase20 to a real VIC-20?

Post by Mike »

Here's the modified boot loader for Buck Rogers:

Code: Select all

1 POKE55,0:POKE56,30:CLR:DN=PEEK(186)
2 N$="BR-6000.PRG":GOSUB7
3 N$="BR-A000.PRG":GOSUB7
4 FORT=0TO15:READA:POKE320+T,A:NEXT
5 POKE40974,64:POKE40975,1:POKE27498,72:POKE27499,1:SYS64802
6 :
7 SYS57809(N$),DN,1:POKE780,0:SYS65493:RETURN
8 :
9 DATA160,30,140,136,2,76,82,253,160,30,140,136,2,76,24,229
As I had suspected, Buck Rogers falls over RAM present in BLK1. The modified loader patches two instances of the offending calls into ROM (note I use a variant shorting of the file names). The main game is hardcoded to use NTSC positioning.
Commodorianen
Vic 20 Drifter
Posts: 22
Joined: Fri Jun 02, 2017 11:56 am
Location: Sweden

Re: How load games from Gamebase20 to a real VIC-20?

Post by Commodorianen »

Thank you Mike! Now Buck Rogers is working. Amazing how much you know!
Post Reply