# From X-Basic to ROM?

Страница 3/4
1 | 2 | | 4

^BUMP!

Hey, I'm working on a new game, but my BASIC listing is over 16K...
Is there a way to make a .rom file using X-Basic that is larger than 32k?
When I try the same old method of hex editing the basic rom and my larger basic listing together and padding it out to 64K, it doesn't seem to run.

Does anyone know a solution or another option?

The simplest solution is to put the BASIC-Kun between 4000h~7FFFh and the BASIC program between 8000h~BFFFh with the following method.

https://www.msx.org/forum/msx-talk/development/convert-a-pro...

If the BASIC program exceeds 16kB, use a ROM mapper and put the half of the BASIC-Kun to another segment of the ROM and a program at 6000h to place the portion that exceeds at C000h in the RAM. Once this part has been copied to RAM, you will just have to put back the BASIC-Kun segment and go back to initialization (restore the main Z80 registers before).

Umm... that sounds easy and straightforward at first glance, but I don't understand why there are 17 bytes of data on each line of your provided example instead of 16.

```00000h: 42 42 30 40 00 00 00 00 00 00 00 00 00 00 00 00 00
00010h: E5 D5 C5 21 40 40 11 00 C0 01 XX XX ED B0 C1 D1 E1
00020h: C9 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00```

An alternative is using Amaury's BAS2ROM:

He's getting formidable results from BASIC!

DamnedAngel wrote:

An alternative is using Amaury's BAS2ROM:

He's getting formidable results from BASIC!

would be interesting to make a performance comparison between BAS2ROM and X-Basic to see how much the difference is in terms of speed.

This Bomberman looks nice!

Pineapple wrote:

Umm... that sounds easy and straightforward at first glance, but I don't understand why there are 17 bytes of data on each line of your provided example instead of 16.

```00000h: 42 42 30 40 00 00 00 00 00 00 00 00 00 00 00 00 00
00010h: E5 D5 C5 21 40 40 11 00 C0 01 XX XX ED B0 C1 D1 E1
00020h: C9 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
```

This is the ROM header + the program below.

```	push	hl
push	de
push	bc
ld	hl,04040h
ld	de,0C000h
ld	bc,0XXXXh	; Program BASIC lenght that exceeds
ldir
pop	bc
pop	de
pop	hl
ret
```

but if you use the Basic-Kun, you have to move this program to another address and execute it with INIT address (at 4002h) that is free. So use a ROM mapper because there is no place in the BASIC-Kun ROM.

DamnedAngel wrote:

An alternative is using Amaury's BAS2ROM:

He's getting formidable results from BASIC!

I've tried Bas2Rom, but always fails to compile a rom for me.

Pineapple wrote:

I've tried Bas2Rom, but always fails to compile a rom for me.

What is the size of your Basic program exactly? I can make a ROM in the you will just have to insert your program with a hexa editor if you want.

A simple program like this works:

```10 DEFINT A-Z
20 TIME=0
30 FOR I=1 TO 100
40 FOR J=1 TO 100
50 FOR K=1 TO 100
60 L=I+J+K
70 NEXT K
80 NEXT J
90 NEXT I
100 PRINT TIME
```

I used notepad++ as editor, text saved as plain text, windows line endings. I don't know how MSXBAS2ROM handles different character encodings and line endings.

Compile with:

```MSXBAS2ROM.EXE TEST.TXT -C
```

I tested the resulting ROM in Bluemsx (emulating MSX2), it takes about 5051 frames to complete. I also tried with XBASIC, then it takes 3197 frames to finish the program.

Страница 3/4
1 | 2 | | 4