Change multipart game to load from disk rather than tape.

Basic and Machine Language

Moderator: Moderators

Dr-D
Vic 20 Drifter
Posts: 29
Joined: Wed Feb 18, 2015 12:34 pm

Change multipart game to load from disk rather than tape.

Post by Dr-D »

I hope I'm posting in the right area. After buying a disk drive (Commodore 1541) I have dragged my old VIC-20 out so that I can copy all my programs from tape to disk. The problem I've run into is that 5 of those programs are multipart and I have only been able to get one of those to load the second part from the disk drive since it had a simple load command and I just changed the device number to 8. However the other four are using POKE commands to load the second part and I don't know how to make it look for the second part on disk rather than tape. I think anyway as I'm not a programmer and haven't touched my VIC-20 in about 30 years. Below are the last two lines of the first part of the game Crazy Climber. All the preceding lines are Data statements so I hope you don't need all that.

90 POKE56,28:POKE52,28:FORI=7168TO7432:READD:POKEI,D:NEXT:PRINT"{CLR} "CHR$(34)"CRAZYCLIMBER"CHR$(34)
100 POKE631,19:POKE632,131:POKE198,2:NEW

Is there any change I can make in those line(s) that would make the program look for the second part of the game on disk rather than tape?

Thanks.
User avatar
tokra
Vic 20 Scientist
Posts: 1120
Joined: Tue Apr 27, 2010 5:32 pm
Location: Scheessel, Germany

Re: Change multipart game to load from disk rather than tape

Post by tokra »

Just add ",8" to the end of line 90 (with the quotes). This should work

What the two POKEs essentially do is send fill the keyboard buffer with keypresses which are completed once the program finishes.

In this case:

POKE 631,19 -> presses CLR/HOME (without Shift), so placing the cursor at the top left corner of the screen
POKE 632,131 -> presses RUN/STOP (with Shift), which in itself does "LOAD"+{Return} and "RUN"+{Return} which usually loads and runs from tape, but since you added a name and the ,8 in the first line it will now load from disk and run
POKE 198,2 -> says to the VIC that 2 keypresses are in the buffer that need to be executed (the ones in 631 and 632)

If you note the joystick does not work as expected in the second program you will need to add a SYS65017 to the start of the second program. Some register values are not reset after disk-access and this may screw up poorly written Joystick-routines.

Especially if you have programs for the unexpanded VIC it may just happen that you are not able to add the "filename",",8" or the SYS65017 to the program without it becoming too large, but those cases are rare.
User avatar
Mayhem
High Bidder
Posts: 3026
Joined: Mon May 24, 2004 7:03 am
Website: http://www.mayhem64.co.uk
Location: London

Re: Change multipart game to load from disk rather than tape

Post by Mayhem »

Welcome :)

First thing I can suggest is to download Gamebase20, which is a repository and archive of as many Vic20 games as possible. I maintain it so... I'm gonna plug it heh. But the main point is that a lot of multipart games in the archive have already been converted to load from disk, which may save you the trouble. Ones that suffer from the issues that Tokra mentions have been fixed to boot.

Oh, and if any of your games are NOT in GB20, then I'd be interested in having them to add!
Lie with passion and be forever damned...
Dr-D
Vic 20 Drifter
Posts: 29
Joined: Wed Feb 18, 2015 12:34 pm

Re: Change multipart game to load from disk rather than tape

Post by Dr-D »

Adding ",8" causes a syntax error.

90 POKE56,28:POKE52,28:FORI=7168TO7432:READD:POKEI,D:NEXT:PRINT"{CLR} "CHR$(34)"CRAZYCLIMBER"CHR$(34)",8"
User avatar
Kweepa
Vic 20 Scientist
Posts: 1314
Joined: Fri Jan 04, 2008 5:11 pm
Location: Austin, Texas
Occupation: Game maker

Re: Change multipart game to load from disk rather than tape

Post by Kweepa »

What was the error? Looks ok from here.
User avatar
tokra
Vic 20 Scientist
Posts: 1120
Joined: Tue Apr 27, 2010 5:32 pm
Location: Scheessel, Germany

Re: Change multipart game to load from disk rather than tape

Post by tokra »

The line is longer than 88 characters (4 screen lines), which is the maximum the VIC can handle when typing a program in. So you will either need to use all command-abbreviations when typing it in or split the line into two program lines, like this:

Code: Select all

90 poke56,28:poke52,28:fori=7168to7432:readd:pokei,d:next
91 print"{clr}{4 spaces}"chr$(34)"crazyclimber"chr$(34)",8"
Of course this only works if line 91 does not exist yet

Also make sure to type 4 spaces after the {clr} (inverse heart), this is where the LOAD is put by the POKEs later on.
Dr-D
Vic 20 Drifter
Posts: 29
Joined: Wed Feb 18, 2015 12:34 pm

Re: Change multipart game to load from disk rather than tape

Post by Dr-D »

