Gettingstarted - amaurycarvalho/msxbas2rom GitHub Wiki

Get started with MSXBAS2ROM

On this page you will create a simple MSX Basic program and compile it with MSXBAS2ROM. While this one it's a simple hello world program, the concepts demonstrated here will be the same for complex programs.

Prerequisites

Make sure you have already installed MSXBAS2ROM on your system before to try this guide.

Step 1: create your program

You must write your program on a text editor of your preference - for example, Notepad on Windows or Xed on Linux - and save it in a plain text format.

In this example, we will use the code below and save it as "hello.bas".

10 CLS
20 PRINT "HELLO WORLD"
30 BEEP
40 END

Step 2: compile your program

MSXBAS2ROM can create a ROM from your program in both pcode interpreted or binary assembly compiled ways.

The default it's to create a pcode interpreted ROM, so if you run the command below without parameters your program will be converted to a pcode format that the MSX Basic interpreter will understand:

msxbas2rom hello.bas

The draw back here it's that your program will run in the same speed - and can be listed by LIST statement in the same way - as a normal program inputted manually on the MSX machine.

To really make your program to run faster on the machine, you must include the "-c" parameter on command line to compile it in a ROM binary assembly format that will be recognizable directly by the Z80 processor, just like that:

msxbas2rom -c hello.bas

In this mode, your program will be compiled in a ROM file (in this example: hello.rom), and as a consequence of this it will run faster and will not be listed anymore by LIST statement on the MSX machine.

Step 3: run it on an emulator or real machine

Once the ROM file was created, you can load it as a normal cartridge on an emulator (i.e: WebMSX or OpenMSX) or in a real machine using SofaRUN or ODO.

Where to go next

See the demonstration section to get more complex examples of MSX Basic programs compiled with MSXBAS2ROM.