Blog

Relearning MSX #9: Setting up the MSX-C environment (part 5)

Posted by in How-to, MSX, Retro | January 06, 2015

In this post we’ll add the MSX-C Library package to our MSX-C environment. Setting it up is trivial because it only involves copying a few files, as was the case of installing MSX-DOS2 TOOLS.

Let’s start.

What’s MSX-C Library?

msx_magazine_1988-08_msx-dos2_ad

MSX-DOS2 and MSX PDT series ad. MSX Magazine (August 1988). Click to enlarge

MSX-C Library is a collection of C source files and libraries that extend the capabilities of MSX-C v1.1/v1.2. It adds support for a lot of stuff:

  • 32-bit and 64-bit numeric types, modifies some of the standard library functions to support them, including the printf() and scanf() groups of functions
  • Support for the MSX graphics processor (VDP) including drawing on the screen, graphic block operatings, data transfer to/from the video memory, and handling sprites
  • Functions to work with joysticks, cursor keys, triggers, mice and printer
  • A subset of the curses library called MSX-CURSES, to create menus and windows in text-based applications

As you can guess, it’s going to be quite useful.

One thing to note is that, unlike the other software packages in the MSX PDT series (MSX-C, MSX-DOS TOOLS, MSX-S BUG), there isn’t a version especific for MSX-DOS2. The same MSX-C Library package works with both MSX-C v1.1 and v1.2.

Obtaining MSX-C Library

Obviously ASCII isn’t selling it anymore, but it can be found from time to time in auction sites. However, it’s unlikely that you’ll see one anytime soon, so better go grab the disk image from The MSX Archive:

MSX-C_Library.zip (90 KB)

As always, extract the ZIP file and write the image to a floppy disk (if you’re using a real MSX), or copy it to your Disks folder if you’re using openMSX.

Disk contents

MSX-C Library was available before MSX-DOS2, so the disk contents aren’t organized in directories. Everything is in the top directory of the disk:

MSX-C_Library_disk_contents

Contents of the MSX-C Library disk

There are several C header files:

  • glib.h : graphic functions
  • math.h : Math-Pack functions
  • msxbios.h : MSX-BIOS headers
  • curses.h : MSX-CURSES headers

Also, there are five .REL files with their corresponding .TCO companions, named the same as the C header files (glib, math, msxbios and curses). The extra one (mlib.rel / mlib.tco) is contains the other four combined. We will need all of them for reasons that we’ll see later.

The remaining files are the sources for everything, some in C and some in Z80 assembler, plus three example programs (den, show and gcal).

Installation

Not much to see here. Just copy each kind of file to drive B: under the appropriaate directory:

COPY F:¥*.H B:¥INCLUDE
COPY F:¥*.REL B:¥LIB
COPY F:¥*.TCO B:¥LIB

MSX-C_Library_install

Copying the MSX-C Libray files to the B: drive

That’s it, all done. It wasn’t that complicated, right?

In the next post…

We can’t code if we don’t know how to use the text editor, so that’s what we’ll see next. I’ll explain how to use the KID/AKID text editors so we can proceed to prepare a batch file to compile our programs for us, instead of having to type all those annoying commands.


This series of articles is supported by your donations. If you’re willing and able to donate, please visit the link below to register a small pledge. Every little amount helps.

Javi Lavandeira’s Patreon page

4 comments on “Relearning MSX #9: Setting up the MSX-C environment (part 5)

    • Neither the MSX-C standard library nor the MSX-C Library package come with time or date functions. However, you can use the bdos() and call()/callx() functions to access MSX-DOS(2)’s time and date functions.

  1. Hello Javi,

    I’m a (very) old MSX user and (currently) game developer. I’ve bought a Philips NMS 8255 recently and I’m trying to develop a game in C. Your tutorial is very useful. Thanks a lot!

    I’m having troubles trying to set screen to mode 5. My code is:

    #include
    #include

    main() {
    ginit();
    screen(5);

    while (!kbhit())
    }

    but my MSX won’t quit from text mode and show me a nice screen mode.

    Any suggestion?

    PD: Saludos desde la soleada España

Leave a Reply

Your email address will not be published. Required fields are marked *


Warning: Illegal string offset 'share_counts' in /www/javi_lavandeira/lavandeira.net/ftproot/htdocs/wp-content/plugins/simple-social-buttons/simple-social-buttons.php on line 477