Convert a Basic program to Rom file easly

Page 2/2
1 |

By TomXP411

Supporter (8)

TomXP411's picture

25-02-2020, 20:07

Is there a BASIC compiler for MSX? It might make more sense to compile the programs to COM files, then port that over to a ROM.

Never mind. It looks like BASCOM didn't make it to MSX. It's an excellent CP/M BASIC compiler, and it probably formed the core of QuickBASIC on PC... but unless you are using text-only programs, that's not the best option.

Now I'm thinking of modifying my BASIC editor to transcode BASIC to c code... where it can then be compiled (and eventually assembled.)

By spacemoai1973

Master (165)

spacemoai1973's picture

25-02-2020, 20:07

There are various compilers for MSX-BASIC, but none of them are 100% compatible with regular MSX-BASIC.
For ROM cartridges, nothing needs to be "ported" over. As long as the program is small enough to run on 16K RAM MSX computers, the MSX BIOS has native support for running BASIC programs from ROM.

By TomXP411

Supporter (8)

TomXP411's picture

25-02-2020, 20:09

Thanks. I'm new to MSX, so I'm totally unfamiliar with the system, aside from its similarity to DOS and CP/M. (It even runs CP/M software, which is super handy.)

By tfh

Prophet (2795)

tfh's picture

02-03-2020, 12:18

Well, that worked quite nicely Smile
It would be nice if I could also hide the listing. I tried ending the BASIC program with NEW, but as a result the whole program kept on looping.

By gdx

Enlighted (4195)

gdx's picture

03-03-2021, 01:37

The link I gave above is no longer valid and I did not indicate the method to make a Rom with a program in Basic larger than 16Kb. The method is the same but we must add the page 4000h~7FFFh to the rom in which there is the part of the program which exceeds and a small machine language program to copy the missing part to RAM at C000h.
For this, the page 4000h~7FFFh must also have a header.

Here is what it gives in hexadecimal (header + the machine language copy program):

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

XX XX is the length of the part of the BASIC program to be added. (eg. 00 04 for 1024 bytes)
Then add your BASIC program part at 00030h and fill the rest with 00 or FF up to 3FFFh to make a 32kB file altogether.

Page 2/2
1 |