Sunday 30 July 2023

Converting yet more multipart games for the VIC20 - Snake and Super Breakout

Continuing the looks at VIC20 multipart tape game conversion for the Penultimate +2 Cartridge

Snake

This is another snake game, a bit of a slow one, probably because it is written in BASIC. Well, almost all in BASIC, there are a few short machine code routines poke into RAM in the 1Dxx range, after the BASIC program. These are stored in DATA statements in the BASIC, so there is nothing magic (like some of the others).

As is common with all of these things, it is in multiple parts. The first prints up these instructions, pokes some character graphics and the machine code into RAM, then loads part 2.

I was going to do this the same way I have done several of the others, load part 1, and have it jump back to the cartridge to load and run part 2.

But since this was all BASIC I thought I would try something different.

This was designed to run on an unexpanded VIC20, so there is space for BASIC code from 1000 to 1DFF, and the screen is at 1E00 to 1FFF.

With a 3K expansion, there is space for BASIC code from 0400 to 1DFF and the screen is still at 1E00-1FFF.

(it all goes wrong with 8K plus when that gets reversed and the screen is at 1000 to 11FF and the code from 1200 upwards).

So I wondered if I could combine the two BASIC programs into one that would run on a VIC20 with a 3K expansion (since I am free to control the amount of memory a game is given).

Using C64 PRG Studio, it is easy to edit BASIC programs (that is what I have been using for most of the other smaller changes), and you can renumber and cut and paste etc.

It was just a case of removing the lines which did the LOAD and RUN of part2, and inserting the part 2 code there, suitable renumbered.

The final code loaded at 0401 as normal, and ended lower in RAM than either of the two part version, so there was no problem with the code which was poked into RAM at 1Dxx, and also the screen was in the same position, so nothing to change there.

That worked rather well.

Super Breakout

Super Breakout is like Breakout, but I guess it's Super.

It's quite a nice title screen where the blue line scrolls along and the breakout ball wipes out the titles whilst waiting for you to press the space bar.

Would have been even more "super" if it had supported joystick, but never mind.

This is another one with two BASIC programs. Ooh, I can do the "combine those into a single program for a 3K expanded VIC20" trick again.

So I set about the about the same process, just a case of removing the "NOW LOADING" screen.

And also, the rather unusual "PRESS STOP ON RECORDER". I wondered if that was left over if this was ported from another machine? (it is not, there is a reason, see a future post on the autofire in Bandits)

That all seemed to be going to plan, until I hit a couple of snags.

Firstly both parts used DATA statements, not in itself a problem, just need to get them in the correct order in the merged file. But both parts also use RESTORE. This command resets where data is read from. Other versions of BASIC let you set a line number, so RESTORE 1000 resets the reads to line 1000, but it appears Commodore BASIC does not.

I had found a way around that (by adding dummy reads to one part to skip over the data used by the other), but as soon as the game started, it went back to the good old READY prompt?

Looking through the code again, I found a little snipped I had overlooked.

73 open1,1,0," ":fori=0to34:input#1,b$:poke7628+i,val(b$):next:close1

That is reading 34 bytes of data from the tape after the second program. Here we go again with the magic.

The same code also POKEs data into RAM from some DATA statements, so I guess that is some form of copy protection.

I looked at converting that to DATA statements, but that would confuse the RESTORE situation further as I couldn't work out how often the second RESTORE was being called, and how that would affect this version that only needed to be read once.

I decided to give in with single version, and went back to the previous approach of modifying part 1 to jump back to the cartridge to load part 2. I still had to deal with the extra magic bit of code, so I just copied that into RAM at that address before loading part 2 and deleted that line of code.

Not as easy as I would have hoped, but that's another one done.


Advertisements

Penultimate +2 Cartridge

The Penultimate +2 Cartridge, containing these and many other games in stock at The Future Was 8 bit:

More info in a previous post:

http://blog.tynemouthsoftware.co.uk/2023/06/penultimate-plus-2-cartridge.html

See also a great video from Robin, 8 bit show and tell:


Patreon

You can support me via Patreon, and get access to advance previews of posts like this and behind the scenes updates. These are often in more detail than I can fit in here. This also includes access to my Patreon only Discord server for even more regular updates.

https://www.patreon.com/tynemouthsoftware