How to convert Zanac-Ex BIN files?

Par Chris584

Supporter (12)

Portrait de Chris584

02-01-2011, 14:49

Hi Folks,

I'm writing to ask for some help to convert Zanac-Ex BIN files so as NOT to use the BASIC loader provided with the game, as I'm using a different DISK boot-loader which displays a list of games when the MSX boots.

Usually, MSX BIN files have some sort of code at the end where the execution starts, so I need to convert Zanac-Ex BIN files to that format, which seems to be compatible with the boor loader I'm using. The code at the end varies depending on the MSX games, but for instance, for the first BIN file of Arkanoid is something like:

ld a,#54
out (#a8),a
ld hl,#9000
ld bc,#4000
ld de,#4000
ldir
ld a,#50
out (#a8),a
ret

However, Zanac-Ex BIN files have no code to execute at the end and the header of its BIN files are like:

FE 0090 FFCF 0090

Start: 0x9000
End: 0xCFFF
Exec: 0x9000

The thing is the loader I'm using can't properly load Zanac-Ex BIN files as they are, since there is no executable code at 0x9000 for some of the BIN files. For instance, ZANAC-EX.1 starts with the AB ROM signature:

AB.ACOM CG-86013

41 42 00 41 43 4F 4D 20 43 47 2D 38 36 30 31 33

Is there any way to change Zanac-Ex BIN files so as NOT to load the game from BASIC? Unfortunately, I cannot provide much information about the loader I'm using as I'm not the developer, but i is compatible with BIN files that features some executable code at the end, so I need to convert Zanac-Ex BIN files to such a format.

This is the link of the Zanac-EX DSK I'm trying:
{mod: sorry, warezlink removed}

The BASIC loader can be found inside the DSK image and is divided into two different BASIC files ZANAC-EX.BAS and ZANAC-EX.0.

ZANAC-EX.BAS:

30 A%=&HC000
40 POKE A%,0
50 A%=A%+1
60 POKE &HF676,PEEK(VARPTR(A%))
70 POKE &HF677,PEEK(VARPTR(A%)+1)
80 RUN"ZANAC-EX.0"

ZANAC-EX.0:

11 WIDTH40:CLS:KEYOFF
12 PRINT"ZANAC EX(MSX2 GAME).DEPLOMBE PAR X.M.V":PRINT
14 PRINT" AN EXCELLENT GAME OF COMPILE/PONYCA "
16 PRINT"ORIGINAL VERSION AVAILABLE ON CARTRIDGE"
18 PRINT" WITH A SIZE OF 1 MBit or 128 Kb."
20 PRINT"THIS RAM VERSION NEEDS 128 KB MEMORY "
22 PRINT"MAPPER AT LEAST AND HAS TO BE USED ONLY"
24 PRINT"FOR STUDYING AND TESTING THE MAPPER."
26 PRINT:PRINT" MACHINES WITH 128 KB OR MORE ARE:"
28 PRINT"  - SONY HB-F700P, G900P, HB-F9P"
30 PRINT"  - PHILIPS VG8235,NMS 8245,NMS 8250,"
31 PRINT"     NMS 8255, NMS 8280"
32 PRINT"  - YAMAHA YIS 805/256. C7M/128 ,AMO"
33 PRINT"  - OR MACHINES WITH A SEPERATE MEMORY"
34 PRINT"    MAPPER WHICH >=128 KB."
35 PRINT"    ONE CONDITION: THIS MAPPER HAS"
36 PRINT"     TO BE PLACED BEFORE NORMAL RAM !"
38 PRINT:PRINT" NOW HARDWARE TESTING......."
40 IF PEEK(&H2D)<1 THEN PRINT"THIS HAS TO BE A MSX2 COMPUTER AT LEAST. SORRY.":END
100 OUT&HFE,1:OUT&HFD,2:IFINP(&HFE)=INP(&HFD)THENPRINT"THIS MACHINE HAS NO (WORKING?) MEMORY MAPPER. SORRY.":END
101 PRINT "240 LIVES (Y/N)";
102 INPUT Z$
103 PRINT "INVINCIBILITY (Y/N)";
104 INPUT Y$
110 FORT=1TO255:OUT&HFE,T:POKE&HBFFE,0:NEXT:T=1
120 OUT&HFE,T:A=PEEK(&HBFFE):IF(A=T)ORA=0THENPOKE&HBFFE,TELSEGOTO140
130 T=T+1:GOTO120
140 OUT&HFE,1:IFT<9THENPRINT"TOO LITTLE MEMORY. SORRY.":END
142 PRINT:PRINT"..LOADING NOW AND STARTING.."
148 'FORT=1TO7:OUT&HFE,T:BLOAD"ZANAC-EX."+RIGHT$(STR$(T),1),-&H1000:IF( (A$=CHR$(89)ORA$=CHR$(121)) AND (T=1)) THEN POKE&H9A05,&HF0:IF( (B$=CHR$(89)ORB$=CHR$(121)) AND (T=7)) THEN POKE&H9B55,&H0:POKE&H9B56,&H0:POKE&H9B57,&H0:LOCATE37,21:PRINT7-T:NEXTT
149 FORT=1TO7:OUT&HFE,T
155 BLOAD"ZANAC-EX."+RIGHT$(STR$(T),1),-&H1000
156 IFT=1AND(Z$=CHR$(89)ORZ$=CHR$(121))THENPOKE(&H9A05-&H1007),&HF0
157 IFT=7AND(Y$=CHR$(89)ORY$=CHR$(121))THENPOKE(&H9B55-&H1007),&H0:POKE(&H9B56-&H1007),&H0:POKE(&H9B57-&H1007),&H0
158 LOCATE37,21:PRINT7-T:NEXTT
159 RESTORE 320:FORT=&HD000TO&HD039:READA$:POKE T,VAL("&H"+A$):NEXTT
190 RESTORE200:FORT=&HCE00TO&HCE19:READA$:POKET,VAL("&H"+A$):NEXTT
191 POKE&HCE0F,PEEK(&HF341)
195 OUT&HFE,1:OUT&HFD,2:DEFUSR=&HCE00:PRINTUSR(0)
200 DATA 01,00,04,F3,C5,CD,9F,FD,C1,0B,78,B1,20,F5,3e,00,21,00,50,CD,24,00,2a,02,40,e9
320 DATA F5,FE,6,20,4,3E,7,18,2D,FE,7,20,27,C3,30,D0,F5,FE,6,20,4,3E,7,18,A,FE,7,20,4,3E,1,18,2,3C,3C,D3,FE,F1,C9,0,0,0,0,0,0,0,0,0,3E,1,18,2,3C,3C,D3,FD,F1,C9,

Considering what the BASIC loader above does (forget the INVINCIBILITY issue), what a binary file is supposed to do in order to load the game?

Cheers,

CJ

!login ou Inscrivez-vous pour poster

Par cax

Prophet (3740)

Portrait de cax

02-01-2011, 17:05

You may try Zanac-Ex from my page of self-extracting megaroms, which can be loaded with or without basic loader.
I believe it does exactly what you need.
I built them for sequential loading with just bload"name",r and tested with a number of loaders, including disk, cassette and Yamaha classroom network interface.

Par Chris584

Supporter (12)

Portrait de Chris584

03-01-2011, 00:19

Exactly, this is what I need: a sequential loading with just bload"name",r. Cloud please pass me the link?

Thanks,

CJ

Par Chris584

Supporter (12)

Portrait de Chris584

03-01-2011, 00:40

Cax, thanks a lot. I've already found your page and the game is working with just bload"name",r as you described. I will later try it with my loader, but I'm pretty sure it's gonna work. You did a great job...

One question, what should I consider to create my own self-extracting megaroms if I need one which is not included in your list? Is the whole process explained on your page? Sorry for asking if all the info is already there, but I'm just in a hurry at this moment and cannot have a proper look.

Par Chris584

Supporter (12)

Portrait de Chris584

03-01-2011, 05:14

Cax, this is just to confirm that your files have even worked with my loader too. Thanks mate, :-)

How can I create my own BIN versions for other ROMS? I have downloaded your pack (RomPackBload.zip) but the megaroms seem not to be split in several BIN files.

Thanks,

CJ

Par cax

Prophet (3740)

Portrait de cax

03-01-2011, 07:21

Creating BINs from MegaROM is a complex task even for hacker.
In your case you already had BINs, and you only had to mimic behavior of Basic loader in the BIN itself.
This Zanac-Ex loader does OUT &HFE, the same job you should do in every BIN instead (in assembly, of course).

Par Chris584

Supporter (12)

Portrait de Chris584

03-01-2011, 09:45

Yes, that is exactly what I'm trying to do, emulating the BASIC loader, but in Assembler by adding binary code at the end of the file. Is that task done semi-automatically by using PackMegaROM.bat? Could you please describe the process using a short example?

I don't clearly understand the aim of PackMegaROM.bat. I have even tried Pack-16K-ROM.bat for a 16K rom (Konami Tennis), but unfortunately I get message telling "Source file not found":

C:\CHRIST~1\MSX\Tia\REDPOI~1\test\zanac-ex\ROMPAC~1>Pack-16K-ROM.bat t.rom

C:\CHRIST~1\MSX\Tia\REDPOI~1\test\zanac-ex\ROMPAC~1>copy t.rom packed.dat
1 file(s) copied.

C:\CHRIST~1\MSX\Tia\REDPOI~1\test\zanac-ex\ROMPAC~1>ppibm p -m 2 -f d -l packed.
dat
PROPACK (tm) 2.14 REGISTERED TO OXFORD DIGITAL ENTERPRISES 29-10-92
Copyright (c) 1991-92 Rob Northen Computing, UK. All Rights Reserved.

PACKING DATA FILE(S) AND LOCKING

PACKED.DAT [ 16384] [ 13306] [18.78%]

1 file(s) [ 16384] [ 13306] [18.78%] [0h 0m 0s]

C:\CHRIST~1\MSX\Tia\REDPOI~1\test\zanac-ex\ROMPAC~1>del unpack.bin

C:\CHRIST~1\MSX\Tia\REDPOI~1\test\zanac-ex\ROMPAC~1>sbasm 16K-unpack.asm

SB-Cross Assembler version 2.04
Please visit www.sbprojects.com

Source file not found!

However, this generates a file named as PACKED.DAT without a header. Which ones are the next steps?

Thanks,

CJ

Par Chris584

Supporter (12)

Portrait de Chris584

03-01-2011, 14:02

What's the code before the OUT &HFE in your BIN files? Is that the code that decompress your files? Supposing that BIN files are not compressed, should I only add the code shown below?

ld a,#n ;n:2..7
out (#fe), a
ret

CJ

Par cax

Prophet (3740)

Portrait de cax

03-01-2011, 23:36

You should add the missing code manually.
And yes, the assembly code you wrote in your last message is correct.

The batch you were running is for creating self-extractable packed BIN from regular BIN, not for converting special Basic loaders or ROMs. If you want to convert ROMs up to 32K in size into self-extractable BINs - just use my MicroWAVer tool, it's a byproduct it creates while converting ROM to WAV.

PackMegaROM.bat is not the released solution for any type of files but a snapshot of the folder from my hdd I used to compress games made of BINs.
If you are definitely going to use it - I will elaborate more when I'll have more spare time.

Par Chris584

Supporter (12)

Portrait de Chris584

04-01-2011, 07:12

For instance, if I want to pack Antartic Adventure (16K. rom), whose header is: FE 0087 00C8 0087

which values should I use for unpack.asm?

Par cax

Prophet (3740)

Portrait de cax

04-01-2011, 10:36

A lot of time passed since I wrote and used this converter.
I really have no spare time to re-read my own code and try to recall how the things work - so try to find answers yourself for now, or wait.
And also I told you to use MicroWAVer for small ROMs.