Difference between revisions of "Samples"

From MSX Game Library

(Render)
(Driver)
 
(48 intermediate revisions by the same user not shown)
Line 1: Line 1:
The samples marked as "WIP" state are not functional.<br/>Trying to test them for now is useless.
+
Here is a list of sample programs included with '''MSXgl''' to illustrate how to use the library’s various features and functions.
 +
To test a sample program, follow these steps:
 +
# Open a command-line interface in the <tt>MSXgl/projects/samples/</tt> directory.
 +
# Run one of the following commands, depending on your operating system:
 +
#* <tt>build.bat s_game</tt> (Windows)
 +
#* <tt>./build.sh s_game</tt> (Linux & macOS)
  
== Samples ==
+
Replace <tt>s_game</tt> with the name of the sample you wish to test (there’s no need to include the <tt>.c</tt> file extension).
  
=== Core ===
+
<u>Note:</u> Sample programs use a configuration system that overwrites the default project settings (<tt>project_config.js</tt>) with a sample-specific configuration file (e.g., <tt>s_game.js</tt>). This approach allows multiple projects to coexist in the same directory without conflicts.
  
==== Hello World ====
+
For standalone projects, this step is unnecessary. To learn how to set up your own project from scratch, see [[Create my first program|this guide]].
 +
 
 +
== Core ==
 +
 
 +
=== Hello World ===
 
{{SAMPLE_BOX
 
{{SAMPLE_BOX
 
|name=Hello
 
|name=Hello
|desc=Program showing the minimal code needed to display a text.
+
|desc=Program showing the minimal code needed to display a "Hello World!" text.
 
|module1=
 
|module1=
 
|module2=
 
|module2=
Line 18: Line 27:
 
|target=ROM_32K
 
|target=ROM_32K
 
|ext=
 
|ext=
|state=Fonctional
+
|state=Functional
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_hello.jpg
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_hello.jpg
 
}}
 
}}
  
==== BIOS ====
+
=== BIOS ===
 
{{SAMPLE_BOX
 
{{SAMPLE_BOX
 
|name=BIOS
 
|name=BIOS
Line 35: Line 44:
 
|target=ROM_32K
 
|target=ROM_32K
 
|ext=
 
|ext=
|state=Fonctional
+
|state=Functional
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_bios.jpg
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_bios.jpg
 
}}
 
}}
  
==== Clock ====
+
=== Clock ===
 
{{SAMPLE_BOX
 
{{SAMPLE_BOX
 
|name=Clock
 
|name=Clock
|desc=Program showing the use of the Real Time Clock (Ricoh RP-5C01) to get current time and save/load from CMOS memory.
+
|desc=Program showing the use of the MSX2's Real Time Clock (Ricoh RP-5C01) to get current time and save/load data from CMOS memory.
 
|module1=clock
 
|module1=clock
 
|module2=
 
|module2=
Line 52: Line 61:
 
|target=ROM_32K
 
|target=ROM_32K
 
|ext=
 
|ext=
|state=Fonctional
+
|state=Functional
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_clock.jpg
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_clock.jpg
 
}}
 
}}
  
==== PSG ====
+
=== PSG ===
 
{{SAMPLE_BOX
 
{{SAMPLE_BOX
 
|name=PSG
 
|name=PSG
Line 69: Line 78:
 
|target=ROM_32K
 
|target=ROM_32K
 
|ext=
 
|ext=
|state=Fonctional
+
|state=Functional
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_psg.jpg
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_psg.jpg
 
}}
 
}}
  
==== System ====
+
=== System ===
 
{{SAMPLE_BOX
 
{{SAMPLE_BOX
 
|name=System
 
|name=System
Line 86: Line 95:
 
|target=ROM_32K
 
|target=ROM_32K
 
|ext=
 
|ext=
|state=Fonctional
+
|state=Functional
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_sys.jpg
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_sys.jpg
 
}}
 
}}
  
=== Render ===
+
== Render ==
  
==== Draw ====
+
=== Draw ===
 
{{SAMPLE_BOX
 
{{SAMPLE_BOX
 
|name=Draw
 
|name=Draw
Line 105: Line 114:
 
|target=ROM_32K
 
|target=ROM_32K
 
|ext=
 
|ext=
|state=Fonctional
+
|state=Functional
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_draw.jpg
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_draw.jpg
 
}}
 
}}
  
==== Graph Mode 3 ====
+
=== Graph Mode 3 ===
 
{{SAMPLE_BOX
 
{{SAMPLE_BOX
 
|name=Graph Mode 3
 
|name=Graph Mode 3
Line 122: Line 131:
 
|target=ROM_32K
 
|target=ROM_32K
 
|ext=
 
|ext=
|state=Fonctional
+
|state=Functional
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_gm3.png
+
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_gm3_2.png
 
}}
 
}}
  
