|
libmsx
C library for MSX
|
The libmsx library exposes MSX, MSX2, MSX2+, and MSXturboR hardware functionality to the C programmer.
The library is intended for use with the C cross compiler SDCC, and makes it easy to build MSX ROM cartridge image (16KiB, 32KiB, or MegaROM).
MSX is a registered trademark of MSX Licensing Corporation.
Pull requests (PRs) and issues (bug reports, feature requests) are welcome. 😉
https://user-images.githubusercontent.com/659805/206341437-fcef9dde-8317-4727-ad16-a30b34b1d287.mp4
Copyright (c) 2021-2025 Daishi Mori (mori0091)
This software is released under the MIT License.
See https://github.com/mori0091/libmsx/blob/main/LICENSE
GitHub libmsx project
https://github.com/mori0091/libmsx
A code snippet (gsinit.s) extracted and derived from the SDCC runtime library are available under the GPLv2 license.
See https://github.com/mori0091/libmsx/blob/main/sdcc/README.md.
The API reference of the libmsx library is hosted on GitHub Pages.
See https://mori0091.github.io/libmsx/index.html
The below functionality is supported.
__banked functions support (SDCC 4.2.0 or later)The origins of the ZX0 data compression format and algorithm were designed and implemented by Einar Saukas.
See also https://github.com/einar-saukas/ZX0.
Linux
| Host Platform | SDCC version | status |
|---|---|---|
| Ubuntu 24.04 | 4.4.0 | ✔ (outdated) |
| 4.5.0 | ✔ (recommended) |
Windows
| Host Platform | SDCC version | status |
|---|---|---|
| MSYS2 UCRT64 | 4.4.0 | (not tested) |
| 4.5.0 | (not tested) |
Ofcourse, Ubuntu on WSL2 is okey. 😄
(WSL2: Windows Subsystem for Linux)
SDCC 4.5.0 or later is recommended.
find, make, gcc, gzip, zcat, xsltproc, and so on.To use libmsx,
Download a SDCC pre-built binary for Linux from http://sdcc.sourceforge.net/ and install it.
SDCC 4.5.0 or later is recommended.
Don't forget adding SDCC to PATH environment variable.
Add the below to ~/.bashrc or ~/.bash_profile.
At here it is assuming that the SDCC 4.5.0 is installed under
~/sdcc-4.5.0.
Why don't we install sdcc by
sudo apt install sdcc?Because the latest version of SDCC may not be installed by
apt. In case of Ubuntu 24.04, SDCC 4.2.0 is installed. Thus we recommend that you download SDCC 4.5.0 pre-built binary and use it on Ubuntu 24.04 or later.
The 1st case is using Ubuntu on WSL2 environment.
In this case, it is same as for Ubuntu.
Launch a terminal of Ubuntu on WSL2, and proceed with the above instructions.
The 2nd case is using MSYS2 UCRT64 environment.
Download a SDCC pre-built binary for Windows from http://sdcc.sourceforge.net/ and install it.
Download and install MSYS2.
Then launch a terminal for the MSYS2 UCRT64 environment, and do as follows:
Don't forget adding SDCC to PATH environment variable.
Add the below to ~/.bashrc or ~/.bash_profile, on MSYS2 UCRT64 environment.
At here it is assuming that the SDCC is installed under
C:\Program Files\SDCC.
The below makes the library libmsx.lib into lib folder, and bundled tools into bin folder.
To build sample projects in sample/, do as follows:
And for cleaning up:
There are several sample projects, please refer to the
sample/folder of thelibmsxproject.
Step 1. Make your project's Git repository.
Step 2. Download libmsx and place it somewhere.
Step 3. Copy libmsx/mk/Makefile to top of your repository, and customize it.
See https://github.com/mori0091/libmsx/blob/main/mk/Makefile
Step 4. Create the folder my_proj/src/ and place your C source files under it or in its subfolders.
To build your application, do as follows on the top of your repository my_proj.
Then the ROM image will be made into my_proj/bin folder.
And for cleaning up: