Difference between revisions of "Create my first program"

From MSX Game Library

(Test template program)
Line 2: Line 2:
  
 
First try to compile and run the template program:
 
First try to compile and run the template program:
* Go to <tt>MSXgl\projects\template</tt> (or <tt>\template_msx2</tt> if you target MSX2 computer)
+
* Go to <tt>MSXgl\projects\template</tt> (or <tt>template_msx2</tt> if you target MSX2 computer)
 
* Execute <tt>build.bat</tt>
 
* Execute <tt>build.bat</tt>
 
* Go to <tt>MSXgl\projects\template\emul\rom</tt>, check if <tt>template.rom</tt> exists and try it on your MSX machine or emulator.
 
* Go to <tt>MSXgl\projects\template\emul\rom</tt>, check if <tt>template.rom</tt> exists and try it on your MSX machine or emulator.
Line 12: Line 12:
 
Now that everything work well, let's create your own program.
 
Now that everything work well, let's create your own program.
  
You can sure start a new project from scratch, but for this example lets duplicate <tt>template</tt> directory an rename it <tt>mygame</tt>.
+
You can sure start a new project from scratch, but for this example lets duplicate <tt>template</tt> (<tt>template_msx2</tt>) directory an rename it <tt>mygame</tt>.
  
 
Rename <tt>template.c</tt> to <tt>mygame.c</tt>.
 
Rename <tt>template.c</tt> to <tt>mygame.c</tt>.

Revision as of 21:59, 18 June 2022

Test template program

First try to compile and run the template program:

  • Go to MSXgl\projects\template (or template_msx2 if you target MSX2 computer)
  • Execute build.bat
  • Go to MSXgl\projects\template\emul\rom, check if template.rom exists and try it on your MSX machine or emulator.

Note: If you have configured an emulator path in MSXgl\projects\default_config.cmd, you can edit build.bat and change "set DoRun=0" to "set DoRun=1" to allow auto-launch of the built program.

Create your project directory

Now that everything work well, let's create your own program.

You can sure start a new project from scratch, but for this example lets duplicate template (template_msx2) directory an rename it mygame.

Rename template.c to mygame.c.

Setup Build Tool

Edit build.bat:

  • Change ProjName to mygame.
  • Set Machine to the version MSX hardware you want to support for your program. Let's say 2 for .
  • Set Target to your target format. Let's say ROM_48K (ROM on page 0, 1 and 2 with page 1 & 2 selected at startup).
  • If you have configured an emulator path in MSXgl\projects\default_config.cmd, set DoRun to 1 to allow auto-launch (easier to test your program).
  • Execute build.bat, check the emul\rom directory for mygame.rom and test it.

Many other build options can be defined in build.bat. See the options list.

Setup program

  • msxgl_config.h...

Change program content

TBC...