Breaking it into two lines did the trick, thank you so much! I've got three more to do but these ones aren't pointing a file name. I'll try to figure them out on my own and if I can't I'll post them. Again, thank you very much.
User avatar
Mayhem
High Bidder
Posts: 3026
Joined: Mon May 24, 2004 7:03 am
Website: http://www.mayhem64.co.uk
Location: London

Re: Change multipart game to load from disk rather than tape

Post by Mayhem »

No file name, it will just load the next file on the tape. So you'll have to load the second part and see what the file name is, and use that. If there's no file name... you can give it one after you've transferred it to disk, and use that.
Lie with passion and be forever damned...
Dr-D
Vic 20 Drifter
Posts: 29
Joined: Wed Feb 18, 2015 12:34 pm

Re: Change multipart game to load from disk rather than tape

Post by Dr-D »

I've saved the second part files to disk giving them names obviously and added code to the first part so that it will actually load the second part new file names from disk but when it runs the screen just goes all garbled. The sound of the games seems to work but the graphics are getting all screwed up. I'll hammer away at it for a bit more before I give up and post the existing code and what I've added to try to make it work.
User avatar
Mayhem
High Bidder
Posts: 3026
Joined: Mon May 24, 2004 7:03 am
Website: http://www.mayhem64.co.uk
Location: London

Re: Change multipart game to load from disk rather than tape

Post by Mayhem »

Could some of them actually being loaded ,1,1 instead, and thus you are not loading the file to the original memory location but the BASIC area instead?
Lie with passion and be forever damned...
Dr-D
Vic 20 Drifter
Posts: 29
Joined: Wed Feb 18, 2015 12:34 pm

Re: Change multipart game to load from disk rather than tape

Post by Dr-D »

I only partially understand what you just said. I understand what the ,1,1 is and the game that had that in it I simply changed it to ,8,1 and changed the LOAD command to reflect the new name of the second file that I saved to disk and it works perfectly. I'll post the code of the four games that are giving me problems later when I have time. This probably isn't much help but the games are:

1. Defender
2. VIC Downs
3. Frantic Fisherman
4. Psycho Shopper

The first three are ones that I copied from people back in 1982/83. Yeah, yeah I'm aware of my pirating sins 30+ years ago. The fourth one, Psycho Shopper, is a tape I bought from Zeller's.
User avatar
Mayhem
High Bidder
Posts: 3026
Joined: Mon May 24, 2004 7:03 am
Website: http://www.mayhem64.co.uk
Location: London

Re: Change multipart game to load from disk rather than tape

Post by Mayhem »

As noted earlier, checking GB20 might be a good idea, as these games might have already been transferred to disk, or better still, packed into one PRG file for easy loading. I'll see about loading my database up tomorrow and having a look. 2,3,4 there's only one version of so I should know which game that is. Who wrote/published the Defender game?
Lie with passion and be forever damned...
User avatar
vicist
Vic 20 Afficionado
Posts: 352
Joined: Tue Oct 09, 2012 5:26 am
Location: Sheffield, UK

Re: Change multipart game to load from disk rather than tape

Post by vicist »

As the saying goes - here's one I prepared earlier (30 years earlier) :shock:

http://www.vicist.co.uk/psycho_shopper.d64

This is a .d64 disk image with 2 files on it.
psycho shopper.prg
shop.prg

Can't remember how I did it but if you look at the first file on the disk you should be able to work it out. :wink:

OK. Just took a look at the original first file on the tape and compared it to mine.
It looks like I re-wrote the machine-code loader to use the disk drive instead of the tape.
Last edited by vicist on Tue Oct 17, 2017 4:00 pm, edited 1 time in total.
User avatar
Mayhem
High Bidder
Posts: 3026
Joined: Mon May 24, 2004 7:03 am
Website: http://www.mayhem64.co.uk
Location: London

Re: Change multipart game to load from disk rather than tape

Post by Mayhem »

Okay, I could find Frantic Fisherman, and that's a D64 in GB20, so you're covered there.

Couldn't find VIC Downs, wasn't sure what that was. And there's multiple games called Defender. Psycho Shopper in GB20 is a one file packed PRG, but Vicist has you covered there.
Lie with passion and be forever damned...
Dr-D
Vic 20 Drifter
Posts: 29
Joined: Wed Feb 18, 2015 12:34 pm

Re: Change multipart game to load from disk rather than tape

Post by Dr-D »

These are the last two lines for VIC Downs:

Code: Select all

320 PRINT"{crsr-down}{crsr-down}{crsr-right}PRESS PLAY AND WAIT."
330 PRINT"{ctrl+1}":POKE631,131:POKE198,1
This is what I added/changed to make it load the second part from the disk drive:

Code: Select all

325 PRINT"{CLRHOME}{4spaces}"CHR$(34)"VICDOWNS"CHR$(34)",8"
330 PRINT"{ctrl1}":POKE631,19:POKE632,131:POKE198,2
It seems to be working but is it actually right? What does POKE631,131 do? Is there a website somewhere that'll tell me what the different POKE commands do?
Post Reply