==== Print ====
+
=== Print ===
 
{{SAMPLE_BOX
 
{{SAMPLE_BOX
 
|name=Print
 
|name=Print
Line 139: Line 148:
 
|target=ROM_32K
 
|target=ROM_32K
 
|ext=
 
|ext=
|state=Fonctional
+
|state=Functional
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_print.jpg
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_print.jpg
 
}}
 
}}
  
==== Sprite Mode 1 ====
+
=== Sprite Mode 1 ===
 
{{SAMPLE_BOX
 
{{SAMPLE_BOX
 
|name=Sprite
 
|name=Sprite
Line 156: Line 165:
 
|target=ROM_32K
 
|target=ROM_32K
 
|ext=
 
|ext=
|state=Fonctional
+
|state=Functional
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_sm1.jpg
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_sm1.jpg
 
}}
 
}}
  
==== Sprite Mode 2 ====
+
=== Sprite Mode 2 ===
 
{{SAMPLE_BOX
 
{{SAMPLE_BOX
 
|name=Sprite
 
|name=Sprite
|desc=Program showing the use of sprite mode 2 and split screen to change VDP setting during screen rendering.
+
|desc=Program demonstrating the use of sprite mode 2 (including multi-colors) and split screen using the horizontal interrupt to modify VDP parameters during screen rendering.
 
|module1=vdp
 
|module1=vdp
 
|module2=
 
|module2=
Line 173: Line 182:
 
|target=ROM_32K
 
|target=ROM_32K
 
|ext=
 
|ext=
|state=Fonctional
+
|state=Functional
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_sprite.jpg
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_sprite.jpg
 
}}
 
}}
  
==== Software Sprite ====
+
=== Sprite FX ===
 +
{{SAMPLE_BOX
 +
|name=Sprite FX
 +
|desc=Program showing the use of Sprite Tool module to modify sprite data (support Cropping, Flipping, Asking and Rotating).
 +
|module1=sprite_fx
 +
|module2=
 +
|module3=
 +
|module4=
 +
|module5=
 +
|file=s_sprtfx.c
 +
|machine=MSX2
 +
|target=ROM_32K
 +
|ext=
 +
|state=Functional
 +
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_sprttool.gif
 +
}}
 +
 
 +
=== Software Sprite ===
 
{{SAMPLE_BOX
 
{{SAMPLE_BOX
 
|name=Software Sprite
 
|name=Software Sprite
Line 190: Line 216:
 
|target=ROM_32K
 
|target=ROM_32K
 
|ext=
 
|ext=
|state=Fonctional
+
|state=Functional
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_swsprt.png
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_swsprt.png
 
}}
 
}}
  
==== Software Tile ====
+
=== Software Tile ===
 
{{SAMPLE_BOX
 
{{SAMPLE_BOX
 
|name=Software Tile
 
|name=Software Tile
Line 207: Line 233:
 
|target=ROM_32K
 
|target=ROM_32K
 
|ext=
 
|ext=
|state=Fonctional
+
|state=Functional
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_swtile.png
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_swtile.png
 
}}
 
}}
  
==== Text ====
+
=== Text ===
 
{{SAMPLE_BOX
 
{{SAMPLE_BOX
 
|name=Text
 
|name=Text
Line 224: Line 250:
 
|target=ROM_32K
 
|target=ROM_32K
 
|ext=
 
|ext=
|state=Fonctional
+
|state=Functional
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_text.jpg
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_text.jpg
 
}}
 
}}
  
==== VDP Command ====
+
=== VDP Command ===
 
{{SAMPLE_BOX
 
{{SAMPLE_BOX
 
|name=VDP
 
|name=VDP
Line 241: Line 267:
 
|target=ROM_32K
 
|target=ROM_32K
 
|ext=
 
|ext=
|state=Fonctional
+
|state=Functional
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_vdpcmd.jpg
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_vdpcmd.jpg
 
}}
 
}}
  
=== Target format ===
+
=== Scrolling ===
 +
{{SAMPLE_BOX
 +
|name=Scrolling
 +
|desc=Program showing the use of multi-directionnal tile-based scrolling and screen adjust register for smooth scrolling.
 +
|module1=vdp
 +
|module2=scroll
 +
|module3=
 +
|module4=
 +
|module5=
 +
|file=s_scroll.c
 +
|machine=MSX2
 +
|target=ROM_32K
 +
|ext=
 +
|state=Functional
 +
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_scroll.png
 +
}}
 +
 
 +
== Target format ==
  
