Difference between revisions of "Samples"
From MSX Game Library
(→Localize) |
(→Hello World) |
||
Line 14: | Line 14: | ||
{{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= |
Revision as of 17:19, 18 October 2025
Here is a list of sample programs supplied with MSXgl to demonstrate the use of the library's various functions.
To try out the different samples, simply open a command line in the MSXgl/projects/samples/ directory and execute:
- build.bat s_game (Windows)
- ./build.sh s_game (Linux & macOS)
Replace "s_game" with the name of the sample you want to try out (sample's .c file extension is not needed).
Note: Samples use a system to overwrites the project configuration (project_config.js) with a sample-specific configuration file (e.g. s_game.js). This makes it possible to have several projects in the same directory. This is not necessary for a stand-alone project. See how to create your own new program.
Core
Hello World

Program showing the minimal code needed to display a "Hello World!" text.
- File: s_hello.c
- State: Template:STATE/Functional


BIOS

Program showing the use of default BIOS functions.
- Showcased modules:
- File: s_bios.c
- State: Template:STATE/Functional


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.
- Showcased modules:
- File: s_clock.c
- State: Template:STATE/Functional


PSG

Program showing the use of direct control over PSG sound chip.
- Showcased modules:
- File: s_psg.c
- State: Template:STATE/Functional


System

Program showing the retrieval of system information.
- File: s_sys.c
- State: Template:STATE/Functional


Render
Draw

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


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").
- Showcased modules:
- File: s_gm3.c
- State: Template:STATE/Functional



Program showing the use of graphical print features (bitmap, sprite, effects, etc.).
- Showcased modules:
- File: s_print.c
- State: Template:STATE/Functional


Sprite Mode 1

Program showing the use of sprite mode 1 and a Sprite Attribute Table flip method to reduce sprite disappearance.
- Showcased modules:
- File: s_sm1.c
- State: Template:STATE/Functional


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.
- Showcased modules:
- File: s_sprite.c
- State: Template:STATE/Functional


Sprite FX

Program showing the use of Sprite Tool module to modify sprite data (support Cropping, Flipping, Asking and Rotating).
- Showcased modules:
- File: s_sprtfx.c
- State: Template:STATE/Functional


Software Sprite

Program showing the use of software sprite for all bitmap modes using VDP commands.
- Showcased modules:
- File: s_swsprt.c
- State: Template:STATE/Functional


Software Tile

Program showing the use of software tile mode for MSX2 bitmap modes (only Screen 5 & 8 has been tested).
- Showcased modules:
- File: s_swtile.c
- State: Template:STATE/Functional


Text

Program showing the use of print module with text modes (all MSX1 and MSX2 text/tiled mode).
- Showcased modules:
- File: s_text.c
- State: Template:STATE/Functional



VDP Command

Program showing the use of VDP command to draw several effect in all bitmap modes.
- Showcased modules:
- File: s_vdpcmd.c
- State: Template:STATE/Functional


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.
- Showcased modules:
- File: s_dos0.c
- State: Template:STATE/Partial


MSX-DOS

Program showing the use of MSX-DOS 1 routines to load and display image from file.
- Showcased modules:
- File: s_dos.c
- State: Template:STATE/Functional



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.
- Showcased modules:
- File: s_dos2.c
- State: Template:STATE/Functional


Mapped ROM

Program showing usage of mapped ROM and segments switching.
- File: s_mapper.c
- State: Template:STATE/Functional


NEO mapper

Program showing usage of NEO-8 mapped ROM and segments switching.
- File: s_neo0.c
- State: Template:STATE/Functional


Utilities
BASIC USR

Program showing the creation of binary to be load and used from BASIC.
- Showcased modules:
- File: s_usr.c
- State: Template:STATE/Functional



Compressor

Program showing the use of several compression algorithms (RLEp, Bitbuster 1 & 2, ZX0 and Pletter).
- Showcased modules:
- compress/bitbuster (doc, code)
- compress/bitbuster2 (doc, code)
- compress/lz48 (doc, code)
- compress/pletter (doc, code)
- compress/zx0 (doc, code)
- File: s_zip.c
- State: Template:STATE/Functional


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.)
- Showcased modules:
- File: s_game.c
- State: Template:STATE/Functional


Localize

Demonstration of the localization management module with support for multiple languages and management of different character sets.
- Showcased modules:
- File: s_loc.c
- State: Template:STATE/Functional


Math

Program showing the use of mathematics pre-computed tables, pseudo-random generator and quick-computation functions.
- Showcased modules:
- File: s_math.c
- State: Template:STATE/Functional


Scrolling

Program showing the use of multi-directionnal tile-based scrolling and screen adjust register for smooth scrolling.
- Showcased modules:
- File: s_scroll.c
- State: Template:STATE/Functional


Devices
Joystick

Program showing the use of joystick and input manager.
- Showcased modules:
- File: s_joystk.c
- State: Template:STATE/Functional


Keyboard

Program showing the use of keyboard and input manager.
- Showcased modules:
- File: s_keybrd.c
- State: Template:STATE/Functional


Mouse

Program showing the use of mouse device and universal port (joystick port) device detection.
- Showcased modules:
- File: s_mouse.c
- State: Template:STATE/Functional


Ninja Tap

Program showing the use of NinjaTap device to connect up to 8 joysticks on one MSX machine.
- Showcased modules:
- File: s_ntap.c
- State: Template:STATE/Functional



ObsoNET

Program showing the use of ObsoNET cartridge using network stack.
- Showcased modules:
- File: s_onet.c
- State: Template:STATE/Partial


PAC

Program showing the use of PAC or FM-PAC to load/save data into SRAM.
- Showcased modules:
- device/pac (doc, code)
- File: s_pac.c
- State: Template:STATE/Functional



V9990

Program showing the use of Yamaha V9990 based video cartridge.
- Showcased modules:
- File: s_v9990.c
- State: Template:STATE/Functional



Audio Format
Arkos

Program showing the use of Arkos Tracker II's replayers.
- Showcased modules:
- File: s_arkos.c
- State: Template:STATE/Functional


ayFX

Program showing the use of ayFX's replayer.
- Showcased modules:
- File: s_ayfx.c
- State: Template:STATE/Functional


lVGM

Program showing the use of light-VGM's replayer (PSG).
- Showcased modules:
- File: s_lvgm.c
- State: Template:STATE/Functional


PCM-Encoder

Program showing the use of the PCM Encoder's replayer (aka. Crystal clean PCM 8bit samples on the poor PSG).
- Showcased modules:
- pcm/pcmenc (doc, code)
- File: s_pcmenc.c
- State: Template:STATE/Functional


PCM Play

Program showing the use of the PCM Play's replayer.
- Showcased modules:
- pcm/pcmplay (doc, code)
- File: s_pcmplay.c
- State: Template:STATE/Functional


PT3

Program showing the use of Vortex Tracker II's replayer.
- Showcased modules:
- File: s_pt3.c
- State: Template:STATE/Functional


Trilo Tracker SCC

Program showing the use of Trilo Tracker SCC's replayer.
- Showcased modules:
- File: s_trilo.c
- State: Template:STATE/Functional



VGM

Program showing the use of VGM's replayer (PSG, SCC, MSX-Music, MSX-Audio).
- Showcased modules:
- File: s_vgm.c
- State: Template:STATE/Functional





WYZ

Program showing the use of WYZ Tracker's replayer (version 0.3).
- Showcased modules:
- File: s_wyz.c
- State: Template:STATE/Functional


WYZ2

Program showing the use of WYZ Tracker's replayer (version 0.3 47d).
- Showcased modules:
- File: s_wyz2.c
- State: Template:STATE/Functional

