Difference between revisions of "Create my first program"
From MSX Game Library
(ββCreate your project directory) |
|||
Line 15: | Line 15: | ||
Rename <tt>template.c</tt> to <tt>mygame.c</tt>. | Rename <tt>template.c</tt> to <tt>mygame.c</tt>. | ||
+ | |||
+ | Your project should look like: | ||
+ | {| | ||
+ | |- | ||
+ | |<tt>π projects</tt> || | ||
+ | |- | ||
+ | |<tt>ββπ mygame</tt> || Your project directory | ||
+ | |- | ||
+ | |<tt> ββ build.bat </tt> || Launch Build tool (Windows) | ||
+ | |- | ||
+ | |<tt> ββ build.sh</tt> || Launch Build tool (Linux) | ||
+ | |- | ||
+ | |<tt> ββ msxgl_config.h</tt> || Library configuration | ||
+ | |- | ||
+ | |<tt> ββ mygame.c</tt> || Your program source code | ||
+ | |- | ||
+ | |<tt> ββ project_config.js</tt> || Build tool configuration | ||
+ | |} | ||
== Setup Build Tool == | == Setup Build Tool == |
Revision as of 16:29, 25 December 2022
Contents
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 (Windows) or ./build.sh (Linux)
- 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.js, you can edit project_config.js and change "DoRun = false;" to "DoRun = true;" 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 (or template_msx2) directory, and rename it mygame.
Rename template.c to mygame.c.
Your project should look like:
π projects | |
ββπ mygame | Your project directory |
ββ build.bat | Launch Build tool (Windows) |
ββ build.sh | Launch Build tool (Linux) |
ββ msxgl_config.h | Library configuration |
ββ mygame.c | Your program source code |
ββ project_config.js | Build tool configuration |
Setup Build Tool
Edit project_config.js:
- Change ProjName to "mygame".
- Set Machine to the minimal version of MSX hardware you want to support for your program. Let's say "1" 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.js, set DoRun to true 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 project_config.js. See the options list.
Setup program
- msxgl_config.h...
Change program content
TBC...