Convert multi part tape games

Discuss anything related to the VIC
Post Reply
User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

Convert multi part tape games

Post by nbla000 »

I want to convert multi part tap files to load from Disk as already done for some games like minikong, arcadia, hunch back, my wish game is Salmon Run or his clone Trout but since is more difficult for me i want to start with simple 2 part games loader+game, my first attempt is Invaders (C) 1984 Livewire, the first part load the second using SYS4128, looking in the vice monitor i've discovered the point where is the name of the second file "I98" but i don't find 01 byte to change in 08 to start it from floppy, any suggestion?

HERE you may find Invaders

Code: Select all

.C:101a   F0 F0      BEQ $100C    
.C:101c   0F 0F F0   SLO $F00F
.C:101f    40         RTI
.C:1020   A9 20      LDA #$20        <== start point SYS4128
.C:1022   8D 22 03   STA $0322
.C:1025   A9 10      LDA #$10
.C:1027   8D 23 03   STA $0323
.C:102a   A9 08      LDA #$08
.C:102c   8D 0F 90   STA $900F
.C:102f   A9 08      LDA #$08
.C:1031   20 D2 FF   JSR $FFD2
.C:1034   A9 93      LDA #$93
.C:1036   20 D2 FF   JSR $FFD2
.C:1039   A9 F0      LDA #$F0
.C:103b   8D 05 90   STA $9005
.C:103e   A2 00      LDX #$00
.C:1040   BD 00 11   LDA $1100,X
.C:1043   9D 58 1E   STA $1E58,X
.C:1046   BD 50 11   LDA $1150,X
.C:1049   9D 58 96   STA $9658,X
.C:104c   BD 16 11   LDA $1116,X
.C:104f   9D 1E 1F   STA $1F1E,X
.C:1052   BD 66 11   LDA $1166,X
.C:1055   9D 1E 97   STA $971E,X
.C:1058   BD 2C 11   LDA $112C,X
.C:105b   9D 8C 1F   STA $1F8C,X
.C:105e   BD 7C 11   LDA $117C,X
.C:1061   9D 8C 97   STA $978C,X
.C:1064   E8              INX
.C:1065   E0 16         CPX #$16
.C:1067   D0 D7         BNE $1040
.C:1069   A2 00          LDX #$00
.C:106b   BD 79 10    LDA $1079,X
.C:106e   9D FA 1D    STA $1DFA,X
.C:1071   E8             INX
.C:1072   E0 06        CPX #$06
.C:1074   D0 F5        BNE $106B
.C:1076   4C 7F 10   JMP $107F
.C:1079   20 D5 FF   JSR $FFD5
.C:107c   4C 73 00   JMP $0073
.C:107f   20 9D 10   JSR $109D
.C:1082   A2 01      LDX #$01                <=== Drive?
.C:1084   A4 9A      LDY $9A
.C:1086   A9 01      LDA #$01
.C:1088   20 BA FF   JSR $FFBA
.C:108b   A9 00      LDA #$00
.C:108d   A2 00      LDX #$00
.C:108f   A0 00      LDY #$00
.C:1091   20 BD FF   JSR $FFBD
.C:1094   A9 00      LDA #$00
.C:1096   A2 FF      LDX #$FF
.C:1098   A0 FF      LDY #$FF
.C:109a   4C FA 1D   JMP $1DFA
.C:109d   A2 00      LDX #$00
.C:109f   BD A0 11   LDA $11A0,X
.C:10a2   9D 73 00   STA $0073,X
.C:10a5   E8         INX
.C:10a6   E0 17      CPX #$17
.C:10a8   D0 F5      BNE $109F
.C:10aa   A2 00      LDX #$00
.C:10ac   BD 00 12   LDA $1200,X
.C:10af   9D 00 02   STA $0200,X
.C:10b2   E8         INX
.C:10b3   E0 75      CPX #$75
.C:10b5   D0 F5      BNE $10AC
.C:10b7   A2 00      LDX #$00
.C:10b9   BD A1 12   LDA $12A1,X
.C:10bc   9D A1 02   STA $02A1,X
.C:10bf   E8         INX
.C:10c0   E0 5F      CPX #$5F