==== MSX-DOS ====
+
=== Boot Disk ===
 +
{{SAMPLE_BOX
 +
|name=Boot Disk
 +
|desc=Program showing the use boot disk target format. The program will be start from disk without going through MSX-DOS but allow to use BDOS function.
 +
|module1=dos
 +
|module2=
 +
|module3=
 +
|module4=
 +
|module5=
 +
|file=s_dos0.c
 +
|machine=MSX2
 +
|target=DOS0
 +
|ext=
 +
|state=Partial
 +
|img=
 +
}}
 +
 
 +
=== MSX-DOS ===
 
{{SAMPLE_BOX
 
{{SAMPLE_BOX
 
|name=MSX-DOS
 
|name=MSX-DOS
|desc=.
+
|desc=Program showing the use of MSX-DOS 1 routines to load and display image from file.
|module1=
+
|module1=dos
 
|module2=
 
|module2=
 
|module3=
 
|module3=
Line 257: Line 317:
 
|module5=
 
|module5=
 
|file=s_dos.c
 
|file=s_dos.c
|machine=MSX12+
+
|machine=MSX22+
 
|target=DOS1
 
|target=DOS1
 
|ext=
 
|ext=
|state=Fonctional
+
|state=Functional
 
|img=
 
|img=
 
}}
 
}}
  
==== MSX-DOS 2 ====
+
=== MSX-DOS 2 ===
 
{{SAMPLE_BOX
 
{{SAMPLE_BOX
 
|name=MSX-DOS 2
 
|name=MSX-DOS 2
|desc=.
+
|desc=Program showing the use of various MSX-DOS 2 routines to load and display image, get disk information or handle mapped memory.
|module1=
+
|module1=dos
|module2=
+
|module2=dos_mapper
 
|module3=
 
|module3=
 
|module4=
 
|module4=
Line 277: Line 337:
 
|target=DOS2
 
|target=DOS2
 
|ext=
 
|ext=
|state=Fonctional
+
|state=Functional
 
|img=
 
|img=
 
}}
 
}}
  
==== Boot Disk ====
+
=== Mapped ROM ===
 
{{SAMPLE_BOX
 
{{SAMPLE_BOX
|name=Boot Disk
+
|name=Mapped ROM
|desc=.
+
|desc=Program showing usage of mapped ROM and segments switching.
 
|module1=
 
|module1=
 
|module2=
 
|module2=
Line 290: Line 350:
 
|module4=
 
|module4=
 
|module5=
 
|module5=
|file=s_dos0.c
+
|file=s_mapper.c
|machine=MSX2
+
|machine=MSX1
|target=DOS0
+
|target=ROM_ASCII8_128K
 
|ext=
 
|ext=
|state=Fonctional
+
|state=Functional
 
|img=
 
|img=
 
}}
 
}}
  
==== Mapped ROM ====
+
=== NEO mapper ===
 
{{SAMPLE_BOX
 
{{SAMPLE_BOX
|name=Mapped ROM
+
|name=NEO mapper
|desc=Program showing usage of ROM mapper segments.
+
|desc=Program showing usage of NEO-8 mapped ROM and segments switching.
 
|module1=
 
|module1=
 
|module2=
 
|module2=
Line 307: Line 367:
 
|module4=
 
|module4=
 
|module5=
 
|module5=
|file=s_mapper.c
+
|file=s_neo0.c
 
|machine=MSX1
 
|machine=MSX1
|target=ROM_32K
+
|target=ROM_NEO8_8M
 
|ext=
 
|ext=
|state=Fonctional
+
|state=Functional
 
|img=
 
|img=
 
}}
 
}}
  
=== Utilities ===
+
== Utilities ==
  
==== Game ====
+
=== Driver ===
 