.C:1300   13 0F      SLO ($0F),Y
.C:1302   00         BRK
.C:1303   20 20 22   JSR $2220        "
.C:1306   49 39      EOR #$39         I9  <===
.C:1308   38         SEC                    8   <=== second part file
.C:1309   22         JAM                     "
.C:130a   20 20 20   JSR $2020
.C:130d   20 20 20   JSR $2020
.C:1310   20 20 20   JSR $2020
.C:1313   20 20 20   JSR $2020
.C:1316   20 20 50   JSR $5020
.C:1319   52         JAM
.C:131a   47 3C      SRE $3C
.C:131c   20 20 00   JSR $0020
.C:131f   3F 13 00   RLA $0013,X
.C:1322   00         BRK
.C:1323   20 20 20   JSR $2020
.C:1326   22         JAM
.C:1327   2D 2D 2D   AND $2D2D
Last edited by nbla000 on Tue Aug 01, 2006 2:44 am, edited 1 time in total.
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

Yes. JSR $FFBA sets up logical file, so LDX #$08 might work. If you want to preserve the loading screen but make it one file, you could do as following:

1. Load the main part, save it separately and apply PuCrunch to shrink it as much as possible.
2. Attach the code ($102A - $1076 or so) right after the crunched file. Instead of loading next part, just insert code to wait for a keypress and then jump to the depacking routine.
3. Save the whole program, perhaps apply PuCrunch again if it is larger than 3584 bytes. Make sure the starting address is at the attached picture viewer.
Anders Carlsson

Image Image Image Image Image
User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

Post by nbla000 »

ok, for me is not very simple, i don't understed assembler just look the code and try to interpret, i've load the second main part
LOAD "I98",1,1
after
SAVE "I98",8,1
with starcommander i've extracted the prg and Pucrunched but Pucrunch says:
the execution address was not detected correctly!
use the -x option to set the execution address.
how i may found this address?
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

Try 0x1DFA (JMP $1DFA in the loader)

I'm having another look at Trout/Salmon Run. It has a lot of overlapping code loading in parts, of which some is loaded into the zeropage and other low pages. It appears this game may memory wise be the most complex unexpanded VIC-20 game ever seen, perhaps filling all 5K RAM.
Anders Carlsson

Image Image Image Image Image
User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

Post by nbla000 »

First of all i need a Vic-20 assembler tutarial, there is in any place or in a vic-20 disk/tape image?

now, next step, i load the first part LOAD"INVADERS",1 no any instructions there is in the address $1DFA:

.C:1dfa FF FF FF ISB $FFFF,X
.C:1dfd FF FF FF ISB $FFFF,X
.C:1e00 2A ROL A
.C:1e01 2A ROL A
.C:1e02 2A ROL A
.C:1e03 2A ROL A

after RUN (the command is SYS4128)

.C:1dfa 20 D5 FF JSR $FFD5
.C:1dfd 4C 73 00 JMP $0073

.C:0073 CE FE 11 DEC $11FE
.C:0076 20 00 10 JSR $1000
.C:0079 EE FE 11 INC $11FE
.C:007c 20 00 14 JSR $1400
.C:007f 20 00 14 JSR $1400
.C:0082 AD 46 03 LDA $0346
.C:0085 D0 F8 BNE $007F
.C:0087 4C 16 02 JMP $0216

.C:0216 20 00 13 JSR $1300
.C:0219 20 92 1B JSR $1B92
.C:021c 4C E3 11 JMP $11E3

.C:11e3 CC 3E 3E CPY $3E3E
.C:11e6 EE DB 0F INC $0FDB
.C:11e9 0F F0 F6 SLO $F6F0
.C:11ec 0F 0F F1 SLO $F10F
.C:11ef F2 JAM
.C:11f0 CF CF 37 DCP $37CF
.C:11f3 36 CB ROL $CB,X
.C:11f5 CF 36 76 DCP $7636
.C:11f8 FF F3 1F ISB $1FF3,X
.C:11fb 0F FB F7 SLO $F7FB
.C:11fe 20 3F CE JSR $CE3F
.C:1201 4C 03 CE JMP $CE03

.C:ce3f 85 23 STA $23
.C:ce41 98 TYA
.C:ce42 48 PHA
.C:ce43 20 1B DC JSR $DC1B
.C:ce46 A5 65 LDA $65
.C:ce48 48 PHA
.C:ce49 A5 64 LDA $64
.C:ce4b 48 PHA
.C:ce4c A5 63 LDA $63
.C:ce4e 48 PHA
.C:ce4f A5 62 LDA $62
.C:ce51 48 PHA
.C:ce52 A5 61 LDA $61
.C:ce54 48 PHA
.C:ce55 6C 22 00 JMP ($0022)

a lot of instruction... without JMP so $0073 restart the loop

in any case i'm satisfied if i'm able to load this game from floppy in multipart mode too but if i change the address:

.C:1082 A2 01 LDX #$01
to
.C:1082 A2 01 LDX #$08

seems that the program go in loop and the drive led is off

PS: many thanks for your work in Trout/Salmon Run, i hope you win this challenge!!!
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

Ah, ok. You're still stuck in the loader. Decimal 4128 equals $1020 by the way.

This loader overwrites the routine to fetch next Basic byte ($0073). It also installs some own code in $0200 and $02A1, and pads out the video matrix with spaces all the way to $1FFF. Upon loading the main part, it jumps to the routine at $0073 to start execution.

What we need to do is to copy (and modify) the code from $109D-10D0 plus the data from $11A0-11B6, $1200-1274, $12A1-12D8. Theoretically, it copies data all the way to $12FF, but the rest of it are zeroes.

Here is a good idea how to load but not execute a program like this:

From the monitor, locate where the program will branch upon loaded. In this case, it takes a detour via $1DFA (which itself will be created/copied in by the loader):

1DFA JSR $FFD5
1DFD JMP $0073

Setting a breakpoint at 1DFD, you can resume the loader. Once everthing has loaded, the breakpoint is reached and if you wish you can save all the relevant memory areas (in particular 1000-1DFF, assuming you already extracted the other bits mentioned above).

I went the way of using Dasm to re-create parts of the loader, but the monitor would be enough. Then I load those parts from the monitor (using device 0 for current HDD directory) and save the whole memory block, in this case it was 1000-1EF6 before crunching.

Anyway, I single-filed this game too, and put it in a D64 for you together with the other programs I fixed. No Trout yet though.

http://www.cbm.sfks.se/files/NBLA.D64
Anders Carlsson

Image Image Image Image Image
User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

Post by nbla000 »

good work, i want to learn more, where i may found tutorials? it's only experiences?

do you think to post this work to Zimmers or there is a Denial archive?

PS: Good luck for Trout, i may help you in any way?
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

No idea about tutorials. Most of the important bits here are LDA and STA (as Wildstar would've said), and locating which parts go to what addresses. Some stuff is only required during loading and can be omitted. Then it comes to puzzle everything together - the VICE monitor is a fairly good tool to do that, only if it supported cut'n'paste...

Yeah, upload the files to Zimmers. I have a half megabyte of - partly unarchived - stuff too which should be uploaded one day.
Anders Carlsson

Image Image Image Image Image
User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

Post by nbla000 »

carlsson wrote:I have a half megabyte of - partly unarchived - stuff too which should be uploaded one day.
If you want a may do the job of research of your unarchived stuff to post only the new files to zimmer.
User avatar
Jeff-20
Denial Founder
Posts: 5759
Joined: Wed Dec 31, 1969 6:00 pm

Post by Jeff-20 »

I may start an archive here if I figure out how to efficiently do it .
High Scores, Links, and Jeff's Basic Games page.
User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

Post by nbla000 »

SALMON RUN fixed to work in any device (8/9/10/11)!!!!!

Is not a single file but multipart unexpanded, i've not changed original file just renamed "SALMON RUN" in "SALMON RUN 2" and made a loader "SALMON RUN" that load the first part and apply a POKE to load other parts from device according to the the current device PEEK(186)

I'm not be able to fix Trout too, it has a protected loader different from Salmon Run but except the loader screen the two games are identical.

Here you may found Salmon Run + Chopper (Zimmers version) and all the other tape fixed by Carlsson (Thanks again!!!)
Post Reply