{{SAMPLE_BOX
 
{{SAMPLE_BOX
|name=Game
+
|name=Driver
|desc=Program showing the use of game and game's pawn modules.
+
|desc=Program showing the creation of the driver, a code designed to be placed in memory and executed from a main program. Used in [[#MSX-DOS 2]] sample.
 
|module1=
 
|module1=
 
|module2=
 
|module2=
Line 326: Line 386:
 
|module4=
 
|module4=
 
|module5=
 
|module5=
|file=s_game.c
+
|file=s_drv.c
 
|machine=MSX1
 
|machine=MSX1
|target=ROM_32K
+
|target=RAW
 
|ext=
 
|ext=
|state=Fonctional
+
|state=Functional
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_game.png
+
|img=
 
}}
 
}}
  
==== Math ====
+
=== BASIC USR ===
 
{{SAMPLE_BOX
 
{{SAMPLE_BOX
|name=Math
+
|name=BASIC USR
|desc=Program showing the use of mathematics pre-calculated tables and pseudo-random generator.
+
|desc=Program showing the creation of binary to be load and used from BASIC.
|module1=
+
|module1=basic_usr
 
|module2=
 
|module2=
 
|module3=
 
|module3=
 
|module4=
 
|module4=
 
|module5=
 
|module5=
|file=s_math.c
+
|file=s_usr.c
 +
|machine=MSX1
 +
|target=BIN_USR
 +
|ext={{NINJATAP}}
 +
|state=Functional
 +
|img=
 +
}}
 +
 
 +
=== Compressor ===
 +
{{SAMPLE_BOX
 +
|name=Compressor
 +
|desc=Program showing the use of several compression algorithms (RLEp, Bitbuster 1 & 2, ZX0 and Pletter).
 +
|module1=compress/bitbuster
 +
|module2=compress/bitbuster2
 +
|module3=compress/lz48
 +
|module4=compress/pletter
 +
|module5=compress/zx0
 +
|file=s_zip.c
 
|machine=MSX2
 
|machine=MSX2
|target=ROM_32K
+
|target=DOS1
 
|ext=
 
|ext=
|state=Fonctional
+
|state=Functional
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_math.jpg
+
|img=
 
}}
 
}}
  
==== Scrolling ====
+
=== Game ===
 
{{SAMPLE_BOX
 
{{SAMPLE_BOX
|name=Scrolling
+
|name=Game
|desc=Program showing the use of multi-directionnal tile-based scrolling and screen adjust register for smooth scrolling.
+
|desc=Program showing the use of Game and Game pawn modules. The Game module offers state management while Game pawn allows to manage characters (display, animation, movement, collision, etc.)
|module1=
+
|module1=game/state
|module2=
+
|module2=game/pawn
 
|module3=
 
|module3=
 
|module4=
 
|module4=
 
|module5=
 
|module5=
|file=s_scroll.c
+
|file=s_game.c
|machine=MSX2
+
|machine=MSX1
 
|target=ROM_32K
 
|target=ROM_32K
 
|ext=
 
|ext=
|state=Fonctional
+
|state=Functional
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_scroll.png
+
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_game.png
 
}}
 
}}
  
==== Compress ====
+
=== Localize ===
 
{{SAMPLE_BOX
 
{{SAMPLE_BOX
|name=Compress
+
|name=Localize
|desc=blablabla...
+
|desc=Demonstration of the localization management module with support for multiple languages and management of different character sets.
|module1=
+
|module1=localize
 
|module2=
 
|module2=
 
|module3=
 
|module3=
 
|module4=
 
|module4=
 
|module5=
 
|module5=
|file=s_zip.c
+
|file=s_loc.c
|machine=MSX2
+
|machine=MSX1
 
|target=ROM_32K
 
|target=ROM_32K
 
|ext=
 
|ext=
|state=WIP
+
|state=Functional
|img=
+
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_loc.png
 
}}
 
}}
  
==== BASIC USR ====
+
=== Math ===
 
{{SAMPLE_BOX
 
{{SAMPLE_BOX
|name=BASIC USR
+
|name=Math
|desc=.
+
|desc=Program showing the use of mathematics pre-computed tables, pseudo-random generator and quick-computation functions.
|module1=
+
|module1=math
 
|module2=
 
|module2=
 
|module3=
 
|module3=
 
|module4=
 
|module4=
 
|module5=
 
|module5=
|file=s_usr.c
+
|file=s_math.c
|machine=
+
|machine=MSX2
 
|target=ROM_32K
 
|target=ROM_32K
 
|ext=
 
|ext=
|state=Fonctional
+
|state=Functional
|img=
+
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_math.jpg
 
}}
 
}}
  
==== Compressor ====
+
=== Encryption ===
 
{{SAMPLE_BOX
 
{{SAMPLE_BOX
|name=Compressor
+
|name=Encryption
|desc=.
+
|desc=Program showing the use of an encoding system to encrypt data. Useful for creating backup codes, for example.
|module1=
+
|module1=crypt
 
|module2=
 
|module2=
 
|module3=
 
|module3=
 
|module4=
 
|module4=
 
|module5=
 
|module5=
|file=s_zip.c
+
|file=s_crypt.c
|machine=
+
|machine=MSX1
 
|target=ROM_32K
 
|target=ROM_32K
 
|ext=
 
|ext=
|state=Fonctional
+
|state=Functional
 
|img=
 
|img=
 
}}
 
}}
  
=== Devices ===
+
== Devices ==
  
==== Joystick ====
+
=== Joystick ===
 
{{SAMPLE_BOX
 
{{SAMPLE_BOX
 
|name=Joystick
 
|name=Joystick
 
|desc=Program showing the use of joystick and input manager.
 
|desc=Program showing the use of joystick and input manager.
|module1=
+
|module1=input
|module2=
+
|module2=input_manager
 
|module3=
 
|module3=
 
|module4=
 
|module4=
Line 434: Line 511:
 
|target=ROM_32K
 
|target=ROM_32K
 
|ext=
 
|ext=
|state=Fonctional
+
|state=Functional
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_joystick.jpg
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_joystick.jpg
 
}}
 
}}
  
==== Keyboard ====
+
=== Keyboard ===
 
{{SAMPLE_BOX
 
{{SAMPLE_BOX
 
|name=Keyboard
 
|name=Keyboard
 
|desc=Program showing the use of keyboard and input manager.
 
|desc=Program showing the use of keyboard and input manager.
|module1=
+
|module1=input
|module2=
+
|module2=input_manager
 
|module3=
 
|module3=
 
|module4=
 
|module4=
Line 451: Line 528:
 
|target=ROM_32K
 
|target=ROM_32K
 
|ext=
 
|ext=
|state=Fonctional
+
|state=Functional
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_keyboard.jpg
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_keyboard.jpg
 
}}
 
}}
  
==== Mouse ====
+
=== Mouse ===
 
{{SAMPLE_BOX
 
{{SAMPLE_BOX
 
|name=Mouse
 
|name=Mouse
|desc=.
+
|desc=Program showing the use of mouse device and universal port (joystick port) device detection.
|module1=
+
|module1=input
 
|module2=
 
|module2=
 
|module3=
 
|module3=
Line 465: Line 542:
 
|module5=
 
|module5=
 
|file=s_mouse.c
 
|file=s_mouse.c
|machine=
+
|machine=MSX1
 
|target=ROM_32K
 
|target=ROM_32K
 
|ext=
 
|ext=
|state=Fonctional
+
|state=Functional
 
|img=
 
|img=
 
}}
 
}}
  
==== Ninja Tap ====
+
=== Ninja Tap ===
 
{{SAMPLE_BOX
 
{{SAMPLE_BOX
 
|name=Ninja Tap
 
|name=Ninja Tap
|desc=Program showing the use of NinjaTap device.
+
|desc=Program showing the use of NinjaTap device to connect up to 8 joysticks on one MSX machine.
|module1=
+
|module1=device/ninjatap
 
|module2=
 
|module2=
 
|module3=
 
|module3=
Line 484: Line 561:
 
|machine=MSX1
 
|machine=MSX1
 
|target=ROM_32K
 
|target=ROM_32K
|ext={{NinjaTap}}
+
|ext={{NINJATAP}}
|state=Fonctional
+
|state=Functional
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_ntap.png
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_ntap.png
 
}}
 
}}
  
==== ObsoNET ====
+
=== ObsoNET ===
 
{{SAMPLE_BOX
 
{{SAMPLE_BOX
 
|name=ObsoNET
 
|name=ObsoNET
|desc=.
+
|desc=Program showing the use of ObsoNET cartridge using network stack.
|module1=
+
|module1=network/obsonet
 
|module2=
 
|module2=
 
|module3=
 
|module3=
Line 499: Line 576:
 
|module5=
 
|module5=
 
|file=s_onet.c
 
|file=s_onet.c
|machine=
+
|machine=MSX1
|target=ROM_32K
+
|target=ROM_16K
 
|ext=
 
|ext=
|state=WIP
+
|state=Partial
 
|img=
 
|img=
 
}}
 
}}
  
==== PAC ====
+
=== PAC ===
 
{{SAMPLE_BOX
 
{{SAMPLE_BOX
 
|name=PAC
 
|name=PAC
|desc=.
+
|desc=Program showing the use of PAC or FM-PAC to load/save data into SRAM.
|module1=
+
|module1=device/pac
 
|module2=
 
|module2=
 
|module3=
 
|module3=
Line 519: Line 596:
 
|target=ROM_32K
 
|target=ROM_32K
 
|ext={{PAC}}
 
|ext={{PAC}}
|state=Fonctional
+
|state=Functional
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_pac.png
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_pac.png
 
}}
 
}}
  
==== V9990 ====
+
=== V9990 ===
 
{{SAMPLE_BOX
 
{{SAMPLE_BOX
 
|name=V9990
 
|name=V9990
|desc=.
+
|desc=Program showing the use of Yamaha V9990 based video cartridge.
|module1=
+
|module1=v9990
 
|module2=
 
|module2=
 
|module3=
 
|module3=
Line 533: Line 610:
 
|module5=
 
|module5=
 
|file=s_v9990.c
 
|file=s_v9990.c
|machine=
+
|machine=MSX1
 
|target=ROM_32K
 
|target=ROM_32K
|ext=
+
|ext={{V9990}}
|state=Fonctional
+
|state=Functional
|img=
+
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_v9990.png
 
}}
 
}}
  
=== Audio Format ===
+
== Audio Format ==
  
==== Arkos ====
+
=== Arkos ===
 
{{SAMPLE_BOX
 
{{SAMPLE_BOX
 
|name=Arkos
 
|name=Arkos
|desc=blablabla...
+
|desc=Program to demonstrate the use of the different Arkos Tracker (AT2 and AT3) music replayers.
|module1=
+
|module1=arkos/akg_player
|module2=
+
|module2=arkos/akm_player
|module3=
+
|module3=arkos/aky_player
 
|module4=
 
|module4=
 
|module5=
 
|module5=
 
|file=s_arkos.c
 
|file=s_arkos.c
 
|machine=MSX1
 
|machine=MSX1
|target=ROM_32K
+
|target=ROM_ASCII8_128K
 
|ext=
 
|ext=
|state=Fonctional
+
|state=Functional
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_arkos.png
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_arkos.png
 
}}
 
}}
  
==== ayFX ====
+
=== ayFX ===
 
{{SAMPLE_BOX
 
{{SAMPLE_BOX
 
|name=ayFX
 
|name=ayFX
|desc=blablabla...
+
|desc=Program showing the use of ayFX sound effect replayer (both using a bank or a single sound file).
|module1=
+
|module1=ayfx/ayfx_player
 
|module2=
 
|module2=
 
|module3=
 
|module3=
Line 572: Line 649:
 
|target=ROM_32K
 
|target=ROM_32K
 
|ext=
 
|ext=
|state=Fonctional
+
|state=Functional
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_ayfx.jpg
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_ayfx.jpg
 
}}
 
}}
  
==== lVGM ====
+
=== lVGM ===
 
{{SAMPLE_BOX
 
{{SAMPLE_BOX
 
|name=Light VGM
 
|name=Light VGM
|desc=.
+
|desc=Program showing the use of light-VGM's replayer (PSG).
|module1=
+
|module1=lvgm/lvgm_player
 
|module2=
 
|module2=
 
|module3=
 
|module3=
Line 586: Line 663:
 
|module5=
 
|module5=
 
|file=s_lvgm.c
 
|file=s_lvgm.c
|machine=
+
|machine=MSX1
 
|target=ROM_32K
 
|target=ROM_32K
 
|ext=
 
|ext=
|state=Fonctional
+
|state=Functional
 
|img=
 
|img=
 
}}
 
}}
  
==== PCM-Encoder ====
+
=== PCM-Encoder ===
 
{{SAMPLE_BOX
 
{{SAMPLE_BOX
 
|name=PCM Encoder
 
|name=PCM Encoder
|desc=.
+
|desc=Program showing the use of the PCM Encoder's replayer (aka. ''Crystal clean PCM 8bit samples on the poor PSG'').
|module1=
+
|module1=pcm/pcmenc
 
|module2=
 
|module2=
 
|module3=
 
|module3=
Line 606: Line 683:
 
|target=ROM_32K
 
|target=ROM_32K
 
|ext=
 
|ext=
|state=Fonctional
+
|state=Functional
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_pcm.jpg
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_pcm.jpg
 
}}
 
}}
  
==== PCM Play ====
+
=== PCM Play ===
 
{{SAMPLE_BOX
 
{{SAMPLE_BOX
 
|name=PCM Play
 
|name=PCM Play
|desc=.
+
|desc=Program showing the use of the PCM Play's replayer.
|module1=
+
|module1=pcm/pcmplay
 
|module2=
 
|module2=
 
|module3=
 
|module3=
Line 620: Line 697:
 
|module5=
 
|module5=
 
|file=s_pcmplay.c
 
|file=s_pcmplay.c
|machine=
+
|machine=MSX1
 
|target=ROM_32K
 
|target=ROM_32K
 
|ext=
 
|ext=
|state=Fonctional
+
|state=Functional
 
|img=
 
|img=
 
}}
 
}}
  
==== PT3 ====
+
=== PT3 ===
 
{{SAMPLE_BOX
 
{{SAMPLE_BOX
 
|name=PT3
 
|name=PT3
|desc=blablabla...
+
|desc=Program showing the use of Vortex Tracker II's replayer.
|module1=
+
|module1=pt3/pt3_player
 
|module2=
 
|module2=
 
|module3=
 
|module3=
Line 640: Line 717:
 
|target=ROM_32K
 
|target=ROM_32K
 
|ext=
 
|ext=
|state=Fonctional
+
|state=Functional
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_pt3.jpg
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_pt3.jpg
 
}}
 
}}
  
==== Trilo Tracker SCC ====
+
=== Trilo Tracker SCC ===
 
{{SAMPLE_BOX
 
{{SAMPLE_BOX
 
|name=Trilo Tracker SCC
 
|name=Trilo Tracker SCC
|desc=.
+
|desc=Program showing the use of Trilo Tracker SCC's replayer.
|module1=
+
|module1=trilo/trilo_scc_player
 
|module2=
 
|module2=
 
|module3=
 
|module3=
Line 654: Line 731:
 
|module5=
 
|module5=
 
|file=s_trilo.c
 
|file=s_trilo.c
|machine=
+
|machine=MSX1
|target=ROM_32K
+
|target=ROM_KONAMI_SCC_128K
 
|ext=
 
|ext=
|state=Fonctional
+
|state=Functional
 
|img=
 
|img=
 
}}
 
}}
  
==== VGM ====
+
=== VGM ===
 
{{SAMPLE_BOX
 
{{SAMPLE_BOX
 
|name=VGM
 
|name=VGM
|desc=blablabla...
+
|desc=Program showing the use of VGM's replayer (PSG, SCC, MSX-Music, MSX-Audio).
|module1=
+
|module1=vgm/vgm_player
 
|module2=
 
|module2=
 
|module3=
 
|module3=
Line 672: Line 749:
 
|file=s_vgm.c
 
|file=s_vgm.c
 
|machine=MSX1
 
|machine=MSX1
|target=ROM_32K
+
|target=ROM_ASCII16_256K
|ext=
+
|ext={{SCC}} {{MSXMUSIC}} {{MSXAUDIO}}
|state=Fonctional
+
|state=Functional
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_vgm.jpg
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_vgm.jpg
 
}}
 
}}
  
==== WYZ ====
+
=== WYZ ===
 
{{SAMPLE_BOX
 
{{SAMPLE_BOX
 
|name=WYZ
 
|name=WYZ
|desc=blablabla...
+
|desc=Program showing the use of WYZ Tracker's replayer (version 0.3).
|module1=
+
|module1=wyz/wyz_player
 
|module2=
 
|module2=
 
|module3=
 
|module3=
Line 691: Line 768:
 
|target=ROM_32K
 
|target=ROM_32K
 
|ext=
 
|ext=
|state=Fonctional
+
|state=Functional
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_wyz.png
 
|img=raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/sample_wyz.png
 
}}
 
}}
  
==== WYZ2 ====
+
=== WYZ2 ===
 
{{SAMPLE_BOX
 
{{SAMPLE_BOX
 
|name=WYZ2
 
|name=WYZ2
|desc=.
+
|desc=Program showing the use of WYZ Tracker's replayer (version 0.3 47d).
|module1=
+
|module1=wyz/wyz_player2
 
|module2=
 
|module2=
 
|module3=
 
|module3=
Line 708: Line 785:
 
|target=ROM_32K
 
|target=ROM_32K
 
|ext=
 
|ext=
|state=Fonctional
+
|state=Functional
|img=
 
}}
 
 
 
== Targets ==
 
{{SAMPLE_BOX
 
|name=Targets
 
|desc=blablabla...
 
|module1=
 
|module2=
 
|module3=
 
|module4=
 
|module5=
 
|file=s_target.c
 
|machine=MSX1
 
|target=ROM_32K
 
|ext=
 
|state=Fonctional
 
|img=
 
}}
 
 
 
== Template ==
 
 
 
=== Template MSX1 ===
 
{{SAMPLE_BOX
 
|name=Template
 
|desc=blablabla...
 
|module1=
 
|module2=
 
|module3=
 
|module4=
 
|module5=
 
|file=template.c
 
|machine=MSX1
 
|target=ROM_32K
 
|ext=
 
|state=Fonctional
 
|img=
 
}}
 
 
 
=== Template MSX2 ===
 
{{SAMPLE_BOX
 
|name=Template MSX2
 
|desc=blablabla...
 
|module1=
 
|module2=
 
|module3=
 
|module4=
 
|module5=
 
|file=template_msx2.c
 
|machine=MSX2
 
|target=ROM_32K
 
|ext=
 
|state=Fonctional
 
 
|img=
 
|img=
 
}}
 
}}

Latest revision as of 17:47, 18 October 2025

Here is a list of sample programs included with MSXgl to illustrate how to use the library’s various features and functions. To test a sample program, follow these steps:

  1. Open a command-line interface in the MSXgl/projects/samples/ directory.
  2. Run one of the following commands, depending on your operating system:
    • build.bat s_game (Windows)
    • ./build.sh s_game (Linux & macOS)

Replace s_game with the name of the sample you wish to test (there’s no need to include the .c file extension).

Note: Sample programs use a configuration system that overwrites the default project settings (project_config.js) with a sample-specific configuration file (e.g., s_game.js). This approach allows multiple projects to coexist in the same directory without conflicts.

For standalone projects, this step is unnecessary. To learn how to set up your own project from scratch, see this guide.

Core

Hello World

Program showing the minimal code needed to display a "Hello World!" text.
32K

BIOS

Program showing the use of default BIOS functions.
32K

Clock

Program showing the use of the MSX2's Real Time Clock (Ricoh RP-5C01) to get current time and save/load data from CMOS memory.
32K

PSG

Program showing the use of direct control over PSG sound chip.
32K

System

Program showing the retrieval of system information.
  • File: s_sys.c
  • State: ✔️ Functional
32K

Render

Draw

Program showing the use of Draw module with the MSX2 bitmap screen modes.
32K

Graph Mode 3

Program showing the use of Screen 4 (aka Graph mode 3) with various configuration (including unofficial MSX configurations like "Screen 1.5").
32K

Print

Program showing the use of graphical print features (bitmap, sprite, effects, etc.).
32K

Sprite Mode 1

Program showing the use of sprite mode 1 and a Sprite Attribute Table flip method to reduce sprite disappearance.
32K

Sprite Mode 2

Program demonstrating the use of sprite mode 2 (including multi-colors) and split screen using the horizontal interrupt to modify VDP parameters during screen rendering.
32K

Sprite FX

Program showing the use of Sprite Tool module to modify sprite data (support Cropping, Flipping, Asking and Rotating).
32K

Software Sprite

Program showing the use of software sprite for all bitmap modes using VDP commands.
32K

Software Tile

Program showing the use of software tile mode for MSX2 bitmap modes (only Screen 5 & 8 has been tested).
32K

Text

Program showing the use of print module with text modes (all MSX1 and MSX2 text/tiled mode).
32K

VDP Command

Program showing the use of VDP command to draw several effect in all bitmap modes.
32K

Scrolling

Program showing the use of multi-directionnal tile-based scrolling and screen adjust register for smooth scrolling.
32K

Target format

Boot Disk

Program showing the use boot disk target format. The program will be start from disk without going through MSX-DOS but allow to use BDOS function.
BOOT

MSX-DOS

Program showing the use of MSX-DOS 1 routines to load and display image from file.
MSX-DOS

MSX-DOS 2

Program showing the use of various MSX-DOS 2 routines to load and display image, get disk information or handle mapped memory.
MSX-DOS 2

Mapped ROM

Program showing usage of mapped ROM and segments switching.
ASCII8 128K

NEO mapper

Program showing usage of NEO-8 mapped ROM and segments switching.
  • File: s_neo0.c
  • State: ✔️ Functional
NEO8 8M

Utilities

Driver

Program showing the creation of the driver, a code designed to be placed in memory and executed from a main program. Used in #MSX-DOS 2 sample.
  • File: s_drv.c
  • State: ✔️ Functional

BASIC USR

Program showing the creation of binary to be load and used from BASIC.
BIN (USR)

Compressor

Program showing the use of several compression algorithms (RLEp, Bitbuster 1 & 2, ZX0 and Pletter).
MSX-DOS

Game

Program showing the use of Game and Game pawn modules. The Game module offers state management while Game pawn allows to manage characters (display, animation, movement, collision, etc.)
32K

Localize

Demonstration of the localization management module with support for multiple languages and management of different character sets.
32K

Math

Program showing the use of mathematics pre-computed tables, pseudo-random generator and quick-computation functions.
32K

Encryption

Program showing the use of an encoding system to encrypt data. Useful for creating backup codes, for example.
32K

Devices

Joystick

Program showing the use of joystick and input manager.
32K

Keyboard

Program showing the use of keyboard and input manager.
32K

Mouse

Program showing the use of mouse device and universal port (joystick port) device detection.
32K

Ninja Tap

Program showing the use of NinjaTap device to connect up to 8 joysticks on one MSX machine.
32K

ObsoNET

Program showing the use of ObsoNET cartridge using network stack.
16K

PAC

Program showing the use of PAC or FM-PAC to load/save data into SRAM.
32K

V9990

Program showing the use of Yamaha V9990 based video cartridge.
32K

Audio Format

Arkos

Program to demonstrate the use of the different Arkos Tracker (AT2 and AT3) music replayers.
ASCII8 128K

ayFX

Program showing the use of ayFX sound effect replayer (both using a bank or a single sound file).
32K

lVGM

Program showing the use of light-VGM's replayer (PSG).
32K

PCM-Encoder

Program showing the use of the PCM Encoder's replayer (aka. Crystal clean PCM 8bit samples on the poor PSG).
32K

PCM Play

Program showing the use of the PCM Play's replayer.
32K

PT3

Program showing the use of Vortex Tracker II's replayer.
32K

Trilo Tracker SCC

Program showing the use of Trilo Tracker SCC's replayer.
KONAMI 128K

VGM

Program showing the use of VGM's replayer (PSG, SCC, MSX-Music, MSX-Audio).
ASCII16 256K

WYZ

Program showing the use of WYZ Tracker's replayer (version 0.3).
32K

WYZ2

Program showing the use of WYZ Tracker's replayer (version 0.3 47d).
32K