Pascal and MSX

Pascal compilers for the MSX

The Pascal language was named for Blaise Pascal (see picture), a French mathematician who was a pioneer in computer development history. In 1641, at the age of eighteen, Pascal constructed the first arithmetical machine, arguably the first computer. He would improve upon the instrument eight years later. In 1650, Pascal left the world of geometry and physics, and shifted his focus towards religious studies, or, as Pascal wrote, to “contemplate the greatness and the misery of man.” Pascal died in Paris on August 19, 1662.

Niklaus Wirth completed development of the original Pascal programming language in 1970. He based it upon the block structured style of the Algol programming language. There were two original goals for Pascal. According to the Pascal Standard (ISO 7185), these goals were to a) make available a language suitable for teaching programming as a systematic discipline based on fundamental concepts clearly and naturally reflected by the language, and b) to define a language whose implementations could be both reliable and efficient on then-available computers.

Pascal was used in the seventies and eighties as the computer language in programming education. It served as the main programming language to teach structured programming.Many compilers were available for all current platforms these days. The language itself is a standard now (ANSI) but also served as model used by Wirth for more advanced (modular) languages such as Modula and Oberon.

Borland produced Turbo Pascal both for CP/M and MS-DOS, version 3 was a huge success and much of the software in the eighties on small computers is written with Turbo Pascal. Alas it was not standard Pascal, instead very practical adapted to the CP/M and MS-DOS environment.
Version 3 was the last version for CP/M, on the PC many versions followed (Borland Pascal 7 was the last DOS-based) and eventually evolved to Delphi (Windows) and Kylix (Linux), and lives on in Freepascal and Lazarus with ObjectPascal. The Pascal version for MSX is much closer to the original procedural Pascal defined by Wirth.

Read this great introduction how to write GOOD programs!

Turbo Pascal may not be the only Pascal compiler running on MSX, it is the best supported one.

The untouched and not installed version(see the Pascal course in MCCM part 1!):
Turbo Pascal 3.01 for CP/M

A version of Turbo Pascal was distributed by Philips. In the package you find:

  • Turbo Pascal 8 bits MSX This version was a real Borland product, as you can see on the floppy label.
  • A book by Jeff Dunteman with demo disk “Turbo Pascal Compleet”,
No picture

Manual, Front and Back Cover

Below are scanned images of the front and back covers of the Turbo Pascal 3 manual. Back in those days the manual was the product. The floppy disk placed inside the manual cover along with the license agreement, invitation to join on CompuServe forums and other paper marketing pieces. Click on each image to display a larger version of each cover.
The manual of Turbo Pascal 3.0 (MS-DOS, CP/M-86 and CP/M/MSX-DOS) is also available, thanks to Fred Kraan

A patched and installed version
MSX-2 version of Turbo Pascal 3

Made by MCE aka Frits Hilderink including the GIOS and a PC version!
This is the official distribution placed here with permission of Frits Hilderink!
Turbo Pascal 3.3f

Slotman has made an IDE for Turbo Pascal 3.3 running on the PC (Windows). MSXPAD. You can find it here, manual is here.

And  it comes with all include files  used to make SnowFighter!

Turbo Pascal DataBASE Toolkit 1.2 , official add-on by Borland

For MS-DOS with debugger (handy crosscompiling!)
Turbo Pascal 3.01 for the PC

Untouched (and now freeware!)
Turbo Pascal 3.02 for the PC

Another Pascal compiler: Hisoft Pascal 80

Pascal development environments

Turbo Pascal out of the box is not able to use the MSX facilities. Other than MSX-Basic there are no instructions to do more than text output.

Luckily it is not too difficult to give access to all MSX secrets with socalled include files containing pieces of machinecode as INLINE statements.

Here a rich collection of powerful environments is given that allow you to do anything possible on a MSX with easy to write and understand Pascal programs.

Martijn Dekker, the author of the Turbo Pascal package MDL-LIB has given permission to publish the latest and greatest version 2.2 and declared it public domain.
Some of the enhancements are:
– .typ-, .var- and .con- filesbestanden (type-, variable- and constant declarations) are integrated in the .lib- files, avoids many includes.
– works with turbo Pascal 3.3

See the leesmij.txt in the archive MDL-LIB v2.2

Slotman has made an IDE MSXPAD for Turbo Pascal 3.3 running on the PC (Windows). You can find it here, manual is here.
Included are include files for developing games in Pascal! The very funny game Snow fighters in the Our games section (throwing snowballs) is interesting for the MSX Info pages since he included the sources in Turbo Pascal.

HansO Pascal programs

Pascal source with examples of filter programs: while copying a text file make adjustments like stripping to 7 bits or adding/removing text.

Pascal source by me of two programs: split (makes two halves of a file) and combine (glue the two halves together again) for MSX-DOS and CP/M.

CNVS and MSX12CNV

I have written programs to convert the MSX graphical screen formats back and forth to the PC.
When i wrote them it was the dark age of MS-DOS, so i used Turbo Pascal and as graphical file format PCX. It still works, even under Windows 95/98. And I finally finished MSXCNV12 to convert to screen 12 in may 1999 after working on it for 8 years!

Paintshop Pro is highly recommended to manipulate the graphics on the PC.

All sources are included. All programs are freeware. MS-DOS programs!

CNVS version 2.3 : MS-DOS program to convert MSX screen 0-8 to PCX and back including sources

This 2.3 version is a recent update (june 1999), is now in English and with a cleaner syntax.

CNVS version 2.1 : old MS-DOS program to convert MSX screen 0-8 to PCX and back in dutch only.

MSX12CNV: MS-DOS program to show or convert MSX screen 12 (in full color)

MSXCNV12: MS-DOS program to show or convert PCX on the PC to MSX screen 12 (in full color)

Quickbasic program to convert RAW file (create with Paintshop PRO) to screen 12 full color by Hans Schoormans

On request: a Windows 95/98 program to convert MSX screens to and from PCX
(actually a wrap around CNVS, MSX12CNV and MSXCNV12)

CNVSW as Windows installable program. Note the readme.txt.

PCX format description the official guide how PCX is done

INDEX

INDEX: MSX and MS-DOS programs to build a database of files on your floppies with Pascal sources

My MSX pascal include libraries

To write intelligent programs on MSX I used Turbo Pascal v3.00.

To access the MSX 1 and 2 facilities I developed Pascal libraries a long time ago. Many followers copied and enhanced those libraries but here are the original: complete with tools.
In it are functions like line, box, circle, fill figure, sprite, show text on graphics and so on

Pascal include libraries

Pascal articles

Programming in Turbo Pascal, after Basic and assembler, has been the preferred programming environment for many. Much faster in execution than Basic, much faster in development than assembler.
The magazines have paid attention to this environment with many articles, collected as far as available, here.

MSX C manual

Preface
Better C than never.
Freddy Vulto

Introduction

MSX-C offers a complete package to let you develop C programs using MSX-DOS. Unlike Small C, Hisoft C or BDS C, MSX-C comes with pre-made MSX libraries. Using MSX-C, you’re able to fully combine machine code speed with the ease of a high level programming language on a MSX. Please take my advice: “Get yourself some trunks and jump into C!”
Thanks to standardisation and the excellent work of the ASCII Corporation it is possible to learn C with almost any C manual. For a full survey however, I would recommend “The C programming language” of Brian W. Kernighan and Dennis M.Ritchie. These two are the founders of C, so – believe me – they know what they’re talking about.
Books offering “C++” on the other hand, you’d better not buy, cause this extension of C hasn’t been implemented on the MSX.
The MSX-C package consists of 2 parts:

1. MSX-C Compiler Disk
2. MSX-C Library System Disk

The Compiler Disk contains the necessary programs to compile a standard C program. The Library System Disk contains functions which make use of specific MSX functionality.
Before you can use MSX-C, you have to make a so called MSX-C Library System Disk. This disk will contain all files you need to compile a C program. You can either create the MSX-C Library System Disk yourself by COPY ing, or you can use the batch file MKSYS.BAT . Copy MKSYS to the destination disk, change to this disk and command:

MKSYS <drive>

The batch file now will take care of copying files from ‘drive’ to the destination disk, asking you questions on the fly.
A C source file can be written using an arbitrary text editor (for example TED), as long as you give the file a ‘.C’ extension. Next, the source file can be turned into a fully executable machine code program, using a number of compilation steps. These steps are the heart of MSX-C as shown in the underneath figure:
Table 1: MSX-C Compile Steps

                        |.C ......C source file
                        |
                  Parser (CF.COM)
                        |
                        |.TCO ....T-code file
                        |
(Function Parameter Checker (FPC.COM))
                        |
         Code Generator (CG.COM)
                        |
                        |.MAC ....Assembler file
                        |
          Macro Assembler (M80.COM)
                        |
                        |.REL ....Relocatable machinecode file
                        |
                Linker (L80.COM)
                        |
                        |.COM ....Command file

The commands to execute these subsequent steps are coded in a batch file C.BAT , so compiling a C source file – e.g. TEST.C – can be as easy as typing:

C TEST

If one wants to use specific MSX functions besides standard C functions, TEST.C must be compiled using the batch file MSXC.BAT:

MSXC TEST [CF options] [CG options]

As the fairly huge compilation process uses quite some time, it is best to use a 7 MHz MSX with considerable memory (512K), so the whole process can run on a RAMdisk. Only if you’re going to use MSX-C v1.20, you’ll need MSX-DOS 2.20.
The MSX-C Compiler Disk contains the ASCII MSX-C Compiler. The compiler is made out of CF.COM , CG.COM , FPC.COM and MX.COM (for descriptions, see below). Furthermore, there is a standard library, fully equiped with source and batchfiles to let you modify this library. M80.COM , L80.COM and LIB80.COM are not on the disk and will have to be taken from a MSX-DOS(2) Tools Disk.
MSX-C uses the next ‘library’ files:

  • CK.REL: Standard ‘ultra main’ program
  • CLIB.REL: MSX-C library
  • CRUN.REL: MSX-C library
  • CEND.REL: Standard ‘end’ program

The files CK.REL and CEND.REL will always be included in the resulting executable, CK.REL at the head and CEND.REL at the tail, so they’re not really library files. The source of both these relocatables can be found in CK.MAC and CEND.MAC respectively
CLIB.REL and CRUN.REL on the other hand, are made out of functions which are included in the resulting executable only if these functions are actually called in your program.
CLIB.REL is the actual library. All the functions defined within this relocatable file, can be found also within the available library source files. MSX-C version 1.10 however, makes use of other source files than MSX-C version 1.20.
CRUN.REL contains routines to load and save ‘automatic’ variables. Also there are a number of 8 and 16 bits arithmetic functions, such as multiply, divide, shift and compare. These functions are supposed to be used internal only. Sources of these functions can be found in CRUN.MAC .
As compilation involves many steps, you’re better off using the supplied batch files:

  • C.BAT : To compile a standaad C program
  • GENLIB.BAT : Generate a library

With help of C.BAT the C source file can be compiled to .COM file. The C function calls can be checked using FPC.COM , which uses LIB.TCO . GENLIB.BAT will trigger a complete batch-cyclus, recompiling the entire standard library.
The remaining files on the MSX-C Compiler Disk are useful examples of what you’re able to do with the C programming language. The program Q.COM can be generated using MKQ.BAT . This file is made out of Q.C , RND.MAC , LINE.MAC , COLOR.MAC and CALBIO.MAC .
There are different versions of the MSX-C compiler. The list below shows these versions, along with their main characteristics:

  • version 1.00, Oct-83: CP/M, usage of 8088 (the predecessor of the Z80) op-code.
  • version 1.10, Jun-87: MSX, usage of Z80 op-code.
  • version 1.20, Aug-88: Suites MSX-DOS 2.20. Compared to v1.10 the library- and headerfunctions has been rearranged.

Version 1.20 is totally based upon MSX-DOS 2.20. A program which is compiled using MSX-C v1.20 will automatically generate an error message if MSX-DOS 2.20 isn’t available. So if you want to write a program which only needs MSX-DOS 1, you’ll have to use MSX-C v1.10.
Compiler Disk v1.10
Table 2: Contents Compiler Disk v1.10

-------------------------------------------------------------------
                 PRIMARY FILES      SUPPORT FILES      SOURCE FILES
-------------------------------------------------------------------
SYSTEM:          cf.com
                 cg.com
                 fpc.com. . . . . . lib.tco
                 mx.com . . . . . . arel.bat
                                    crel.bat
LIBRARY FILES:   ck.rel . . . . . . . . . . . . . . . .ck.mac
                 clib.rel . . . . . . . . . . . . . . .lib0.mac
                                                       lib1.c
                                                       lib2.c
                                                       lib3.c
                                                       libk.c
                 crun.rel . . . . . . . . . . . . . . .crun.mac
                 cend.rel . . . . . . . . . . . . . . .cend.mac
HEADER FILES:    stdio.h
                 bdosfunc.h
BATCH FILES:     c.bat
                 mksys.bat
                 forremk.bat
                 genlib.bat . . . . genlib01.bat
                 genlib02.bat
                 genlib03.bat
                 genlib04.bat
                 genlib05.bat
                 genlib06.bat
SAMPLE FILES:    q.c. . . . . . . . mkq.bat . . . . . .rnd.mac
                                                       line.mac
                                                       color.mac
                                                       calbio.mac
-------------------------------------------------------------------

System
The MSX-C Compiler Disk v1.10 contains almost the same files as the MSX-C Compiler Disk v1.20. See the next chapter: Compiler Disk v1.20 for a full description of the system files and the functions.

Standard Library

The table below gives an overview of all the functions which are available through the standard library of MSX-C v1.10. At the end of every function you can see in which sourcefile and which header file the function definition can be found.

Table 3: Functions in Standard Library v1.10

Name Declaration SourceFile HeaderFile
abs int abs(n) lib1.c stdio.h
alloc char *alloc(nbytes) lib1.c stdio.h
atoi int atoi(s) lib1.c stdio.h
bios char bios(bios_code, c) lib0.mac bdosfunc.h
bdos char bdos(c, de, hl) lib0.mac bdosfunc.h
bdosh int bdosh(c, de, hl) lib0.mac bdosfunc.h
call int call(addr, a, hl, bc, de) lib0.mac stdio.h
calla char calla(addr, a, hl, bc, de) lib0.mac stdio.h
close STATUS close(fd) lib2.c stdio.h
creat FD creat(filename) lib2.c stdio.h
execl VOID execl(nargs, progname, args) libk.c stdio.h
execv VOID execv(progname, argv) libk.c stdio.h
exit VOID exit(code) libk.c stdio.h
expargs int expargs(argc, argv, maxargc, xargv) lib2.c stdio.h
fclose STATUS fclose(fp) lib2.c stdio.h
fgets char *fgets(s, n, fp) lib2.c stdio.h
fopen FILE *fopen(nargs, xfn, xmode, xbsiz) lib2.c stdio.h
fprintf STATUS fprintf(nargs, iobuf, format) lib3.c stdio.h
fputs STATUS fputs(s, fp) lib2.c stdio.h
free void free(ap) lib1.c stdio.h
fscanf int fscanf(nargs, iobuf, format) lib3.c stdio.h
fsettext STATUS fsettext(fp) lib2.c stdio.h
fsetbin STATUS fsetbin(fp) lib2.c stdio.h
getc int getc(fp) lib2.c stdio.h
getch char getch() lib2.c stdio.h
getchar int getchar() lib2.c stdio.h
getche char getche() lib2.c stdio.h
gets char *gets(s, n) lib2.c stdio.h
inp char inp(port) lib0.mac stdio.h
isalpha int isalpha(c) stdio.h stdio.h
iscntrl int iscntrl(c) stdio.h stdio.h
isdigit int isdigit(c) stdio.h stdio.h
islower int islower(c) stdio.h stdio.h
isspace int isspace(c) stdio.h stdio.h
isupper int isupper(c) stdio.h stdio.h
kbhit BOOL kbhit() lib2.c stdio.h
longjmp void longjmp(env, val) lib0.mac stdio.h
max int max(x, y) lib1.c stdio.h
memcpy void memcpy(dest, source, count) lib0.mac stdio.h
memset void memset(dest, byte, count) lib0.mac stdio.h
min int min(x, y) lib1.c stdio.h
movmem void movmem(source, dest, count) lib0.mac stdio.h
open STATUS open(filename, mode) lib2.c stdio.h
outp void outp(port, val) lib0.mac stdio.h
printf STATUS printf(nargs, format) lib3.c stdio.h
putc STATUS putc(c, fp) lib2.c stdio.h
putchar STATUS putchar(c) lib2.c stdio.h
puts STATUS puts(s) lib2.c stdio.h
qsort void qsort(base, n, width, compar) lib1.c stdio.h
read int read(fd, buf, n) lib2.c stdio.h
rename STATUS rename(oldname, newname) lib2.c stdio.h
rsvstk void rsvstk(n) lib1.c stdio.h
sbrk char *sbrk(n) lib1.c stdio.h
scanf int scanf(nargs, format) lib3.c stdio.h
sensebrk VOID sensebrk() lib2.c stdio.h
setjmp VOID setjmp(env) lib0.mac stdio.h
setmem VOID setmem(dest, byte, count) lib0.mac stdio.h
sprintf VOID sprintf(nargs, buffer, format) lib3.c stdio.h
sscanf int sscanf(nargs, line, format) lib3.c stdio.h
strcat char *strcat(d, s) lib1.c stdio.h
strcmp int strcmp(s, t) lib1.c stdio.h
strcpy char *strcpy(d, s) lib1.c stdio.h
strlen size_t strlen(s) lib1.c stdio.h
tolower char tolower(c) lib1.c stdio.h
toupper char toupper(c) lib1.c stdio.h
ungetc STATUS ungetc(c, fp) lib2.c stdio.h
ungetch VOID ungetch(c) lib2.c stdio.h
unlink STATUS unlink(filename) lib2.c stdio.h
write int write(fd, buf, n) lib2.c stdio.h

Compiler Disk v1.20
Table 4: Contents Compiler Disk v1.20

-------------------------------------------------------------------
                 PRIMARY FILES      SUPPORT FILES      SOURCE FILES
                 --------------------------------------------------
SYSTEM:          cf.com
                 cg.com
                 fpc.com. . . . . . lib.tco
                 mx.com . . . . . . arel.bat
                                    crel.bat

LIBRARY FILES: ck.rel . . . . . . . . . . . . . . . .ck.mac
clib.rel . . . . . . . . . . . . . . .clibc.c
clibmac.mac
direct.c
io.c
malloc.c
process.c
stdio.c
stdlib.c
string.c
crun.rel . . . . . . . . . . . . . . .crun.mac
cend.rel . . . . . . . . . . . . . . .cend.mac

HEADER FILES: stdio.h
bdosfunc.h
conio.h
ctype.h
direct.h
io.h
malloc.h
memory.h
process.h
setjmp.h
stdlib.h
string.h
type.h

BATCH FILES: c.bat
mksys.bat
forremk.bat
genlib.bat . . . . genliba.bat
genlibc.bat
genrel.bat
gentco.bat

SAMPLE FILES: q.c. . . . . . . . mkq.bat . . . . . .rnd.mac
line.mac
color.mac
calbio.mac
search.c . . . . . search.bat. . . . .bk.mac
wc.c
head.c
rom1.c . . . . . . . . . . . . . . . .rom0.mac
——————————————————————-

System
CF.COM
CF is the parser. CF will convert a C file to a so-called T-code (temporary code) file with extension ‘.TCO’. This TCO file contains the C file code, encoded in ASCII tokens. Comments are removed. The T-code file serves as input for the next compilation step using ‘CG.COM’. Also, the T-code file is used by FPC to check if function calls are valid. Giving the ‘CF’ command from the DOS-prompt gives:

    MSX-C ver 1.20p   (parser)
    Copyright (C) 1989 by ASCII Corporation
    Usage: cf [options] filename
    options available:
            -c             disables comment nesting
            -e[filename]   makes diagnostic file
            -f             enables implicit function and parameter declaration
            -t             enables implicit pointer convertion
            -j             enables kanji code literal
            -m             displays memory usage statistics
            -o[filename]   makes T-code file
            -rP:S:H        allocate tables in ratio P:S:H (Pool:Symbol table:Hash)
            -s             continues submit even if errors are detected

CF supposes the ‘filename’ to have the ‘.C’ extension, so this extension shouldn’t be given by the user. For example to let CF handle the file FRED.C:

CF FRED

The inner workings of CF can be affected by the following switches:
-c : ‘disable comment nesting’
Using this switch, it isn’t allowed to nest comments. For example the next comment won’t be allowed:

/* /* Commentaar…commentaar…
…commentaar */ */

The original definition of C doesn’t allow comment nesting. Still, this nesting can come in handy if you temporarily want to disable large portions of code by putting a ‘/*’ at the begin and a ‘*/’ at the end of code.
-e[X] : ‘makes diagnostic file on drive X’
Allows the user to create a diagnostic file with extension ‘.DIA’ on drive ‘X’. This causes the output of CG to be directed to the DIA file instead of the screen. This option may be useful to collect error messages.
-f : ‘enables implicit function and parameter declaration’
This switch allows for functions which do not have to be declared explicit. Common practice however, is to declare functions explicit always. So it would be better if you do not use this switch.
-t : ‘enables implicit pointer conversion’
This switch allows for pointer conversions to take place automatically contrary to ‘type casting’. Again, common practice is to use explicit conversion.
-j : ‘enables kanji code literal’
Something with kanji (?). This option isn’t available at MSX-C v1.10.
-m : ‘displays memory usage statistics’
Displays information about the memory usage of the 3 internal tables of CF. The size of each table can be influenced using the ‘-r’ switch.
-o[filename] : ‘makes T-code file’
Creates a specific T-code file. At MSX-C v1.10 it is only possible to define another drive.
-rP:S:H : ‘allocates tables in ratio Pool/Symbol_table/Hash’
Allows the user to change the ratio of the 3 internal tables of CF. For example: ‘-r3:1:2’. See also ‘-m’.
-s : ‘continues submit even if errors are detected’
Allows CF to continue even though there have been detected errors.
Most of the switches are allowed to concatenate to one string, preceded by a single ‘-‘. This doesn’t work for all switches however: you’ll have to try for yourself.
E.g.: Treat the file FRED.C by CF, creating the files FRED.TCO and FRED.DIA on drive B:, do not enable nested comments and display memory statistics:

CF -coBm -eB FRED

CG.COM
CG is the Code Generator. CG converts the T-code file to a file with extension ‘.MAC’. This MAC file contains the compiled C code as plain readable ASCII mnemonics! Via the Macro Assembler M80 this file can be compiled. Typing ‘CG’ from the DOS-prompt gives:

MSX-C ver 1.20p (code generator)
Copyright (C) 1989 by ASCII Corporation
Usage: cg [-rNkulo<filename>] filename

CF assumes the ‘filename’ to have the ‘.TCO’ extension, so this extension shouldn’t be given by the user. During compilation, CG will prompt each function being compiled. The progress of the compilation is being indicated after the function name by successively a dot for each compiled jump or loop, a colon for each declared variable and a semicolon at the end. The following switches can be used:
-rN:
Changes the default size of the symbol table by specifying a number N. If CG ends preliminary because of the symbol table being too small, CG will advice the new size for the symbol table.
-k:
Kills the TCO files which served as input, after the compilation process has completed.
-u:
Doesn’t show the progress indicators (…::;).
-l:
(??) The only difference I’ve seen using this switch, is the placement of a ‘@’ after the ‘printf’ label in the MAC file.
-o<filename>:
Sends the output (MAC) file to the specified file.
Example: Process the file FRED.TCO by CG, putting FRED.MAC on drive B, changing the size of the symbol table to 2000 and delete the file FRED.TCO afterwards:

CG -oBr2000k FRED

FPC.COM
FPC is short for Function Parameter Checker. FPC checks the validity of the function calls of your C program; it checks whether the parameters of your function call are of the right type (int, char) and if the number of parameters equals the function definition. This check may save you a lot of time.
To do all this, FPC uses a special form of the T-code file in which only the function headers are incorporated; I name them ‘header T-code files’. These files can be created by FPC itself. MSX-C delivers two of these files ‘of the shelve’:

LIB.TCO : LIB0, LIB1, LIB2, LIB3, LIBK
MLIB.TCO : CURSES, GLIB, MSXBIOS, MATH

Typing ‘FPC’ from the DOS-prompt gives:

MSX-C function parameter checker ver 1.20p
Usage: fpc [-istu] [-c outputfile] [-d func[,func…]] inputfile(s)

With switch ‘ -c outputfile ‘ it is possible to generate a ‘header T-code file’. The use of the other switches aren’t clear to me. Some examples:

FPC fred mlib lib

This command will check all function calls which are made in FRED.C. To perform this check, we tell FPC to make use of MLIB.TCO and LIB.TCO.

FPC -c lib lib0 lib1 lib2 lib3 libk

This command will create a ‘header T-code file’ named LIB.TCO. This file will contain header information of all functions of the LIB0, LIB1, LIB2, LIB3 and LIBK libraries. FPC will use the T-code files of these libraries.
MX.COM
MX is short for the Module Extracting Utility. With use of MX it is possible to generate a library which consists of relocatable modules. MX splits the argument file into separate modules. These modules have to be compiled to separate REL-files (using M80.COM), whereafter LIB80.COM has to link the REL-files to the eventual library. To simplify this process, MX offers the ability to generate batch file commands in which the compile and link commands are incorporated. Typing ‘MX’ after the DOS-prompt shows:

   MSX-C module extracting utility ver 1.20p
   Usage: mx [options] filename [module list]
       options:
          -l          generates batch to make library file
          -o[path\]   makes output files on directory
          -uX         replaces every underscore(_) character to X

The argument ‘filename’ may have either the .MAC or .TCO extension. MX will check for both extensions and attach the appropriate extension to the filename. If both <filename.MAC> and <filename.TCO> are present, the .MAC file will take precedence. The extracted modules will be placed on disk with their modulename as filename and the same extension as the source file (TCO or MAC). Existing files will be overwritten, so take care! It is also possible to define a ‘module list’ which consists of modulenames separated by spaces. If specified, only these modules will be extracted. If not specified, all modules will be extracted.
-l : ‘generates batch to make library file’
Generates output with batch commands in order to compile and link all extracted modules. To use this output, it has to be redirected using the ‘>’ command to redirect the output to a batch file. MX uses two batchfiles to generate the batch commands: AREL.BAT for MAC files and CREL.BAT for T-code files. Sloppy however are the first and last line of the batch file which are not understood by DOS thus generating two error messages.
-o[path\] : ‘makes output files on directory’
Sends the output files to the specified directory. At MSX-C v1.10 only the drive can be specified.
-uX : ‘replaces every underscore(_) character to X’
Replaces every occurrence of the underscore character ‘_’ in a modulename with the specified character ‘X’. For example:

MX -loB crun > temp.bat

This command will extract all modules from the file CRUN.MAC and save each modulename as modulename.MAC on drive B:. The output of MX will be redirected to the file TEMP.BAT, so if you would command:

TEMP

all the extracted modules would be compiled and linked to the library CRUN.LIB. If you finally would like to use library with L80, the library should be renamed manually to CRUN.REL. Another example:

MX -loB crun lauhl laut1 > temp.bat

This command will extract only modules ‘lauhl’ and ‘laut1’ as compared to all modules in the previous example.
Also a warning: take care your source-file does not contain a module with the same name as your source-file, otherwise the extracted module will overwrite you source-file!
M80.COM
The macro-assembler M80 which comes with MSX-C v1.20 has been modified to be able to deal with subdirectories. This version of M80 is known as:

MSX.M-80 2.00

This version of M80 will also put todays date in the header of each page, whereas M80 v1.00 would put its release-date (01-Apr-85) at the top. Fortunately, M80 has some very descent documentation of its own 🙂
L80.COM
The linker L80 which comes with MSX-C v1.20 also has been modified to be able to deal with subdirectories. This version is knows as:

MSX.L-80 2.00 03-Apr-89 Copyright (c) 1989 Microsoft

This linker also has its own documentation, so I will pass here.
Standard Library
Version 1.20 of the standard library makes full use of MSX-DOS 2. A program created using the Standard Library v1.20, will not execute with MSX-DOS 1; the MSX-C program will automatically check the MSX-DOS version number and generate an error message if the version number is below 2.xx.
The Standard Library consists of the following parts:

   CK.MAC        MSX-C Ultra Main Program (Ver 1.2)
   CLIBMAC.MAC   MSX-C Standard Library Assembler Part (Ver 1.2)
   CRUN.MAC      MSX-C Run Time Library (Ver 1.2)
   CEND.MAC      MSX-C Standard Trailer File (Ver 1.2)
   DIRECT.C      Directory Manipulate Functions
   IO.C          Low Level Input/Ouput Functions
   MALLOC.C      Storage Management Functions
   PROCESS.C     Process Control Functions
   STDIO.C       Buffered Input/Output Functions
   STDLIB.C      Standard Library
   STRING.C      String Manipulate Functions

All source files (except CK.MAC, CRUN.MAC and CEND.MAC) are compiled and linked into the relocatable library file CLIB.REL. The following header files are present:

   BDOSFUNC.H   MSX-DOS Function Call Support
   CONIO.H      Console and I/O Port Functions
   CTYPE.H      Character Type Header
   DIRECT.H     Directory Manipulation Functions
   IO.H         Low Level File Input/Output Functions
   MALLOC.H     Storage Management Functions
   MEMORY.H     Memory Manipulate Functions
   PROCESS.H    Process Control Functions
   SETJMP.H     Longjmp Support
   STDIO.H      Buffered Input/Output Functions
   STDLIB.H     Standard Library
   STRING.H     String Manipulate Functions
   TYPE.H       Common Types and Constants

The header file STDIO.H will be included automatically to these header files.
The table below gives an overview of all the functions which are available in the Standard Library of MSX-C v1.20. At the end of every function you can see the original declaration, in which sourcefile and which header file the function definition can be found, and a short description. Functies which start with an underscore ‘_’ are supposed to be used only internally by MSX-C. On debugging the library, however, the descriptions may come in handy.
Table 5: Functions in Standard Library v1.20

Name Declaration SourceFile Description
_attr TINY _attr(path)
char *path;
direct.c Get attribute of directory entry.
_bc TINY _bc(c, b)
char c;
TINY b;
stdio.c
_chai VOID _chai(limit, fd)
char *limit;
FD fd;
clibmac.mac
_chkversion VOID _chkversion() clibmac.mac
_cmp int _cmp(p, q)
char **p, **q;
direct.c
_cutpath char *_cutpath(mode, p)
TINY mode;
char *p;
stdlib.c Cut out path.
_deffcb char *_deffcb(fn, fcb)
char *fn;
char *fcb;
process.c Set up default FCB area for the program to be exec’ed.
_exec VOID _exec(progname, nargs, param, checkp)
int nargs;
char *progname, **param;
BOOL checkp; /* look at PATH */
Prepare to call _execgo.
_execgo char _execgo(progname, lflag)
char *progname;
char lflag;
process.c Execute!
_exit VOID _exit(code)
int code;
clibmac.mac Jumps to the “Terminate with error code (62h)” BDOS-routine.
_ffirst STATUS _ffirst(fn, fib, flag)
char *fn;
FIB *fib;
TINY flag;
clibmac.mac
_fillbuf STATUS _fillbuf(fp)
FILE *fp;
stdio.c
_flshserial VOID _flshserial() stdio.c
_fnext STATUS _fnext(fib)
FIB *fib;
clibmac.mac
_getc int _getc(fp)
FILE *fp;
stdio.c
_gv2 unsigned _gv2(p)
char **p;
stdio.c
_igs int _igs(func, ___)
int (*func)();
char *___; /* pointer to FILE or (char *) */
stdio.c Allows various aspects of file handles to be examined and altered. In particular it can be used to determine whether a file handle refers to a disk file or a device. _ioctl uses the “I/O Control for devices (4Bh)” BDOS-routine. Consult your DOS Reference Manual for more details.
_ioctl unsigned _ioctl(fd, subfunc, stat)
FD fd;
TINY subfunc;
unsigned stat;
io.c
_main VOID _main() process.c Called by xmain in ck.rel.
_noraw TINY _noraw(fd)
FD fd;
io.c
_p_path char *_p_path(fn, last_item, flag)
char *fn;
char **last_item;
TINY *flag;
clibmac.mac
_parsefn char *_parsefn(fn, fcb, flag)
char *fn;
char *fcb;
TINY *flag;
clibmac.mac
_putc STATUS _putc(c, fp)
char c;
FILE *fp;
stdio.c
_raw TINY _raw(fd)
FD fd;
io.c
_rawmode TINY _rawmod(fd, mode)
FD fd;
TINY mode; /* 0: cooked mode, 1: raw mode */
io.c
_scn int _scn(param, infunc, ___, ugfunc)
int **param;
int (*infunc)();
char *___; /* to FILE or (char *) */
int (*ugfunc)();
stdio.c
_seek STATUS _seek(fd, offset, mode)
FD fd;
int offset;
TINY mode;
clibmac.mac
_setarg VOID _setarg(s)
char *s;
process.c Set an argument string to command line (for exec).
_setprog STATUS _setprog(prog, whole, checkp)
char *prog;
char whole[]; /* 67 byte space */
BOOL checkp; /* look at PATH */
process.c Search prog and set fullpath name in whole (for exec)
_skipsp char *_skipsp(s)
char *s;
process.c Skip leading blanks.
_spr STATUS _spr(param, outfunc, ___)
int *param;
STATUS (*outfunc)();
char *___; /* p for any type */
stdio.c
_sscn int _sscn(ptr)
char **ptr;
stdio.c
_sspr STATUS _sspr(c, ptr)
char c, **ptr;
stdio.c
_stdenv VOID _stdenv(fp)
FILE *fp;
process.c
_suget VOID _suget(c, ptr)
char c;
char **ptr;
stdio.c
_swp VOID _swp(width, x, y)
size_t width;
char *x, *y;
stdlib.c
_unquote VOID _unquote(s)
char *s;
process.c
_uspr recursive TINY _uspr(str, n, radix)
char **str;
unsigned n;
TINY radix;
stdio.c
_whlpath STATUS _whlpath(whole, prog)
char whole[], *prog;
direct.c
abs int abs(n)
int n;
stdlib.c Returns the absolute value of its int argument.
alloc char *alloc(nbytes)
size_t nbytes;
malloc.c Returns a pointer to space for nbytes, or NULL if the request cannot be satisfied. The space is unitialized.
atoi int atoi(s)
char *s;
stdlib.c Converts s to int.
bdos char bdos(c)
char c;
clibmac.mac Calls BDOS-routine and returns a character (register A).
bdosh int bdosh(c)
char c;
clibmac.mac Calls BDOS-routine and returns an integer (register HL).
bios char bios(code)
char code;
clibmac.mac Calls CP/M BIOS routine. Valid values for code include:
0 xx00h – JMP WBOOT ;Warm boot
1 xx03h – JMP WBOOT ;Warm boot
2 xx06h – JMP CONST ;Console status
3 xx09h – JMP CONIN ;Console input
4 xx0Ch – JMP CONOUT ;Console output
5 xx0Fh – JMP LIST ;List output
6 xx12h – JMP PUNCH ;Punch (auxiliary) output
7 xx15h – JMP READER ;Reader (auxiliary) input
8 xx18h – JMP RETURN ;Home in CP/M
9 xx1Bh – JMP RETURN ;Select disk in CP/M
10 xx1Eh – JMP RETURN ;Set track in CP/M
11 xx21h – JMP RETURN ;Set sector in CP/M
12 xx24h – JMP RETURN ;Set DMA address in CP/M
13 xx27h – JMP RETURN ;Read sector in CP/M
14 xx2Ah – JMP RETURN ;Write sector in CP/M
15 xx2Dh – JMP LSTST ;List status
16 xx30h – JMP RETURN ;Sector translate in CP/M
call int call(addr, a, hl, bc, de)
int *addr, a, hl, bc, de;
clibmac.mac Calls routine starting at address pointed to by adrr. Before calling, register a, hl, bc and de will be filled with the specified values. Returns with integer (register HL).
calla char calla(addr, a, hl, bc, de)
int *addr, a, hl, bc, de;
clibmac.mac Calls routine starting at address pointed to by addr. Before calling, register a, hl, bc and de will be filled with the specified values. Returns with character (register A).
callxx VOID callxx(adrs, reg)
unsigned adrs;
XREG *reg;
clibmac.mac Calls routine starting at address pointed to by adrs. Before calling, register af, ix, iy, bc, de and hl will be filled according to reg (structure XREG is specified in BDOSFUNC.H). On returning, reg will be updated with the new register values.
chdir STATUS chdir(path)
char *path;
direct.c Change current work directory to path.
clearerr VOID clearerr(fp)
FILE *fp;
stdio.c Clears all error settings from file fp.
close STATUS close(fd)
FD fd;
clibmac.mac Releases the specified file handle for re-use by directly calling the operating system using the “Close file handle (45h)” BDOS-routine. Any buffered data will be flushed to disk. Returns ERROR if an error occured.
creat FD creat(filename)
char *filename;
clibmac.mac Creates a file or sub-directory by directly calling the operating system using the “Create file handle (44h)” BDOS-routine. Open mode is set to “no read” and no special attributes. Returns file handle or ERROR if an error occured.
eof TINY eof(fd)
FD fd;
io.c Returns zero if end of file occured.
execl VOID execl(nargs, progname, args)
int nargs;
char *progname, *args;
process.c Execute program progname with argument string args. No path check will be done.
execlp VOID execlp(nargs, progname, args)
int nargs;
char *progname, *args;
process.c Execute program progname with argument string args. A path check will be done.
execv VOID execv(progname, argv)
char *progname, **argv;
process.c Execute program progname with argument array argv. No path check will be done.
execvp VOID execvp(progname, argv)
char *progname, **argv;
process.c Execute program progname with argument array argv. A path check will be done.
exit VOID exit(code)
int code;
process.c Causes normal program termination. Open files are flushed, open streams are closed, and control plus code is returned to whatever loaded the transient program. This will almost always be the command interpreter, but in some cases it may be another transient program.
expargs int expargs(argc, argv, maxargc, xargv)
int argc, maxargc;
char *argv[], *xargv[];
direct.c ??
fclose STATUS fclose(fp)
FILE *fp;
stdio.c Flushes any unwritten data for fp, discards any unread buffered input, frees any automatically allocated buffer, then closes the stream. It returns EOF if any errors occured, and zero otherwise.
fcloseall TINY fcloseall() stdio.c Closes all open streams using fclose. Returns number of closed streams or ERROR if an error occured.
feof int feof(fp)
FILE *fp;
stdio.h Returns non-zero if the end of file indicator for fp is set.
ferror int ferror(fp)
FILE *fp;
stdio.h Returns non-zero if the error indicator for fp is set.
fflush STATUS fflush(fp)
FILE *fp;
stdio.c On an output stream, fflush causes any buffered but unwritten data to be written; on an input stream, the effect is undefined. It returns EOF for a write error, and zero otherwise. fflush(NULL) flushes all output streams.
fgets char *fgets(s, n, fp)
char *s;
int n;
FILE *fp;
stdio.c Fgets reads at most the next n-1 characters into the array s, stopping if a newline is encountered; the newline is included in the array, which is terminated by ‘\0’. fgets returns s, or NULL if end of file or error occurs.
fileno int fileno(fp)
FILE *fp;
stdio.h Returns the file handle of file fp. File handles are used by the system calls like open, write, create and unlink.
flushall TINY flushall() stdio.c Flushes all streams using fflush. Returns number of flushed streams.
fopen FILE *fopen(nargs, xfn, xmode, xbsiz)
unsigned nargs;
char *xfn, *xmode;
size_t xbsiz;
Opens the file pointed to by xfn, and returns a stream, or NULL if the attempt fails. Legal values for xmode include:
“r” open text file for reading
“w” create text file for writing; discard previous contents if any
“a” append; open or create text file for writing at end of file
If xmode is omitted, the file will be openen for reading. If xmode includes b after the initial letter, as in “rb”, that indicates a binary file. If specified, xbsiz changes the buffer size.
fprintf STATUS fprintf(nargs, iobuf, format)
int nargs;
FILE *iobuf;
char *format;
Converts and writes output to iobuf under the control of format. The return value is non-zero if an error occured. The format string contains two types of objects: ordinary characters, which are copied to the output stream, and conversion specifications, each of which causes conversion and printing of the next successive argument to fprintf. Each conversion specification begins with the character % and ends with a conversion character. Between the % and conversion character there may be, in order:
– Flags (in any order), which modify the specification:
-: which specifies left adjustment of the converted argument in its field
+: which specifies that the number will always be printed with a sign
space: if the first character is not a sign, a space will be prefixed.
0: for numeric conversions, specified padding to the field width with leading zeros.
#: which specifies an alternate output form. For o, the first digit will be zero. For x or X, 0x or 0X will be prefixed to a non-zero result. For e, E, f, g, and G, the output will always have a decimal point; for g and G, trailing zeros will not be removed.
– A number specifying a minimum field width. The converted argument will be printed in a field at least this wide, and wider if necessary. If the converted argument has fewer characters than the field width it will be padded on the left (or right, if left adjustment has been requested) to make up the field width. the padding character is normally space, but is 0 if the zero padding flag is present.
– A period, which separates the field width from the precision.
– A number, the precision, that specifies the maximum number of characters to be printed from a string, or the minimum number of digits to be printed for an integer (leading 0s will be added to make up the necessary width).
– A length modifier. “h” indicates that the corresponding argument is to be printed as a short or unsigned short.
The conversion characters and their meanings are shown beneath. If the character after the % is not a conversion character, the behavior is undefined:
d int; signed decimal notation.
o int; unsigned octal notation (without a leading zero).
x,X int; unsigned hexadecimal notation (without a leading 0x or 0X), using abcdef for 0x or ABCDEF for 0X.
u int; unsigned decimal notation.
c int; single character, after conversion to unsigned char.
s char *; characters from the string are printed until a ‘\0’ is reached or until the number of characters indicated by the precision have been printed.
% no argument is converted; print a %.
fputs STATUS fputs(s, fp)
char *s;
FILE *fp;
stdio.c Fputs writes the string s (which need not contain ‘\n’) on fp; it returns non-negative, or EOF for an error.
fread int fread(buf, size, count, fp)
char *buf;
int size, count;
FILE *fp;
stdio.c Fread reads from fp into the array buf at most count objects of size size. Fread returns the number of objects read; this may be less than the number requested. Feof and ferror must be used to determine status.
free void free(ap)
char *ap;
malloc.c Deallocates the space pointed to by ap; it does nothing if ap is NULL. ap must be a pointer to space previously allocated by alloc.
fscanf int fscanf(nargs, iobuf, format)
int nargs;
FILE *iobuf;
char *format;
Reads from iobuf under control of format, and assigns converted values through subsequent arguments, each of which must be a pointer! It returns when format is exhausted. fscanf returns EOF if end of file or an error occurs before any conversion; otherwise it returns the number of input items converted and assigned.
The format string usually contains conversion specifications, which are used to direct interpretation of input. The format string may contain:
– Blanks or tabs, which are ignored.
– Ordinary characters (not %), which are expected to match the next non-white space character of the input stream.
– Conversion specifications, consisting of a %, an optional assignment suppression character *, an optional number specifying a maximum field width, an optional h, l, or L indicating the width of the target, and a conversion character.
A conversion specification determines the conversion of the next input field. The result is placed in the variable pointed to by the corresponding argument. An input field is defined as a string of non-white space characters; it extends either to the next white space character or until the field width, if specified, is exhausted. this implies that scanf will read across line boundaries to find its input, since newlines are white space (white space characters are blank, tab, newline, carriage return, vertical tab, and formfeed).
The conversion character indicates the interpretation of the input field. The corresponding argument must be a pointer. The legal conversion characters are:
d decimal integer; int *.
o octal integer (with or without leading zero); int *.
u unsigned decimal integer; unsigned int *.
x hexadecimal integer (with or without leading 0x or 0X); int *.
c characters; char *. The next input characters are placed in the indicated array, up to the number given by the iwdth field; the default is 1. No ‘\0’ is added. The normal skip over white space characters is suppressed in this case; to read the next non-white space character, use %1s.
s string of non-white space characters (not quoted); char *, pointing to an array of characters large enough to hold the string and a terminating ‘\0’ that will be added.
% literal %; no assignment is made.
fsetbin STATUS fsetbin(fp)
FILE *fp;
stdio.c Set file mode to binary mode.
fsettext STATUS fsettext(fp)
FILE *fp;
stdio.c Set file mode to text mode.
fwrite int fwrite(buf, size, count, fp)
char *buf;
int size, count;
FILE *fp;
stdio.c Fwrite writes, from the array buf, count objects of size size on fp. It returns the number of objects written, which is less than count on error.
getc int getc(fp)
FILE *fp;
stdio.c Getc returns the next character of fp as an unsigned char (converted to an int), or EOF if end of file or error occurs.
getch char getch() io.c Getch reads a character from the standard input. If no character is ready it will wait for one. No echo or control characters checks will be done.
getchar int getchar() stdio.c Getchar is equivalent to getc(stdin).
getche char getche() io.c Getche reads a character from the standard input and echos it to the standard output. If no character is ready it will wait for one. Various control characters will be trapped by this function for various control purposes. If one of these characters is detected then it will be processed and this function will wait for another character. Thus these characters will never be returned by this function.
getcwd char *getcwd(cwd, n)
char *cwd;
int n;
direct.c Get current work directory.
getenv char *getenv(var)
char *var;
stdlib.c Returns the environment string associated with var. Returns NULL if the enviroment name var is invalid or if no memory can be nallocated for the temporary buffer.
gets char *gets(s, n)
char *s;
int n;
stdio.c Gets reads the next input line into the array s; it replaces the terminating newline with ‘\0’. It return s, or NULL if end of file or error occurs.
inp char inp(port)
unsigned port;
clibmac.mac Input character from port port.
isalnum int isalnum(c)
char c;
ctype.h Return non-zero if isalpha(c) or isdigit(c), 0 if not.
isalpha int isalpha(c)
char c;
ctype.h Return non-zero if c is alpabetic, 0 if not.
isatty BOOL isatty(fd)
FD fd;
io.c Returns zero if the file handle fd refers to a disk file, or non-zero if fd refers to a device.
iscntrl int iscntrl(c)
char c;
ctype.h Return non-zero if c is control character, 0 if not.
isdigit int isdigit(c)
char c;
ctype.h Return non-zero if c is digit, 0 if not.
iskanji int iskanji(c)
char c;
ctype.h Return non-zero if c is kanji first byte, 0 if not.
iskanji2 int iskanji2(c)
char c;
ctype.h Return non-zero if c is kanji second byte, 0 if not.
islower int islower(c)
char c;
ctype.h Return non-zero if c is lower case, 0 if not.
isspace int isspace(c)
char c;
ctype.h Return non-zero if c is blank, tab, newline, return, formfeed or vertical tab.
isupper int isupper(c)
char c;
ctype.h Return non-zero if c is upper case, 0 if not.
isxdigit int isxdigit(c)
char c;
ctype.h Return non-zero if c is hexadecimal digit, 0 if not.
kbhit BOOL kbhit() io.c Returns non-zero when a character is ready (that is, a key was pressed) for input from the keyboard. kbhit directly calls the operating system using the “Console status (0Bh)” BDOS-routine.
longjmp void longjmp(env, val)
jmp_buf env;
int val;
clibmac.mac Restores the state sved by the most recent call to setjmp, using information saved in ev, and execution resumes as if the setjmp function had just executed and returned the non-zero value val. The function containing the setjmp must not have terminated. Accessible objects have the values they had when longjmp was called, except that non-volatile automatic variables in the function calling setjmp become undefined if they were changed after the setjmp call.
max int max(x, y)
int x, y;
stdlib.c Returns the integer which represents the highest value.
memcpy void memcpy(dest, source, count)
char *dest, *source;
size_t length;
clibmac.mac Copy lenght characters from source to dest.
memset void memset(dest, byte, count)
char *dest, byte;
size_t length;
clibmac.mac Place character byte into first length characters of dest.
min int min(x, y)
int x, y;
stdlib.c Returns the integer which represents the lowest value.
mkdir STATUS mkdir(path)
char *path;
direct.c Make directory path.
movmem void movmem(source, dest, count)
char *dest, *source;
size_t length;
clibmac.mac Same as memcpy except that it works even if the objects overlap.
open FD open(filename, mode)
char *filename;
int mode;
clibmac.mac Opens the file pointed to by filename. open is rather like the fopen function, except that instead of returning a file pointer, it returns a file descriptor, or NULL if the attempt fails. open directly calls the operating system using the “Open file handle (43h)” BDOS-routine, whilst fopen subserves the standard library. Legal values for mode are:
b0 set: no write
b1 set: no read
b2 set: the file handle will be inherited by a new process created by the “fork” system call
outp void outp(port, val)
unsigned port;
char val;
clibmac.mac Output value val to port port.
perror VOID perror(msg)
char *msg;
stdlib.c Print previous error from dos.
printf STATUS printf(nargs, format)
int nargs;
char *format;
stdio.c Equivalent to fprintf(stdout, format).
putc STATUS putc(c, fp)
char c;
FILE *fp;
stdio.c Putc writes the character s (which need not contain ‘\n’) on fp. It returns the character written, or EOF for error.
putchar STATUS putchar(c)
char c;
stdio.c Putchar is equivalent to putc(c, stdout).
putenv STATUS putenv(env)
char *env;
stdlib.c Sets environment item to the specified value. env must be of format:
<varname>=<value>
putenv returns non-zero if an error occured.
puts STATUS puts(s)
char *s;
stdio.c Puts writes the string s and a newline to stdout. It returns EOF if an error occurs, non-negative otherwise.
qsort void qsort(base, n, width, compar)
char *base;
unsigned n;
size_t width;
int (*compar)();
stdlib.c Sorts into ascending order an array base[0]…base[n-1] of objects of size size. The comparison function cmp must return negative if its first argument (the search key) is less than its second (a table entry), zero if equal, and positive if greater.
read int read(fd, buf, bytes)
FD fd;
char *buf;
size_t bytes;
clibmac.mac Reads bytes number of bytes from file fd to buffer buf. Returns with the number of bytes transferred; read returnes no error code. To obtain error codes, see fileno, feof, ferror or eof must be used.
rename STATUS rename(oldname, newname)
char *oldname, *newname;
clibmac.mac Changes the name of the ffile; it returns non-zero if the attempt fails.
rmdir STATUS rmdir(path)
char *path;
direct.c Remove directory.
rsvstk void rsvstk(n)
size_t n;
malloc.c Changes space to set aside for the stack to n. Default size is 1000.
sbrk char *sbrk(n)
size_t n;
malloc.c Returns a pointer to n more bytes of storage. sbrk returns -1 if there was no space.
scanf int scanf(nargs, format)
int nargs;
char *format;
stdio.c Identical to fscanf(stdin, format).
sensebrk VOID sensebrk() io.c If a character is ready (that is, a key was pressed) for input from the keyboard, it will be read and tested for certain special control characters. sensebrk directly calls the operating system, using the “Console status (0Bh)” BDOS-routine.
setbuf VOID setbuf(fp, buf)
FILE *fp;
char *buf; /* points allocated buffer (size BUFSIZ) */
stdio.c If buf is NULL, buffering is turned off for the stream. Otherwise setbuf is equivalent to (void) setvbuf(stream, buf, _IOBF, BUFSIZ).
setjmp VOID setjmp(env)
jmp_buf env;
clibmac.mac Saves state information in env for use by longjmp. The return is zero from a direct call of setjmp, and non-zero from a subsequent call of longjmp. A call to setjmp can only occur in certain contexts, basically the test of if, switch, and loops, and only in simple relational expressions.
if (setjmp(env) == 0)
/* get here on direct call */
else
/* get here by calling longjmp */
setmem VOID setmem(dest, byte, count)
char *dest, byte;
size_t length;
Place character byte into first length characters of dest.
setvbuf STATUS setvbuf(fp, buf, mode, size)
FILE *fp;
char *buf;
int mode, size;
stdio.c Controls buffering for the stream; it must be called before reading, writing, or any other operation. A mode of _IOFBF causes full buffering, _IOLBF line buffering of text files, and _IONBF no buffering. If buf is not NULL, it will be used as the buffer; otherwise a buffer will be allocated. size determines the buffer size. setvbuf returns non-zero for any error.
sprintf VOID sprintf(nargs, buffer, format)
int nargs;
char *buffer, *format;
stdio.c The same as printf except that the output is written into the string buffer, terminated with ‘\0’. buffer must be big enough to hold the result.
sscanf int sscanf(nargs, line, format)
int nargs;
char *line, *format;
Equivalent to scanf except that the input characters are taken from the string s.
strcat char *strcat(d, s)
char *d, *s;
string.c Concatenate string s to end of string d; return s.
strchr char *strchr(s, c)
char *s, c;
string.c Return pointer to first occurence of c in s, or NULL if not present.
strcmp int strcmp(s, t)
char *s, *t;
string.c Compare string s to string t; return <0 if s<t, 0 if s==t, or >0 if s>t.
strcpy char *strcpy(d, s)
char *d, *s;
string.c Copy string s to string d, including ‘\0’; return d.
strlen size_t strlen(s)
char *s;
string.c Return lenght of string s.
strlwr char *strlwr(s)
char *s;
string.c Convert string s to lower case; return s.
strncat char *strncat(d, s, n)
char *d, *s;
unsigned n;
string.c Concatenate at most n characters of string s to string d, terminate d with ‘\0’; return d.
strncmp int strncmp(s, t, n)
char *s, *t;
unsigned n;
string.c Compare at most n characters of string s to string t; return <0 if s<t, 0 if s==t, or >0 if s>t.
strncpy char *strncpy(d, s, n)
char *d, *s;
unsigned n;
string.c Copy at most n characters of string s to d; return d. Pad with ‘\0’s if s has fewer than n characters.
strupr char *strupr(s)
char *s;
string.c Convert string s to upper case; return s.
tolower char tolower(c)
char c;
string.c Return c converted to lower case.
toupper char toupper(c)
char c;
string.c Return c converted to upper case.
ungetc STATUS ungetc(c, fp)
char c;
FILE *fp;
stdio.c Ungetc pushes c (converted to an unsigned char) back onto fp, where it will be returned on the next read. Only one character of pushback per stream is guarenteed. EOF may not be pushed back. Ungetc returns the character pushed back, or EOF for error.
ungetch VOID ungetch(c)
char c;
stdio.c Ungetch(c) is equivalent to ungetc(c, stdin).
unlink STATUS unlink(filename)
char *filename;
clibmac.mac Deletes the object (file or sub-directory) specified by filename from the file system. Returns non-zero if an error occured.
write int write(fd, buf, n)
FD fd;
char *buf;
size_t bytes;
clibmac.mac Writes bytes number of bytes from buffer buf to file fd. Returns with the number of bytes transferred; write returnes no error code. To obtain error codes, see fileno, feof, ferror or eof.
xmain void xmain() ck.mac Used internally.

MSX-C Library System Disk
Table 6: Contents of Library System Disk

-------------------------------------------------------------------
                 PRIMARY FILES      SUPPORT FILES      SOURCE FILES
                 --------------------------------------------------
LIBRARY FILES:   mlib.rel . . . . . glib.rel
                 msxbios.rel
                 math.rel
                 curses.rel
                 glib.rel . . . . . . . . . . . . . . .glib.mac
                 msxbios.rel. . . . . . . . . . . . . .msxbios.mac
                 math.rel . . . . . . . . . . . . . . .mathmac.mac
                                                       prsc.c
                 curses.rel . . . . . . . . . . . . . .cursesc.c
                                                       curses2.c

T-CODE FILES: mlib.tco. . . . . .glib.tco
math.tco
msxbios.tco
curses.tco
glib.tco. . . . . .glibc.c
msxbios.tco . . . .msxbiosc.c
math.tco. . . . . .mathc.c
prsc.c
curses.tco. . . . .cursesc.c
curses2.c

HEADER FILES: glib.h . . . . . . msxbios.h
msxbios.h
math.h
curses.h . . . . . msxbios.h

BATCH FILES: msxc.bat
genall.bat . . . . genmath.bat
gencurs.bat
genglib.bat
genbios.bat
genmlib.bat
gentco.bat
gen.bat
mksys.bat
forremk.bat

SAMPLE FILES: gcal.com . . . . . . . . . . . . . . .gcal.c
——————————————————————

The MSX-C Library System Disk contains a fully equiped library to access functions via C which are specific for the MSX. The library consists of 4 parts:

GLIB grafische functies
MSXBIOS BIOS functies
MATH rekenkundige functies voor variabelen van het type ‘long’ en ‘float’
CURSES functies voor windows onder screen 0

These libraries (GLIB.REL, MSXBIOS.REL, MATH.REL and CURSES.REL) are combined into one library MLIB.REL. The source code of the graphic library can be found in GLIB.MAC: machine language! Many graphical functions are just BIOS calles, but some of the primary functions have been coded in ‘real’ machine language. The graphical library uses the MSXBIOS library to make its BIOS calls. The source code of MSXBIOS.REL can be found in MSXBIOS.MAC.
The source code of the arithmetic functions can be found in MATHMAC.MAC. The file PRSC.C contains new definitions of the ‘printf’ and ‘scanf’ functions, which are able to cope with the ‘slong’ and ‘xdouble’ type definitions of the math library. Finally, the source code of the curses library can be found at CURSESC.C and CURSES2.C. The following header files are present:

GLIB.H Header file voor de grafische library
MATH.H Header file voor de rekenkundige library
MSXBIOS.H Header file voor de MSXBIOS library
CURSES.H Header file voor de windows libary

An automatic build of a C project including the MSX-C library can be performed using the batch file MSXC.BAT. Also it is possible to change to library. With the batch file GENALL.BAT it is possible to rebuild the entire library. GENALL.BAT will use the batch files GENMATH.BAT, GENCURS.BAT, GENGLIB.BAT, GENBIOS.BAT, GENMLIB.BAT, GENTCO.BAT and GEN.BAT to perform this task.
MKSYS.BAT will create another ‘Library System Disk’. This disk will contain all files which are necessary to build an executable from C source files, using the MSX-C library. The batch file FORREMK.BAT is able to create a ‘Library Remake System Disk’. This disk will contain all files which are necessary to rebuild a modified MSX-C library. Finally, the disk contains an example program called GCAL.COM. This program has been coded entirely in C. The source code can be found within GCAL.C
Graphic Library
Table 7: Functions in Graphic Library

Name Declaration SourceFile HeaderFile Description English
boxfill VOID boxfill(x1, y1, x2, y2, color, logop)
NAT x1, y1, x2, y2;
TINY color, logop;
glib.mac glib.h Draws a coloured rectangle on the screen with upper left corner (x1, y1) and lower right corner (x2, y2) and colour ‘color’. ‘Logop’ determines the logical operation for the colour. MSX-C uses its own routine (no BIOS) for this function.
boxline VOID boxline(x1, y1, x2, y2, color, logop)
NAT x1, y1, x2, y2;
TINY color, logop;
glib.mac glib.h Draws a rectangle on the screen with upper left corner (x1, y1) and lower right corner (x2, y2) and colour ‘color’. ‘Logop’ determines the logical operation for the colour. MSX-C uses its own routine (no BIOS) for this function
calatr NAT calatr(plane)
TINY plane;
glib.mac glib.h Returns a pointer to the sprite-attribute table of the specified plane.
calpat NAT calpat(patnum)
TINY patnum;
glib.mac glib.h Returns a pointer to the defined sprite pattern with number ‘patnum’.
circle VOID circle(x, y, r, color, s_angl, e_angl, aspect)
TINY color;
int s_angl, e_angl;
glib.mac glib.h Draws a circle on the screen at centre (x, y) and radius ‘r’ with colour ‘color’. ‘S_angl’ and ‘e_angl’ determine the start and endcorner if only a part of the circle needs to be drawn. ‘Aspect’ determines the ratio of the vertical and horizontal radius. Calls the BASIC ROM circle routine with string:
,color, s_angl*(pi/4000h), e_angl*(pi/4000h),
,(ABS(aspect)/32768)^((aspect<0)*2+1)
color VOID color(fore, back, bord)
TINY fore, back, bord;
glib.mac glib.h Changes the colour of foreground, background and border to successively ‘fore’, ‘back’ and ‘bord’. Calls the CHGCLR BIOS routine.
colspr VOID colspr(plane, color)
TINY plane, *color;
glib.mac glib.h Colours the specified sprite-plane. ‘Color’ points to colour data to either 8 or 16 bytes, dependant on the sprite size (8×8 or 16×16).
cpym2v VOID cpym2v(src, dir, dx, dy, dp, logop)
TINY *src, dir, dp, logop;
NAT dx, dy;
glib.mac glib.h Fills a frame with data from the Z80 from address ‘src’. The VRAM frame is determined by (dx, dy). The new colour will be calculated by executing ‘logop’ between the old and new pixel colour. ‘Dir’ specifies if the data from the Z80 must be written to the left (0) or to the right (1). This function will work only at screen modes from 5 to 8.
cpyv2m VOID cpyv2m(sx1, sy1, sx2, sy2, sp, dest)
NAT sx1, sy1, sx2, sy2;
TINY sp, *dest;
glib.mac glib.h Reads a frame from VRAM and places it at address ‘dest’ of normal RAM. The frame is specified by (sx1, sy1) – (sx2, sy2). ‘Sp’ specifies the number of dots of each line. This function will work only at screen modes from 5 to 8.
cpyv2v VOID cpyv2v(sx1, sy1, sx2, sy2, sp, dx, dy, dp, logop)
NAT sx1, sy1, sx2, sy2, dx, dy;
TINY sp, dp, logop;
glib.mac glib.h Copies a frame from one VRAM location to another VRAM location. The source frame is specified by (sx1, sy1) – (sx2, sy2) and will be copied to (dx, dy). The new colour will be calculated by executing ‘logop’ between the new and old pixel colour. ‘Sp’ and ‘dp’ determine the number of dots of each line. This function will work only at screen modes from 5 to 8.
filvrm VOID filvrm(adr, len, data)
NAT adr, len;
TINY data;
glib.mac glib.h Writes ‘len’ bytes with value ‘data’ to VRAM starting at address ‘adr’.
getplt NAT getplt(pal)
TINY pal;
glib.mac glib.h Gets colour codes of palet colour ‘pal’. Returns with values ‘green’, ‘red’ and ‘blue’ successively. Calls GETPLT SUBROM routine.
ginit VOID ginit() glib.mac glib.h Initializes the read- and writeport of the VDP. On using the Graphic Library, this routine must be called before making any calls to the Graphic Library.
glocate VOID glocate(x, y)
NAT x, y;
glib.mac glib.h Put the graphic cursor at location (x, y): (GRPACX, GRPACY) = (x, y).
grpprt VOID grpprt(c, logop)
char c;
TINY logop;
glib.mac glib.h Prints the character ‘c’ on a graphic screen. The colour of the character is determined by executing logical operation ‘logop’ between the new and old pixel colours. Calls the GRPPRT BIOS routine.
gtxmax NAT gtxmax() glib.mac glib.h Returns the maximum number of horizontal pixels of the current screen mode.
gtymax NAT gtymax() glib.mac glib.h Returns the maximum number of vertical pixels of the current screen mode.
iniplt VOID iniplt() glib.mac glib.h Initializes the palet and VRAM by calling the INIPLT SUBROM routine.
inispr VOID inispr(size)
TINY size;
glib.mac glib.h Initializes all sprites by calling the CLRSPR BIOS routine. Dependant on the value of ‘size’ the following actions will be taken:
1: 8×8 sprite setting
2: 16×16 sprite setting
4: disable sprites (MSX2 only)
interlace VOID interlace() glib.mac glib.h Switches the screen to interlaced mode.
invdp TINY invdp() glib.mac glib.h Reads a byte from the VDP read port. See also ‘setrd().
knjprt VOID knjprt(c, logop, mode)
NAT c;
TINY logop, mode;
glib.mac glib.h Prints the KANJI character ‘c’ on a graphic screen. The colour of the character is determined by executing logical operation ‘logop’ between the new and old pixel colours. ‘Mode’ may vary from 0 to 2. Calls the KNJPRT BIOS routine.
ldirmv VOID ldirmv(dst, src, len)
NAT src, len;
TINY *dst;
glib.mac glib.h Copies a block of ‘len’ bytes from VRAM address ‘src’ to RAM memory at destination address ‘dst’.
ldirvm VOID ldirvm(dst, src, len)
NAT dst, len;
TINY *src;
glib.mac glib.h Copies a block of ‘len’ bytes from RAM address ‘src’ to VRAM memory at destination address ‘dst’.
line VOID line(x1, y1, x2, y2, color, logop)
NAT x1, y1, x2, y2;
TINY color;
TINY logop;
glib.mac glib.h Draws a line on the screen from (x1, y1) to (x2, y2) with colour ‘color’. ‘Logop’ determines the logical operation with which the colour is calculated. MSX-C uses its own routine (no BIOS routine).
outvdp VOID outvdp(data)
TINY data;
glib.mac glib.h Writes ‘data’ to the VDP write port. See ‘setwrt()’
paint VOID paint(x, y, color, b_color)
NAT x,y;
TINY color, b_color;
glib.mac glib.h Paints an area on the graphic screen with colour ‘color’. The coordinates must point to a pixel which lies in the related area. ‘B_color’ determines the colour of the lines within which the computer must do the painting. Calls a routine from SUBROM.
point TINY point(x, y)
NAT x, y;
glib.mac glib.h Returns the colour the specified pixel at (x, y). MSX-C uses its own rotine (no BIOS).
pset VOID pset(x, y, color, logop)
NAT x, y;
TINY color, logop;
glib.mac glib.h Sets the colour of the specified pixel (x, y). The new colour will be determines by executing logical operation ‘logop’ between the new and old colour. MSX-C uses its own routine (no BIOS).
putspr VOID putspr(plane, x, y, color, pat) [GLIB.MAC, GLIB.H]
TINY plane, color, pat;
int x, y;
glib.mac glib.h Puts the sprite with number ‘pat’ at position (x, y) of the specified plane. The sprite will be coloured with the specified colour. MSX-C uses its own routine (no BIOS).
rdvdp TINY rdvdp(vreg)
TINY vreg;
glib.mac glib.h Reads register ‘vreg’ from VDP (0-23). The VDP registers can’t be read actually, but the BIOS maintains copies of these registers. These copies will be read by this function.
rdvsts TINY rdvsts(sreg)
TINY sreg;
glib.mac glib.h Reads the value of the VDP status-register ‘sreg’ (0-9)
rstplt VOID rstplt() glib.mac glib.h Reset the palet from VRAM. Calls the RSTPLT SUBROM routine.
setpg VOID setpg(dsppag, actpag)
TINY dsppag, actpag;
glib.mac glib.h Makes page ‘dsppag’ the VRAM page which is being displayed and page ‘actpag’ the VRAM page on which actions will be taken.
setplt VOID setplt(pal, grbdat)
TINY pal;
NAT grbdat;
glib.mac glib.h Sets palet colour ‘pal’ with red, green and blue values from structure ‘grbdat’. Calls the SETPLT SUBROM routine.
setrd VOID setrd(adr)
NAT adr;
glib.mac glib.h Prepares the VDP for reading from VRAM. After this call, one is able to read directly from VRAM with function ‘invdp()’. The VRAM address will be increased automatically after every read.
setwrt VOID setwrt(adr)
NAT adr;
glib.mac glib.h Prepares the VDP for writing to VRAM. After this call, one is able the write directly to VRAM with function ‘outvdp()’. The VRAM address will be increased automatically after every write.
sprite VOID sprite(pat, data)
TINY pat, *data;
glib.mac glib.h Defines sprite with number ‘pat’. ‘Data’ is a pointer to a sprite definition which can be either 8 or 16 bytes, depending on the size of the sprite (8×8 or 16×16).
totext VOID totext() glib.mac glib.h Puts the screen into textmode. Calls the TOTEXT BIOS routine.
vpeek TINY vpeek(adr)
NAT adr;
glib.mac glib.h Reads address ‘adr’ from VRAM.
vpoke VOID vpoke(adr, value)
NAT adr;
TINY value;
glib.mac glib.h Writes ‘value’ to address ‘adr’ of VRAM.
vramsize NAT vramsize() glib.mac glib.h Returns the size of the video memory (VRAM) (16, 64 or 128K).
wrtvdp VOID wrtvdp(regnum, value)
TINY regnum, value;
glib.mac glib.h Writes ‘value’ to VDP register ‘regnum’. Calls the WRTVDP BIOS routine.

BIOS Library
Table 8: Functions in BIOS Library

Name Declaration SourceFile HeaderFile Description English
*fnkstr char *fnkstr(n) msxbios.h msxbios.h Returns a pointer to the memory area which holds the definition of function key ‘n’.
*inlin char *inlin() msxbios.mac msxbios.h Reads keyboard input starting at the cursor, into a buffer until a CR or CTRL-STOP is pressed. Returns the starting address of the buffer. Calls INLIN BIOS routine ($00B1).
beep VOID beep() msxbios.mac msxbios.h Sounds a beep. Call the BEEP BIOS routine ($00C0).
breakx TINY breakx() msxbios.mac msxbios.h Checks the status of the CTRL-STOP key combination. Returns with 1 if CTRL-STOP is pressed, 0 if not. Calls the BREAKX BIOS routine ($00B7).
calbas VOID calbas(adrs, reg)
NAT adrs;
REGS *reg;
msxbios.mac msxbios.h Calls a routine from BASIC-ROM whose begin address is ‘adrs’. ‘Reg’ must point to a table with register values for F, A, BC, DE and HL.
calbio VOID calbio(adrs, reg)
NAT adrs;
REGS *reg;
msxbios.mac msxbios.h Calls a routine from BIOS-ROM whose begin address is ‘adrs’. ‘Reg’ must point to a table with register values for F, A, BC, DE and HL.
callx VOID callx(adrs, reg)
NAT adrs;
REGS *reg;
msxbios.mac msxbios.h Calls a routine whose address is ‘adrs’. ‘Reg’ must point to a table with register values for F, A, BC, DE and HL.
calslt VOID calslt(slot, adrs, reg)
TINY slot;
NAT adrs;
REGS *reg;
msxbios.mac msxbios.h Calls a routine from ‘slot’ whose address is ‘adrs’. ‘Reg’ must point to a table with register values for F, A, BC, DE and HL.
calsub VOID calsub(adrs, reg)
NAT adrs;
REGS *reg;
msxbios.mac msxbios.h Calls a routine from SUB-ROM whose address is ‘adrs’. ‘Reg’ must point to a table with register values for F, A, BC, DE and HL.
chget char chget() msxbios.mac msxbios.h Waits for and returns with input from the console (the keyboard). Calls the CHGET BIOS routine ($009F).
chgsnd VOID chgsnd(onoff)
BOOL onoff;
msxbios.mac msxbios.h Changes the status of the 1 bit sound port (??). If ‘onoff’ equals 0 (FALSE), it will be put off, otherwise on.
chput VOID chput(c)
char c;
msxbios.mac msxbios.h Sends character ‘c’ to the console (the screen). Calls the CHPUT BIOS routine ($00A2).
chsns BOOL chsns() msxbios.mac msxbios.h Checks the status of the keyboard buffer. Returns with 0 if the buffer is empty. Calls the CHSNS BIOS routine ($009C).
cls VOID cls() msxbios.mac msxbios.h Clear screen. Calls the CLS BIOS routine ($00C3).
di VOID di() msxbios.mac msxbios.h Disable interrupt.
disscr VOID disscr() msxbios.mac msxbios.h Disables screen appearance. Calls the DISSCR BIOS routine ($0041). See also ‘enascr()’.
dspfnk VOID dspfnk() msxbios.mac msxbios.h Display of function key display. Calls the DSPFNK BIOS routine ($00CF)
ei VOID ei() msxbios.mac msxbios.h Enable interrupt.
enascr VOID enascr() msxbios.mac msxbios.h Enables screen appearance. Calls the ENASCR BIOS routine ($0044). See also ‘disscr()’.
erafnk VOID erafnk() msxbios.mac msxbios.h Disable function key display. Calls the ERAFNK BIOS routine ($00CC).
gicini VOID gicini() msxbios.mac msxbios.h Initializes the PSG (Programmable Sound Generator). Calls the GICINI BIOS routine ($0090).
gtpad TINY gtpad(pad)
TINY pad;
msxbios.mac msxbios.h Get status of device ‘pad’:
0- 3: touchpad on connection 1
4- 7: touchpad on connection 2
8-11: lightpen
12-15: mouse or trackball on connection 1
16-19: mouse or trackball on connection 2
Dependant on the value of ‘pad’ the following values can be returned:
0/4/ 8/12/16: 0 if not present, -1 if present/touched. This status has to be checked before the x or y coordinate of the device can be checked.
1/5/ 9/13/17: x coordinate
2/6/10/14/18: y coordinate
3/7/11: status of switch (0 not pressed, -1 pressed)
The status of the mouse buttons must be checked using ‘gttrig()’. Calls the GTPAD BIOS routine ($00DB).
gtpdl TINY gtpdl(pdl)
TINY pdl;
msxbios.mac msxbios.h Get status of paddle ‘pdl’ (1-12). The paddles at connection 1 are identified as 1, 3, 5, 7, 9 and 11. The paddles at connection 2 are 2, 4, 6, 8, 10 and 12. Returns with value of paddle (0-255). Calls GTPDL BIOS routine ($00DE).
gtstck TINY gtstck(port)
TINY port;
msxbios.mac msxbios.h Reads current setting of the joystick or the four cursor keys, dependable on ‘port’:
0: cursor keys
1: connection 1
2: connection 2
Returns with code which indicates the direction:
8 1 2
\ | /
7- 0 -3
/ | \
6 5 4
Calls GTSTCK BIOS routine ($00D5).
gttrig BOOL gttrig(trig)
TINY trig;
msxbios.mac msxbios.h Get status of fire button, indicated by ‘trig’:
0: spacebar
1: first fire button at connection 1
2: first fire button at connection 2
3: second fire button at connection 1
4: second fire button at connection 2
Returns 1 if the fire button is pressed, 0 if not. Calls GTTRIG BIOS routine ($00D8).
inifnk VOID inifnk() msxbios.mac msxbios.h Initializes the function key definion. Calls INIFN BIOS routine ($003E).
kilbuf VOID kilbuf() msxbios.mac msxbios.h Clears keyboard buffer. Calls KILBUF BIOS routine ($0156).
locate VOID locate(csrx, csry)
TINY csrx, csry;
msxbios.mac msxbios.h Positions the cursor. Calls POSIT BIOS routine ($00C6).
lptout BOOL lptout(c)
char c;
msxbios.mac msxbios.h Sends character ‘c’ to the printer. Returns 0 if output succeeded, 1 if not. Calls LPTOUT BIOS routine ($00A5).
lptstt BOOL lptstt() msxbios.mac msxbios.h Checks status of printer. Returns 1 if printer is ready, 0 if not. Calls LPTSTT BIOS routine.
msx2 TINY msx2() msxbios.h msxbios.h Returns 0 if the machine is a MSX1.
pinlin char *pinlin() msxbios.mac msxbios.h Reads input from the keyboard starting at column 1 into a buffer untill a CR or CTRL-STOP is pressed. Returns the start address of the buffer. Calls PINLIN BIOS routine ($00AE).
rdpsg TINY rdpsg(reg)
TINY reg;
msxbios.mac msxbios.h Reads the content of PSG register ‘reg’. Calls RDPSG BIOS routine ($0096).
rdslt TINY rdslt(slot, adrs) msxbios.mac msxbios.h Reads address ‘adrs’ of slot ‘slot’. Calls the RDSLT BIOS routine.
rnd NAT rnd(range)
NAT range;
msxbios.mac msxbios.h Returns a random number whose size lies between 0 and ‘range’.
screen VOID screen(mode) msxbios.mac msxbios.h Switches screen in ‘mode’ and initializes the palet on a MSX2 machine. Calls the CHGMOD BIOS routine ($005F).
snsmat TINY snsmat(row)
TINY row;
msxbios.mac msxbios.h Returns the status of the specified ‘row’ of the keyboard:
rij\kolom X7 X6 X5 X4 X3 X2 X1 X0
Y0 7 6 5 4 3 2 1 0
Y1 ; [ @ \ ^ – 9 8
Y2 B A _ / . , ] :
Y3 J I H G F E D C
Y4 R Q P O N M L K
Y5 Z Y X W V U T S
Y6 F3 F2 F1 CODE CAPS GRAPH CTRL SHIFT
Y7 RET SEL BS STOP TAB ESC F5 F4
Y8 RIGHT DOWN UP LEFT DEL INS HOME SPACE
The corresponding bit will be 0 if a key is pressed. Calls the SNSMAT BIOS routine ($0141).
sound VOID sound(reg, val)
TINY reg, val;
msxbios.mac msxbios.h Writes value ‘val’ to register ‘reg’ of the PSG. Calls WRTPSG BIOS routine ($0093).
wrslt VOID wrslt(slot, adrs, value)
TINY slot;
NAT adrs;
TINY value;
msxbios.mac msxbios.h Writes value ‘val’ to address ‘adrs’ of slot ‘slt’. Calls the WRSLT BIOS routine.

Math Library
The Math Library contains routines which handle calculation with ‘signed long’ and ‘xdouble’ variables. To perform this task, the Math Library will use function calls from the Basic-ROM. These function calls, which is ofter referred to as ‘MathPack’, are present in both MSX1 and MSX2. They are able to process all kind of numbers. Integers and numbers of single and double precision can be converted, moved and be subjected to calculations. A function call to the MathPack however, isn’t a simple inter-slot call. Due to a design fault in the MathPack, page 1 of the Basic-ROM also needs to be active. Also the error handler must be hooked to prevent jumping to the BASIC interpreter in case an error occurs. Unfortunately the Math Library itself states it still contains some bugs:

  • too many instrunctions are used before the MathPack is called eventually
  • H.NMI is overwritten without being restored
  • the value of H.ERROR gets lost

The routine for calling a MathPack-funtion is almost identical to the CALBAS routine, as defined in the MSXBIOS library. It would be possible to combine both routines.
It would be possible to rebuild a faster version of the MATH-library by defining the lable ‘FAST’ and rebuilding the library. The drawback of this method, is the calling C program has to call ‘MATHINI’ at the begin and ‘MATHEND’ at the end of the program.
Table 9: Function in Math Library

Name Declaration SourceFile HeaderFile Description English
atosl SLONG *atosl(v, s)
SLONG *v;
char *s;
mathmac.mac math.h Converts ASCII string ‘s’ to a ‘long’ value.
atoxd STATUS atoxd(ans, s)
XDOUBLE *ans;
char *s;
mathmac.mac math.h Converts an ASCII string ‘s’ to a ‘xdouble’ value.
itosl SLONG *itosl(ans, p1)
SLONG *ans;
int p1;
mathmac.mac math.h Converts an ‘integer’ value to a ‘long’ value.
itoxd STATUS itoxd(ans, i)
XDOUBLE *ans;
int i;
mathmac.mac math.h Converts an ‘integer’ value to ‘xdouble’ value.
math2 STATUS math2(add, ?, ?, ans, p1, p2)
STATUS (*add)();
ans, p1, p2 is in back regs
mathmac.mac math.h *p1 -> dac, *p2 -> arg
Calls the ‘add’ routine from the Math-pack.
mathu VOID mathu(hl, de, bc, add)
unsigned hl, de, bc;
STATUS (*add)();
mathmac.mac math.h Calls the ‘add’ routine from the Math-pack.
slabs SLONG *slabs(ans, p1)
SLONG *ans, *p1;
mathmac.mac math.h *ans = |*p1|;
sladd SLONG *sladd(ans, p1, p2)
SLONG *ans, *p1, *p2;
mathmac.mac math.h *ans = *p1 + *p2;
sland SLONG *sland(ans, p1, p2)
SLONG *ans, *p1, *p2;
mathmac.mac math.h *ans = *p1 & *p2;
slcmp int slcmp(p1, p2)
SLONG *p1, *p2;
mathmac.mac math.h (*p1 – *p2)
slcpy SLONG *slcpy(ans, p1)
SLONG *ans, *p1;
mathmac.mac math.h
sldiv SLONG *sldiv(ans, p1, p2)
SLONG *ans, *p1, *p2;
mathmac.mac math.h *ans = *p1 / *p2 (signed)
slmod SLONG *slmod(ans, p1, p2)
SLONG *ans, *p1, *p2;
mathmac.mac math.h *ans = *p1 % *p2 (signed)
slmul SLONG *slmul(ans, p1, p2)
SLONG *ans, *p1, *p2;
mathmac.mac math.h *ans = *p1 * *p2;
slneg SLONG *slneg(ans, p1)
SLONG *ans, *p1;
mathmac.mac math.h *ans = -*p1
slnot SLONG *slnot(ans, p1)
SLONG *ans, *p1;
mathmac.mac math.h *ans = ~*p1;
slor SLONG *slor(ans, p1, p2)
SLONG *ans, *p1, *p2;
mathmac.mac math.h *ans = *p1 | *p2;
slrl SLONG *slrl(ans, p1, k)
SLONG *ans, *p1;
TINY k;
mathmac.mac math.h *ans = *p1 << k;
slrlc SLONG *slrlc(ans, p1, k)
SLONG *ans, *p1;
TINY k;
mathmac.mac math.h *ans = *p1 << k;
slrr SLONG *slrr(ans, p1, k)
SLONG *ans, *p1;
TINY k;
mathmac.mac math.h *ans = *p1 >> k;
slrrc SLONG *slrrc(ans, p1, k)
SLONG *ans, *p1;
TINY k;
mathmac.mac math.h *ans = *p1 >> k;
slsgn int slsgn(p1)
SLONG *p1;
mathmac.mac math.h
slsla SLONG *slsla(ans, p1, k)
SLONG *ans, *p1;
TINY k;
mathmac.mac math.h *ans = *p1 << k;
slsll SLONG *slsll(ans, p1, k)
SLONG *ans, *p1;
TINY k;
mathmac.mac math.h *ans = *p1 << k;
slsra SLONG *slsra(ans, p1, k)
SLONG *ans, *p1;
TINY k;
mathmac.mac math.h *ans = *p1 >> k;
slsrl SLONG *slsrl(ans, p1, k)
SLONG *ans, *p1;
TINY k;
mathmac.mac math.h *ans = *p1 >> k;
slsub SLONG *slsub(ans, p1, p2)
SLONG *ans, *p1, *p2;
mathmac.mac math.h
sltoa char *sltoa(str, sl, radix)
char *str;
SLONG *sl;
TINY radix; /* if (bit7 of radix)=1, *sl is unsigned. */
mathmac.mac math.h Converts a ‘long’ value to an ASCII string.
sltoxd STATUS sltoxd(ans, p1)
XDOUBLE *ans;
SLONG *p1;
mathmac.mac math.h Converts a ‘signed long’ value to a ‘xdouble’ value. See also ‘ultoxd()’.
slxor SLONG *slxor(ans, p1, p2)
SLONG *ans, *p1, *p2;
mathmac.mac math.h *ans = *p1 ^ *p2;
uitosl SLONG *uitosl(ans, p1)
SLONG *ans;
unsigned p1;
mathmac.mac math.h Converts an ‘unsigned int’ value into a ‘long’ value.
uldiv SLONG *uldiv(ans, p1, p2)
SLONG *ans, *p1, *p2;
mathmac.mac math.h *ans = *p1 / *p2 (unsigned)
ulmod SLONG *ulmod(ans, p1, p2)
SLONG *ans, *p1, *p2;
mathmac.mac math.h *ans = *p1 % *p2
ultoxd STATUS ultoxd(ans, p1)
XDOUBLE *ans;
SLONG *p1;
mathmac.mac math.h Converts an ‘unsigned long’ value to a ‘xdouble’ value. See also ‘sltoxd()’.
xdadd STATUS xdadd(ans, p1, p2)
XDOUBLE *ans, *p1, *p2;
mathmac.mac math.h *ans = *p1 + *p2; in xdouble type
xdatn STATUS xdatn(ans, p1)
XDOUBLE *ans, *p1;
mathmac.mac math.h *ans = (XDOUBLE)atn((*p1)); in xdouble type
xdceil STATUS xdceil(ans, p1)
XDOUBLE *ans, *p1;
mathmac.mac math.h *ans = (XDOUBLE)ceil((*p1)); in xdouble type
ceil(x) = ((floor(x) == x ? floor(x) : floor(x)+1);
xdcmp int xdcmp(p1, p2)
XDOUBLE *p1, *p2;
mathmac.mac math.h Returns ‘1’ if (*p1 > *p2), ‘0’ if (*p1 == *p2) or ‘-1’ if (*p1 < *p2)
xdcos STATUS xdcos(ans, p1)
XDOUBLE *ans, *p1;
mathmac.mac math.h *ans = (XDOUBLE)cos((*p1)); in xdouble type
xdcpy XDOUBLE *xdcpy(ans, p1)
XDOUBLE *ans, *p1;
mathmac.mac math.h Copies value ‘p1’ to ‘ans’.
xddiv STATUS xddiv(ans, p1, p2)
XDOUBLE *ans, *p1, *p2;
mathmac.mac math.h *ans = *p1 * *p2; in xdouble type
xdexp STATUS xdexp(ans, p1)
XDOUBLE *ans, *p1;
mathmac.mac math.h *ans = (XDOUBLE)exp((*p1)); in xdouble type
xdfabs STATUS xdfabs(ans, p1)
XDOUBLE *ans, *p1;
mathmac.mac math.h *ans = (XDOUBLE)fabs((*p1)); in xdouble type
xdfix STATUS xdfix(ans, p1)
XDOUBLE *ans, *p1;
mathmac.mac math.h *ans = (XDOUBLE)fix((*p1)); in xdouble type
xdfloor STATUS xdfloor(ans, p1)
XDOUBLE *ans, *p1;
mathmac.mac math.h *ans = (XDOUBLE)floor((*p1)); in xdouble type
xdlog STATUS xdlog(ans, p1)
XDOUBLE *ans, *p1;
mathmac.mac math.h *ans = (XDOUBLE)log((*p1)); in xdouble type
xdmul STATUS xdmul(ans, p1, p2)
XDOUBLE *ans, *p1, *p2;
mathmac.mac math.h *ans = *p1 * *p2; in xdouble type
xdneg STATUS xdneg(ans, p1)
XDOUBLE *ans, *p1;
mathmac.mac math.h *ans = -(*p1); in xdouble type
xdnrm STATUS xdnrm(ans, p1)
XDOUBLE *ans, *p1;
mathmac.mac math.h *ans = (XDOUBLE)(*p1); in xdouble type
xdpow STATUS xdpow(ans, p1, p2)
XDOUBLE *ans, *p1, *p2;
mathmac.mac math.h *ans = pow(*p1, *p2); in xdouble type
xdrnd STATUS xdrnd(ans, p1)
XDOUBLE *ans, *p1;
mathmac.mac math.h *ans = (XDOUBLE)rnd((*p1)); in xdouble type
xdsgn int xdsgn(p1)
XDOUBLE *p1;
mathmac.mac math.h Returns ‘1’ if (*p1 > 0), ‘0’ if (*p1 == 0) or ‘-1’ if (*p < 0).
xdsin STATUS xdsin(ans, p1)
XDOUBLE *ans, *p1;
mathmac.mac math.h *ans = (XDOUBLE)sin((*p1)); in xdouble type
xdsqrt STATUS xdsqrt(ans, p1)
XDOUBLE *ans, *p1;
mathmac.mac math.h *ans = (XDOUBLE)sqrt((*p1)); in xdouble type
xdsub STATUS xdsub(ans, p1, p2)
XDOUBLE *ans, *p1, *p2;
mathmac.mac math.h *ans = *p1 – *p2; in xdouble type
xdtan STATUS xdtan(ans, p1)
XDOUBLE *ans, *p1;
mathmac.mac math.h *ans = (XDOUBLE)tan((*p1)); in xdouble type
xdtoa char *xdtoa(s, p1, digits)
char *s;
XDOUBLE *p1;
TINY digits;
mathmac.mac math.h Converts ‘xdouble’ value ‘p1’ to an ASCII string. Variable ‘digits’ defines the number of decimals.
xdtoi STATUS xdtoi(ans, p1)
int *ans;
XDOUBLE *p1;
mathmac.mac math.h Converts an ‘xdouble’ value to an ‘integer’ value.
xdtosl STATUS xdtosl(ans, p1)
SLONG *ans;
XDOUBLE *p1;
mathmac.mac math.h Converts an ‘integer’ value to a ‘signed long’ value.

Curses Library
Table 10: Functions in Curses Library

Name Declaration SourceFile HeaderFile Description English
addch STATUS addch(ch)
char ch;
cursesc.c curses.h
addstr STATUS addstr(str)
char *str;
cursesc.c curses.h
box STATUS box(win, vert, hor)
WINDOW *win;
char vert, hor;
cursesc.c curses.h
cgetch char cgetch() curses2.c curses.h
clear STATUS clear() curses2.c curses.h
clearok clearok(win, bf) curses.h curses.h
clrtobot VOID clrtobot() cursesc.c curses.h
clrtoeol VOID clrtoeol() cursesc.c curses.h
delch STATUS delch() cursesc.c curses.h
deleteln VOID deleteln() cursesc.c curses.h
delwin VOID delwin(win)
WINDOW *win;
cursesc.c curses.h
echo VOID echo() curses.h curses.h
endwin VOID endwin() cursesc.c curses.h
erase VOID erase() cursesc.c curses.h
getstr STATUS getstr(str)
char *str;
curses2.c curses.h
getyx getyx(win, y, x) curses.h curses.h
inch char inch() curses2.c curses.h
initscr WINDOW *initscr() cursesc.c curses.h
insertln STATUS insch(ch)
char ch;
cursesc.c curses.h
insertln VOID insertln() cursesc.c curses.h
memmove VOID memmove(d, s, n)
char *d, *s;
unsigned n;
cursesc.c curses.h
move STATUS move(y, x)
int y, x;
cursesc.c curses.h
mvaddch STATUS mvaddch(y, x, ch)
int y, x;
char ch;
curses2.c curses.h
mvaddstr STATUS mvaddstr(y, x, str)
int y, x;
char *str;
curses2.c curses.h
mvdelch STATUS mvdelch(y, x)
int y, x;
curses2.c curses.h
mvgetch char mvgetch(y, x)
int y, x;
curses2.c curses.h
mvgetstr STATUS mvgetstr(y, x, str)
int y, x;
char *str;
curses2.c curses.h
mvinch char mvinch(y, x)
int y, x;
curses2.c curses.h
mvinsch STATUS mvinsch(y, x, c)
int y, x;
char c;
curses2.c curses.h
mvprintw STATUS mvprintw(nargs, y, x, format)
int nargs;
int y, x;
char *format;
curses2.c curses.h
mvwadch STATUS mvwadch(win, y, x, ch)
WINDOW *win;
int y, x;
char ch;
curses2.c curses.h
mvwadstr STATUS mvwadstr(win, y, x, str)
WINDOW *win;
int y, x;
char *str;
curses2.c curses.h
mvwdelch STATUS mvwdelch(win, y, x)
WINDOW *win;
int y, x;
curses2.c curses.h
mvwgtch char mvwgtch(win, y, x)
WINDOW *win;
int y, x;
curses2.c curses.h
mvwgtstr STATUS mvwgtstr(win, y, x, str)
WINDOW *win;
int y, x;
char *str;
curses2.c curses.h
mvwin STATUS mvwin(win, y, x)
WINDOW *win;
cursesc.c curses.h
mvwinch char mvwinch(win, y, x)
WINDOW *win;
int y, x;
curses2.c curses.h
mvwinsch STATUS mvwinsch(win, y, x, c)
WINDOW *win;
int y, x;
char c;
curses2.c curses.h
mvwprintw STATUS mvwprintw(nargs, win, y, x, format)
int nargs;
WINDOW *win;
int y, x;
char *format;
curses2.c curses.h
newwin WINDOW *newwin(lines, cols, begin_y, begin_x)
int lines, cols, begin_y, begin_x;
cursesc.c curses.h
noecho VOID noecho() curses.h curses.h
offcur VOID offcur() cursesc.c curses.h
oncur VOID oncur() cursesc.c curses.h
overwrite VOID overwrite(win1, win2)
WINDOW *win1, *win2;
cursesc.c curses.h
printw STATUS printw(nargs, format)
int nargs;
char *format;
curses2.c curses.h
raw VOID raw() curses.h curses.h
refresh STATUS refresh() cursesc.c curses.h
scroll STATUS scroll(win)
WINDOW *win;
cursesc.c curses.h
scrollok scrollok(win, bf) curses.h curses.h
subwin WINDOW *subwin(win, lines, cols, begin_y, begin_x)
int lines, cols, begin_y, begin_x;
cursesc.c curses.h
touchwin STATUS touchwin(win)
WINDOW *win;
cursesc.c curses.h
waddch STATUS waddch(win, ch)
WINDOW *win;
char ch;
cursesc.c curses.h
waddstr STATUS waddstr(win, str)
WINDOW *win;
char *str;
cursesc.c curses.h
wclear STATUS wclear(win)
WINDOW *win;
curses2.c curses.h
wclrbot VOID wclrbot(win)
WINDOW *win;
cursesc.c curses.h
wclreol VOID wclreol(win)
WINDOW *win;
cursesc.c curses.h
wclrtobot VOID wclrtobot(win)
WINDOW *win;
curses.h curses.h
wclrtoeol VOID wclrtoeol(win)
WINDOW *win;
curses.h curses.h
wdelch STATUS wdelch(win)
WINDOW *win;
cursesc.c curses.h
wdeleteln VOID wdeleteln(win)
WINDOW *win;
cursesc.c curses.h
werase VOID werase(win)
WINDOW *win;
cursesc.c curses.h
wgetch char wgetch(win)
WINDOW *win;
curses2.c curses.h
wgetstr STATUS wgetstr(win, str)
WINDOW *win;
char *str;
curses2.c curses.h
winch char winch(win)
WINDOW *win;
curses2.c curses.h
winsch STATUS winsch(win, ch)
WINDOW *win;
char ch;
cursesc.c curses.h
winsertln VOID winsertln(win)
WINDOW *win;
cursesc.c curses.h
wmove STATUS wmove(win, y, x)
WINDOW *win;
cursesc.c curses.h
wprintw STATUS wprintw(nargs, win, format)
int nargs;
WINDOW *win;
char *format;
curses2.c curses.h
wrefresh STATUS wrefresh(win)
WINDOW *win;
cursesc.c curses.h

Tips & Tricks
Identifiers
The subsequent programs which treat the C source, all use their own treatment of identifiers as shown underneath:
Table 11: Treatment of identifiers

-----------------------------------------------------------
                      significance      treats uppercase
                       characters   different from lowercase
-----------------------------------------------------------
Compiler (CF & CG)           16               YES
Assembler (M80)               6               NO
Linker (L80)                  6               NO
-----------------------------------------------------------

The MSX-C Compiler (CF & CG) treats uppercase different from lowercase and has a significant label lengt of 16 characters. The assembler (M80) and the linker (L80) do not treat uppercase different from lowercase and their significant labellengt is a mere 6 characters. Because identifiers of C variables are passed on to M80 and L80 by the MSX-C Compiler, we’re stuck with a significant label length of 6 characters for C variables. Identifiers of define labels and typedefs on the other hand, are used by the compiler only, so their significant label length will be 16 characters, whereas uppercase will be treated different from lowercase.
For example: The next function declarations are identical to M80, so if they’re all used in the same program, M80 will generate an error message during the compile phase:

VOID Functn1() ()
VOID Functn2() ()
VOID FUNCTN3() ()

The compiler DOES see the next declarations as all different identifiers:

#define Defined_label1 GreenPeace
#define Defined_label2 Ozon
#define Defined_Label2 Gasoline
typedef unsigned shoarmapositive
typedef char shoarmanegative

Argument passing
If you have machinecode programs and you want to call them directly from C language, you have to know how arguments are passed. That’s what this section is all about.
Argument passing between the different MSX-C functions can be done by the stack, the Z80 registers, or both. By putting the compiler in recursivemode, all arguments will be passed by the stack, allowing recursive programming. In non-recursivemode, the first 3 arguments of any function call will be passed using the Z80 registers, thus taking account for faster argument passing.
Using the preprocessor commands:

#pragma rec
#pragma nonrec

one is able to switch the compiler between recursiveand nonrecursivemode respectively. Also it is possible to declare just one function as recursiveby putting this keyword in front of the function:

recursive VOID function()

The default mode for the compiler is non-recursive. The next table shows how the arguments are passed depending on the different modes and type of arguments:
Table 12: Argument passing

----------------------------------------------------------
                       non-recursive             recursive
            ----------------------------------------------
                    length of parameter
            ----------------------------------
            1 byte (char)    2 bytes (integer)
----------------------------------------------------------
   1              A                HL             (SP-1)
   2              E                DE             (SP-2)
   3              C                BC             (SP-3)
   4                    (SP-1)                    (SP-4)
   5                    (SP-2)                    (SP-5)
   :                       :                         :
   n                  (SP-(n-3))                  (SP-n)
----------------------------------------------------------
                                      (SP = Stack Pointer)

Depending of the type of the argument – char or integer – and assuming the compiler is in non-recursivemode, the argument will be passed using the A or the HL register respectively. In non-recursivemode the DE and BC register will be used to pass the second and third arguments respectively. Keep in mind the high-byte (D resp. B) will contain non-determined values once a char is passed as an argument. If the function call contained a fourth or even more arguments, they will be passed to the function using the stack. Once on the stack, both a char and an integer will be treated as 2 byte values.
If the compiler is in recursivemode, arguments will be passed to the function using the stack for each argument.
The last address on the stack is the return address to which the called function will return once it has completed. If an argument is passed without declaration – i.e. the variable is not declared as either integer or char – the compiler will assume the value to be an integer.
For example: Suppose the function EXAMPL is called, using the following syntax:

EXAMPL (char1, int1, char2, char3, int2, int3);

Now EXAMPL can find the arguments at the following locations:

char1: A
int1: DE
char2: C
char3: (SP-1)
int2: (SP-2)
int3: (SP-3)

With syntax:

EXAMPL(12);

the value 12 will be passed using register HL. If you want to pass the argument using register A, you’ll have to use type casting:

EXAMPL((char) 12);

Memory management
A typical MSX-C program would have its 64K arranged as shown underneath:
Table 13: Memory layout

--------------------------------------------------------
       0FFFFh -----------------------------
                          hooks
       0FD99h -----------------------------
                      working area
       0F380h -----------------------------
      (00006h)----------------------------- Top of TPA
                          stack           ^
                            :             | (_torelance)
             _ _ _ _ _ _ _ _ _ _ _ _ _ _ _v_
                          heap

       ----------------------------- (_endx)

Transient Program

      0100h ----------------------------- Start of TPA

	  Transient Program
      Parameter Areas
      0000h 
            -----------------------------
--------------------------------------------------------
(TPA = Transient Program Area)

RAM memory from address 0FD9Ah up to and including 0FFCAh is reserved to be used by hook-addresses. The memory between addresses 0F380h and 0FD99H – known as the working area – contains the variables which are used by the BIOS and the BASIC interpreter. The available memory to external devices or even small programs is located below the working area and above the TPA (Transient Program Area).
Each MSX-C program will automatically set the stack pointer to the top of the TPA by reading the contents of address 0006h. This piece of code resides in CK.REL , which will automatically be linked into every MSX-C program. The source code can be found at CK.MAC .
The memory between the stack and address 0100h is available to the MSX-C program. The high limit of the memory space is hold by the variable _endx . The variable _torelance defines the available space for the stack to grow. The free space between the lower limit of the stack and the higher limit of the program is often referred to as heap. To manage this heap memory, MSX-C offers 4 functions: alloc() , free() , rsvstk() and sbrk() :
char *alloc(size_t nbytes) [MALLOC.C]
Returns with a pointer to nbytes of free heap space, or NULL if the request cannot be aggreed to. The allocated space will not be initialized (i.e. contains garbage).
Once the memory gotten from alloc isn’t used anymore, it can be given ‘back’ to alloc by calling the free() function with the returned pointer of alloc as argument.
Keep in mind the memory available to alloc() very well may not be one continuous block of free memory. This especially is true once a program uses a number of sbrk() calls. To keep track of this discontinuous memory spaces, alloc() uses a list of free memory blocks internally. Every block contains information about its size, a pointer to the next free memory space and a pointer to the start of its memory space. The memory blocks are stored, sorted from low to high memory address and the last (highest) memory block points to the first.
Now if someone calls for memory, alloc() will walk through this list untill it founds a piece of memory which is big enough to hold the requested amount of memory. If no memory block satisfies the request, alloc() will call sbrk() for a brand new piece of memory.
VOID free(char *ap) [MALLOC.C]
Frees the memory pointed to by pointer ap . ap has to be retrieved from a alloc() call.
VOID rsvstk(size_t n) [MALLOC.C]
Modifies the reserved stack space ( _torelance ). The default value of _torelance is 1000.
char *sbrk(size_t n) [MALLOC.C]
Returns a pointer to n bytes of free memory, or -1 if the heap can’t deliver this amout. If the heap is big enough, sbrk() takes the first available memory space just above the program code and raises _endx with n .
Bibliography
The C programming Language
Brian W. Kernighan/ Dennis M. Ritchie
Prentice Hall Software Series, ISBN 0-13-110362-8
CP/M voor gevorderden
A. Clarke/ J.M. Eaton/ D. Powys-Lybbe
Academic Service, ISBN 90 6233 166 1
MSX ROM BIOS handboek
MSX-DOS 2.20 Programme Reference Manual 1; Function Codes Specifications,
H.S.H. Computervertrieb GmbH, 1989
MSX-DOS 2.20 Programme Reference Manual 2; Transient Program Interface Specifications,
H.S.H. Computervertrieb GmbH, 1989
HiSoft C Manual
H.S.H. Computervertrieb GmbH, 1988
MSX Math-Pack (deel 1)
MSX Computer Magazine 44
Ken uw computer: de V9938 videochip
Emil Hensen, MSX Club Magazine 25, 26 en 27
De MSX-2 videoprocessor
Nico van Rooijen, HCC Nieuwbrief 113 en 114

MSX C

MSX-C by ASCII compiler

Two versions exist of the ASCII C compiler:

Archive MSX C V1.10 Compiler disk

Archive MSX C V1.20 Compiler disk

Archive Complete package of MSX-C 1.10, 1,20, utilities, manual by Freddy Vulto

Archive Japanese MSX C manual, scanned in pdf format

Archive MSX C library Japanese manual

Articles written by Alex Wulms for Sunrise about MSX-C

Author: Freddy Vulto

Yes, although not known to many, a C compiler exists for the MSX. The compiler originally was written for CP/M, but a Japanese software company, ASCII, modified it especially for the MSX and called it MSX-C. The MSX-C compiler compiles C-code to Z80 mnemonics (asssembler) and uses the Macro Assembler package of Microsoft (M80) to maintain assembly libraries and to compile and link assembly code to MSX-DOS executables.

MSX-C Manual, English version

My bootdisk

Archive bootDisk.zip (166kb), Feb 21, 2004 MSX-C
bootdisk utilizing a 720 kb RAMDISK.Heres a copy of my bootdisk I created especially for my 7 MHz boosted, 1 Mb equipped MSX. The bootdisk creates a 720 kb RAMdisk (H:) to which MSX-C is copied. Now MSX-C compiles entirely from memory: no disk-access is needed, so compiling is as fast as you can get on an MSX. If the MSX is reset, the RAMdisk is restored with all the original files.

Make

Finding myself in distress and complicated batch files, I thought: There must be an easier way to automate these MSX-C compilations on my RAMdisk. So I build MAKE, using wheels from UNIX.

MAKE takes a description of file-dependencies as input. Normally, a makefile will contain these descriptions but if no makefile is specified, MAKE can read from the standard input just as well.A description of a file-dependency contains subsequent filenames in the master-slave format:
MASTER: SLAVE.1 SLAVE.2 … SLAVE.n operation1 operation2
MAKE checks whether one of the slaves has been modified by comparing the time & date of the slaves against the time & date of the master. If the master is older then one of the slaves, the operations will be send to the standard output.

Besides outputting these make operations, MAKE can also output backup commands. When youre using MSX-DOS2, MAKE checks the archive attribute of every file to determine if the file has been modified. If the file has been modified, the copy command will be send to the standard output.

Archivemake100.zip (22kb), Oct 25, 1999
Make.com including sources and documentation to use with MSX-DOS v1

Archivemake200a.zip (48kb), Oct 25, 1999
Make.com including sources and documentation (make.hlp) to use with MSX-DOS v2. Alpha though.

Munu

Archive munu.zip (26kb), Mar 24, 2000
This MSX-C project glues most of my efforts – BlinkC, CTime, KeySup – together by creating some kind of pull-down-menu-application within screen 0 (MSX 2). The included sources (MSX-C and assembler) allow you to create your own menu interface. Keep in mind however, this project is a beta (and probably never will be finished, or at least by me). Beta means most menu-items – as shown in the screen shots underneath – wont do anything. In fact, the only menu item that works in this beta-version are (Munu | Shell MSX-DOS)and (Munu | MSX-DOS…). On the other hand, many things work all right:
– its fast!
– creation of menu bar including time;
– creation of pull-down menus as well as pull-down menus within pull-down menus;
– usage of shortcut keys within the pull-down menus;
– messageboxes (Yes/No);
– window attributes to change the appearance of the pull-down menu (filled or not filled).

Although its a beta, this should be enough to get you on the road if youre really interested. The size of the compiled example which was used for the screen shots underneath is just 10,215 bytes for MSX-C v1.20 or 13,440 bytes if youre using MSX-C v1.10.

Munu screenshot 1

Munu screenshot 1.

Munu screenshot 2

Munu screenshot 2.

Munu screenshot 3

Munu screenshot 3.

BlinkC

ArchiveblinkC.zip (11kb), Mar 23, 2000
This assembler subroutine is capable of blinking a specified range of characters within screen 0 (MSX-2). The included example C program shows you how to use the subroutine from within MSX-C.

BlinkC screenshot

BlinkC screenshot.

Time

ArchivecTime.zip (7kb), Mar 23, 2000
This MSX-DOS program displays the changing time on screen 0, reading directly from the clock-chip and writing directly to VideoRAM. CTime is written in C using ASCIIs MSX-C compiler and therefore shows some of the possibilities of the compiler. Source-code files are included. MSX-C versions 1.10 and 1.20 should both be able to compile this project.

RainBow

Archiverainbow.zip (4kb), Feb 28, 1996
Select screen 8 color numbers using this total assembly utility (3456 bytes). This program allows you to select multiple colors and to view their byte value in decimal as well as hexadecimal. By viewing subsequent colors you can judge the smoothiness of color transitions. The program runs from MSX-Basic, issuing <brsload “rainbow.bin”,r>.

Rainbow screenshot

Rainbow screenshot.

KeySup

ArchiveKeySup.zip (4kb), Feb 28, 1996
The Key supplement program KEYSUP.COM stores the status of the control keys (CTRL, SHIFT, GRAPH and CODE) in a supplement buffer (SUPBUF). The KEYSUP TSR is activated every time a key is put in KEYBUF. Using KEYSUP, testing key combinations (for example CTRL-F1, SHIFT-cursor keys, GRAPH-SELECT) wont result in detecting false combinations. Core program has been written in assembly. Installation program and test program have been written using MSX-C. Source files are included.

Software

MSX Programming

Software is what makes our MSX come alive.
Developing software is what this part of the site is about.
It concentrates on programming information, tools, assemblers, compilers such as Pascal and C and contains a huge archive of sources!

Sources in assembler atttributed as free domain (but not without copyright!) by talented programmmers formerly or still active in the MSX community.

Subject Description Files for download
MSX 1 ROM Basic Disassembly by Stefano Bodrato. It can be built with the current z88dk variant of “z80asm” (z80asm -a msxbasic).
ERIX UART drivers The sources of the Sunrise RS232 interface ERIX Uart drivers. By Erik Maas. uart_drivers
nformat While doing backup copies of the single sidedSVI-738 disks it was noted that utilities like VGACOPY tried to read both sides of the SS disks. The problem is a byte in the bootsector header that wrongly indicates ‘two sides’. The bug is in NFORMAT.COM. included in the SVI-738 MSXDOS system disk. by Luis Claudio Grosso the disassembled NFORMAT.COM
and a bugfixed version NFORMBF.COM.
Source and executable files included.
nformat
boot4svi CPM3 for MSX2 boot sector disassembly by Luis Claudio Grosso. Plus a modified boot sector to make CPM3 to boot in an expanded SVI-738.

When using Padial’s 4mb memory expansion CPM3 but it didn’t boot directly and before this modification MEMTR had to be used before booting CPM3

boot4svi
SVI-328 CP/M sources The sources for the SVI-328 CP/M CBIOS Sources have been given to me by Tomas Karlson, thank you!

Note that the first two BIOS sources are originals from Spectravideo. The C.U.C. version is a much enhanced, bilingual (german/english) version by the wellknown programmer Peter Zevenhoven.

PUTBOOT and CHANGE Disassembled CHANGE a SVI-738 utility that changes the boot sector of diskettes to allow space for the 80 column driver. ‘Change’ replaces the whole boot sector, included the parameters area, this works fine with single sided diskettes, but… ‘changing’ a double side diskette, makes the directory no longer available. To solve this problem PUTBOOT is written. This utility writes the whole boot sector (with the /F option) or the executable part only from a 512 byte file. The syntax is:
PUTBOOT [D:]SOURCEFILE DESTDRIVE: [/F]
Where:
– SOURCEFILE is the 512 byte source file
– DESTDRIVE is the destination drive where the boot will be written
– /F if present, the whole boot sector is written, otherwise only the executable part is written.Also included is the disassembly of a standard DSDD boot sector 738DBOOT.ASM inside PUTBOOT and the disassembly of a ‘changed’ SSDD boot sector 738SCHGD.ASM inside CHANGE.ZIP. By Luis Claudio Grosso.
CHANGE
RAMDISK Luis bought a Padial’s LPS-4MB-V3 for his SVI-738, a 4mb memory expansion for MSX. The RAMDISK is a disassembled and slightly enhanced RAMDISK suitable for such a large amount of memory. In the archive both the original buggy version and the bugfixed version of RAMDISK. RAMDISK
MSX DOS 1.03 The disassembled and thorough documented source of MSX DOS 1.03. Another fine source made by Louis Claudio Grosso. source of MSX DOS 1.03
MSX ROMS Arjen Zeilemaker has done a great job of disassembling and commenting various MSX system roms. See here for a sourgeforce project with the latest of his work
For your convenience you can find here an archive with these sources dated may 2006. ROMS included are the MSX 2 roms, various diskroms, audio roms of MSX Audio, FMPAC, and the turboR and serial interfaces.
ROM sources
MEMTR10 MemTR Change Main Mem to Big Mem v.1.0

This is a simple program which tries to solve the problem with main mapper in Panasonic machines (MSX2+ and turboR). See the readme.txt in the archive

The MemTR program searches all the memory mappers connected to the computer, selects the bigger in capacity memory mapper and places the 4 pages of the main memory (the ones which MSX-DOS uses) in that mapper.

The program is only working, at this moment, with DOS1.

(c) 2004 Armando Perez Abad (Ramones)

MEMTR v1.0
SVI.738 CP/M Format Source of the CP/M format utility

Disassembled and commented by Louis Claudio Grosso

Source of the SVI.738 CP/M format utility
SVI.738 CP/M BIOS Sources of the CP/M 2.2 BIOS of the Spectravideo 738 by Louis Claudio Grosso Sources of the CP/M 2.2 BIOS of the Spectravideo 738
SVI.738 CP/M COLOR.COM disassembly This is the SVI.738 CP/M COLOR.COM utility

Disassembled and commented, made by Luis Claudio Grosso

Source of the SVI.738 COLOR.COM CP/M utility
SVI.738 CP/M BACKUP.COM disassembly This is the SVI.738 CP/M BACKUP utility

Disassembled and commented, made by Luis Claudio Grosso

Source of the SVI.738 BACKUP CP/M utility
SVI.738 communications ROM disassembly This is the SVI738 communications ROM disassembly and the RS232 system variables.

Since this is a MSX standard it is also applicable to other MSX RS232 implementations!

By Luis Claudio Grosso

This is the SVI738 communications ROM disassembly
Software for MSX2+/7MHz/KUN Basic With the MSX2+ and 7 MHz upgrade done by MK Public Domain (Digital KC) came some floppies: MSX 7 MHz test program

(MK Public Domain 1990)

MSX2+ demonstration program (MK Public Domain 1990)

KUN compiler demonstration programs and documentation

Color.com COLOR.COM original file (c) Eduardo Barbosa – Nemesis Informatica

This utility was extracted from ‘The Nemesis Tools’ a Brazilian MSX utility package.

Louis Claudio Grosso made some modifications on the program, apart of disassembling it with no authorization 🙂
Delay added to fix VDP access timing on non Brazilian MSX’s, orphaned code and data removed.
Exit key changed to ESC, Ugly character generator removed.
Program texts translated to English. Full assembly sources! Article by L.C.Grosso

COLOR.COM
BAS_BIN This is a BASIC to BINARY file converter from the Nemesis Tools package. All the files in the package are intended to be run on Brazilian MSXs. Louis Claudio Grosso disassembled, bugfixed and modified to make it run on e.g. the SVI738. BASBIN
MSX Cassette system A new article on the MSX cassette system: connecting two MSX computers via the cassette interface, use a PC as cassette recorder with high speed, programs and links. A side effect of my current projects with standalone MSX computers with all kind of i/o. A new article on the MSX cassette system
HAL scanner software The HAL handscanner came with original HAL software (Halos variant). And i rewrote and enhanced the Japanese to software for the Hal scanner (to make Stempels for Dynamic Publisher.

See the page devoted top the HAL Handy Scanner for more

Original HAL software

Software for the Hal scanner

RSC convert utility Ivisoft released Basic code (Qbasic for MS-DOS) to translate source ASM files from spanish assembler RSC and vice versa.Comments are leftunmodified, uppercase to lowercase is adapted as needed. RSC convert basic code
Cracked MSX DOS 2

by Victor van Acht

Cracked MSX-DOS 2 was made because the original MSXDOS 2.20 cartridge had a memory-mapper system. I had a non-memory-mapped RAM-memory expansion cartridge and wanted to use that. For some silly reason the 50Hz interrupt routines of MSXDOS 2.20 (counter to stop te drive motor after a while) was not on the same page as the rest of the software (the memorymapper was only used for that little routine and Japanese support, in which I was not interested). So I moved the interrupt routine to some empty space in the main-page. But it takes a LOT of time before you find out what the problem is….. (dissassembled most of the 16KB mainpage ROM….) Later I had a memory-mapper memory expension cartridge and all this was not necessary any more. Cracked MSX-DOS 2.20

Connect two MSX computers via a joystickport: another diskrom!

Victor van Acht

The network software worked great! I hacked the standard diskROM of an MSX-computer and replaced all the low-level I/O routine by communication routines to an other computer. In this way you could use the diskdrives of an other computer via the joystick ports. Speeds were upto 1Kbyte/sec (I think?)

Communication software

3 versions:

“slave” adds drives to a computer without drives

“master” shares the drives of a computer to another computer

“bidir” shares the drives of this computer AND adds the drives of another computer.

NOT multi-master multi-slaves allowed (didn’t finish that)

cable:

– connect trigger 1 from joystick port 2 from computer 1 and trigger 1 from joystickport 2 from computer 2

– connect trigger 2 from joystick port 2 from computer 1 and trigger 2 from joystickport 2 from computer 2

– connect GNDs

– insert cable when BOTH COMPUTERS ARE SWITCHED OFF!!!!!

(It might be the case that I changed the software (because during the experiments I blew up my joystick port of the master) that for the master joystick port 1 has to be used. Again: insert cable when BOTH COMPUTERS ARE SWITCHED OFF!!!!!)

Connect diskrom, assembler sources in WB format

FAT16 patched for convenient loading

Instead of displaying the message: “already installed!!”, the program jumps to the routine removing the driver, as if the command “Fat16 /R” was given.

Running fat16 again results in the driver being reloaded.

Using dos 2.41 which can search for files in given paths this patched driver is nice for “quick” switching of the driver.

is patched already.

This patch is made as follows: Fat009.com is renamed to fat16.com

The fat16.com file is patched at:

1C1: 2D to BB

1C2: 03 to 07

The adresses are absolute (Hex editor) not relative to program start.

z80dis was used to disassemble the program.

This is patched fat16.com

Command 2.41

Command 2.41, the invaluable upgrade for MSX-DOS 2 giving you such powerfull command line facilities!

The author Fokke Post has made this utility freeware and also made the sources available!

If you look for a FAT16 patched version of Command 2.41: here it is (made by Okei)

Command 2.41

Command 2.41 sources

FAT16 patched version of Command 2.41

Patched Erix fossil driver

Are you tired of using the Erix fossil driver and having to type CALL SYSTEM after it? Did you ever want to load a command after it too?

Now the solution is here!!!

Roberto Vargas patched this driver in such a way that it does not go to basic anymore. DOS2 will be always present, then. Furthermore, if you execute it together with another program, it will be executed after installing the driver:

Example:

DRIVER DIR /P

Then the driver will be installed, and after it, a DIR /P will be executed.

Patched Erix Fossil driver

Flash Rom Loader 2.3 (DOS 2 Compatible) for LPE-FLASH G

(c) 2002 by Ramones, JAM Soft and Saeba (Steria Source)

Including the sources in assembler!

The LPE-FLASH G board in all four of its current versions is a data storage device with a capacity of 512KB with different mappers.

It is perfect for loading (mega)rom images and since it uses non-volatile flash memory it keeps its contents.

This MSX-DOS (2) program allows to clear the flash ram, store ROM images and execute them. Also choice of european or japanese keyboard and 50/60 Hz is possible. Comes with english and spanish manual and sources. Freeware, please keep the archive intact when republishing

Flash Rom Loader 2.3

Diskrom (dis)assembler sources

MSX DOS kit, assembler sources to build a diskrom

In this archive you find:

– Source of ATAIDE diskrom by Novatec

– Disassembled source of MSX Club Gouda SCSI diskrom (pre-Novaxis) by Dick van Vlodrop

– Disassembled and patched sources of HSH SCSI diskrom by Ries Vriend and Ramon van der Winkel

– Sources of Connect, a diskrom based network via joystick port by Ries Vriend

Alwin Henseler made a disassembly of the NMS8245 diskrom

Collected texts about diskrom: hooks, routines, fat12 disk layout, hooks and system area

See also the B.E.R.T. sources for the SCSI diskrom of B.E.R.T. and the disassembly of an older B.E.R.T. rom by Floris van Gog.

Jon de Schrijder wrote an article how MSX with disk roms assigns drive letters to drives.

See also the BEER IDE interface for the diskrom source.

Diskrom archive

NMS8245 diskrom

Collected texts about diskrom

B.E.R.T. sources

Disassembly of an older B.E.R.T. rom

Drive number assigment

Connect diskrom, assembler sources in WB format

MSX 2+ screens Screen 10, 11, 12 programming article by Hans Otten

MCCM 72 MSX-2 plus schermen article

MCM 47 Technische details nieuwe schermen 10,11, 12 MSX2+

Screen 10, 11, 12 programming

MSX-2 plus schermen

Technische details nieuwe schermen 10,11, 12 MSX2

MST products

No picture

MSX Software Team

The MST software products based on memory management with Memman and various TSR’s are important tools for Basic and MSX DOS users and programmers.
Many MST tools (tsr’s) are freeware. Some of the products were not free (with permission of the authors of the MST Robbert Withmar, Ries Vriends, Ramon van der Winkel now all are freeware!).

Here are those products (dutch documentation!):

  • MST Tracer, a Basic debugger
  • MST Jansi, ansi code support
  • MST Improve
  • MST tsr development kit
  • MST tsr collection
  • MST Quintus drawing program
  • MST Diskview (see next section)
  • An uptodate archive with MEMMAN 2.4 including english introduction and a large selection of tsr’s
MST products:

Tracer Guide and disk

Jansi Guide and disk

Improve Guide and disk

TSR development kit Guide and disk

TSR collection Guide and disk

Quintus Guide and disk

An uptodate archive with MEMMAN 2.4

Programs written by Steven van Loef

Steven van Loef has written many handy utilities for MSX. Many programs were published by the dutch magazines MCM and MCCM. He also was a member of the MST team and produced the Diskview program.

Here you find the programs, he also made available some sources.

DISAS(2) disassembler, Diskview 2.1 disk editor, SHOWEM gif viewer, MORE (incl source), many basic programs, MSXSLT etc

NYYRIKKI has uploaded a new version of Diskview (Ver: 2.1)
He also made a small configuration utility to change those awfull original default colors and added a option to boost the startup speed a bit.

Sources: LIST-command extension, disasembler, debugger callable from Basic

DSK image with:

MSXBUG, DISAS

Diskview

Diskview (Ver: 2.1)

Sources by Steven van Loef

CP/M Plus for MSX-2 computers

Original by Digital Research, adapted for MSX-2 by RVS. This CP/M version is much more advanced than the original CP/M 2.2, with date stamps for files. Supports the MSX-2 mapper upto 1Mb. Guide

Disks

Pascal (mostly Turbo Pascal)

Pascal compilers (all flavors of Turbo Pascal from the original Borland to Turbo Pascal 3.3f)

Pascal programming environments (Graphpak, Beunsoft, MDL-LIB, MSXPAD)

Hans Otten Pascal programming, my productions in Turbo Pascal such as CNVS and INDEX

Articles on how to program in Pascal on the MSX: many example programs in Turbo Pascal for MSX!

Articles on how to program in Pascal on the MSX
Hitech DEV PAC 80 Full documentation of this powerfull CP/M and also MSX assembler package GEN80 macro assembler, debuggers ProMON, MON80 and a Full Tutorial Hisoft DEVPAC 80 manual
Hitech C Programming MSX in C can be done with the freeeware CP/M C compiler version 3.09 made by Hitech.

For example Uzix was made with this toolset. You can use the htc and htlibr programs in combination with the Hi-Tech C compiler and a cpm emulator. The htc script uses the gcc preprocessor and you can use the Makefile system to automate testing with an MSX emulator, e.g. openMSX.

You can get htc, htlibr, cpmemu and Hi-Tech C from the Uzix web site, in the downloads section.

Also look for Hitech C and examples and libraries (like the one made by Pierre Gielen) on funet and the MSX libraries made by Nestor Soriani.

See also the dutch article Hisoft C++: een C-compiler

Uzix web site

 

MSX libraries made by Nestor Soriani.

Hisoft C++: een C-compiler

ASCII MSX-C

MSX-C by ASCII compiler

A nice page with the compilers, make utility and examples by Freddy Vulto

Two versions exist of the ASCII C compiler:

MSX C V1.10

MSX C V1.20 (MSX DOS 2 oriented)

Articles written by Alex Wulms for Sunrise about MSX-C
On the MSX Plaza you will find also a corrected include file from MCCM 90

MSX C V1.10 Compiler disk

MSX C V1.20 Compiler disk

Articles written by Alex Wulms for Sunrise about MSX-C

BDS-C BDS-C was a very succesfull C compiler for CP/M.

The author Leor Zolman made the compiler freeware, including the sources.

BDS-C compiler
Microsoft assembler package This assembler/linker/library package was made by Microsoft for CP/M.

Her you find

– Documentation of the Microsoft products
– The package itself
– A version running under MS-DOS

Note that ASCII C also includes M80/L80

Macro-80 reference

Link-80 reference

Lib-80 reference

CREF-80 reference

L80/M80 package

M80 running on MS-DOS

Other assemblers More assemblers are availble for the MSX system:

– MSX 1 Champ

– MSX 1 Zen

– The assembler from the Hisoft DEVPAC 2 package, running under MSX-DOS (GEN80/MON80/ED80)

– WBASS2 (embedded in Basic, nice for starters) by Wilbert Berendsen. Now public domain and with sources.

Champ documentation

Champ package

Zen documentation
Zen package

Userguide in pdf format of GEN80

GEN80 program

WBASS2 assembler

Basic

Basic 3.0 and Xbasic/Turbo basic description as built in the MSX2+ upgrade sets

Microsoft Basic-80 compiler for CP/M V5 documentation

Basic 3.0 and Xbasic/Turbo basic

Microsoft Basic-80 V5

Archivers

Archiving/compressors utilities popular on MSX DOS are:

Archiver PMARC PMEXT etc also running on MS-DOS

LZHPack (LHA format also on MS-DOS/Windows/Linux, for example with WINRAR)

Archiver PMARC PMEXT

LZHPack

Tools made by Luis Claudio Grosso

Translator from 8080 assembler mnemonics to Z80 equivalents contributed by Luis Claudio Grosso

ZX81 emulator by Luis Claudio Grasso: Digging deeply in my hard disk, I found a ZX81 emulator I enhanced some years ago.
The original program has no disk routines and the printer is handled in text mode. It also has some bugs in the joystick routine.
I wrote a disk and a new printer routine in graphic mode.
When I wrote it, I never thought I could share it with another users, so, it’s writen with my computer and peripherals in mind.
It is : SVI738 720k 3 1/2 internal and 360k 5 1/4 external disk drive, Citizen 180D dot printer.
This computer has 128k VRAM and MSX 1 and MSX 2 roms. The emulator runs in both MSX1 and MSX2 mode and it doesn’t use the extra video memory, so I think it will run OK in a standerd SVI738. The disk routines also support 360k SS 3.5″ disks (the standard SVI disks). I mainly used this emulator to transfer my TS1500 software to disk, taking advantage of the good tape data input the MSX has.
The loader for a SONY MSX was never tested in a real SONY, it was only tested in the CJS emulator in SONY mode.

Here are some utilities for MSX I wrote in the past
and an exellent Z80 cross assembler for PC I downloaded from a local BBS.
– The CODEBIN utility is for helping me to write .COM files with the DUAD package that only writes code files (bloadable files).
– The EP and EP2 utilities are for disprotecting EP and EP2 protected games
– The HEXCODE is for converting HEX files produced by XASM80 to MSX code files.
– The PCDEBIN and PCXCODE are the PC versions of CODEBIN and HEXCODE.
– And finally XASMZ80 is the cross assembler

The files are zipped in these two subdirectories:
\MSX
CODEBIN.COM MSX code to raw binary file converter
CODEBIN.Z80 source of the above program
EP.COM EP file protection cracker
EP.Z80 source of the above program
EP2.COM EP2 file protection cracker
EP2.Z80 source of the above program
HEXCODE.COM Intel HEX to MSX code file converter
HEXCODE.Z80 source of the above program

Translator

ZX81 emulator

Grosso utilities

Telematch In the 2003 MiniGame Compo the objective was to create a game with a maximum size of 1kB or 4kB.

Telematch was the MSX entry, created by Luis Claudio Grosso.

His program emulates the General Instruments AY-3-8500 chip, the heart of the game consoles known as ‘Pong.

In Telematch five games are available: Practice, Squash, Soccer, Advantage Soccer and Tennis.

Here you can see the game including the sources in assember.

Dynamic publisher for MS-DOS

Dynamic Publisher was not only released on MSX but also on MS-DOS. If you have the right (old…) videocard you can enjoy this version … PC version of Dynamic Publisher!
www.retroarchive.org Large collection of CP/M compilers for Pascal, C, Cobol, Algol, Ada, Modula, Fortran. Lisp, Basic, Assembler (might work on MSX-DOS too!) retroarchive.org
Programs with sources!
Pierre Gielen Many sources of handy utilities Pierre Gielen
EVA player Source of the EVA player for IDE by Sergio Guerrero Source of the EVA player for IDE
SVI.783 CP/M Sources of the CP/M 2.2 BIOS of the Spectravideo 738 by Louis Claudio Grosso Sources of the CP/M 2.2 BIOS
B.E.R.T. See the SCSI B.E.R.T. special page for comprehensive hardware and software information with sources B.E.R.T. special page
Pascal programs by Hans Otten The Hans Otten sources of Pascal programs for PC and MSX (CNVS, MSX12CNV , MSXCNV12, INDEX, file filers and conversion, pascal library, etc) Hans Otten sources
Gert de Boom MSX Club Gouda

Utilities and sources belonging to the Novaxis SCSI interface: Map source, cd utilities, nfdisk

Gert de Boom
Jan van der Meer MST member, author of MCCM magazine.

Sources of many Memman tsr’s: MSXALT, JANSI, SHIFT, ALTLAD etc

Jan van der Meer
Juan Salas Sources in Turbo Pascal of SDOS, a file manager and Digitize for the MSX Video computers Juan Salas SDOS

Juan Salas Digitize

Maarten Verheidt Source of Fdisk 3.0, the BERT SCSI interface Maarten Verheidt
Marco Soijer MST member

Quintus, a versatile drawing program taking advantage of Memman

Marco Soijer
Olivier Hustin The source code from an unreleased demo for MSX2 Olivier Hustin
Ramon van der Winkel MST member

Many TSR’s, Improve, screen edit, miscellaneous sources, a very interesting collection!

Ramon van der Winkel
Ries Vriend MST member, Jostel programmer

Sources of Memman, TED, MSX Connect, many TSR’s, miscellaneous sources, a very interesting collection!

Ries Vriend
Robbert Wethmar MST member, author of MCM and MCCM magazine

Memman tsr sources: tracer, joysor, mousor, cmdmem

Robbert Wethmar
Roderik Muit MSX Club Gouda

Assorted utilities and sources belonging to the Novaxis SCSI interface nfdisk older versions

Roderik Muit
Vincent van Dam Source of File Find v1.01 Vincent van Dam
Dick van Vlodrop Member of MAD

Sources of Flexbase, EPROM program utility for Toeprom and Elektuur EPROMmer, turboR character set and assorted sources and information about turboR

Dick van Vlodrop
Albert Beevendorp Sources by a very talented MSX programmer: Albert Beevendorp aka BiFi

  • Memman related programs (improved and new tsr’s)
  • Code fragments (a treasure collection!)
  • Test routines
  • Tools
  • Targeted at MSX, MSX 2, MSX 2+, turboR, FM-PAC, V9990, IDE
Albert Beevendorp
Cain Bart Schouten and Bard Pancras: demo’s, replayers, etc Cain sources
Arjan Bakker ViewGE5, math routines, LIB file manipulation, macro’s etc

Moonsound Sample Library

With this utility by Arjan Bakker you can combine multiple wavekits into one file (.msl). The utility will automatically remove redundant samples, making the resulting file much smaller (if you use enough of the same samples in multiple wavekits…). Full source code is included, including assembly code for using the msl file on the MSX.th this utility you can combine multiple wavekits into one file (.msl). The utility will automatically remove redundant samples, making the resulting file much smaller (if you use enough of the same samples in multiple wavekits…). Full source code is included, including assembly code for using the msl file on the MSX.

ViewGE5, math routines, LIB file manipulation, macro’s etc
TeddyWareZ The Chaos Assembler on CD suite, with updates added.

TeddyWareZ has released the sources of SCC-Blaffer NT. Included are the latest updates made together with BiFi.

This program is a tracker that helps you compose music for the Konami SCC chip.

TeddyWarez source building blocks by Jori Seidel aka d-fader and Frederik Boelens aka Chaos

SCC Blaffer NT sources by TeddyWareZ Jori Seidel aka d-fader

TeddyWarez source building blocks

Beer IDE

Beer IDE 202

BEER IDE 202 interface

How to make a IDE HDD drive interface for MSX, Designed By Egor Voznesensky (SOLID)

This design adds an IDE interface to the MSX. No MSX DOS 2 not meory mapper required (nor builtin), so perfect for MSX 1.
Made with easy to obtain cheap components and very simple to built with affordable hardware (a 8255 interface IC, an EPROM and 3 LS IC’s).

Beer MSX
(Photo by Juan Carlos Fekete)

pdf BEER 202 IDE diy
Original design, Contains the hddrom.mac – BIOS ROM source (diskrom) and hddide.gif – schematic

pdf PCB-design for BEER IDE, by Arnold Metselaar! Eagle format and postscript

there is an error in this design, and it is potentially very damaging.
Pin 2 of the IDE header should be connected to GND (0V) and not to VCC (+5V). Using the design without this correction is very likely to cause a short circuit when a drive is connected to the IDE header.

pdf BEER 202 sources of ROM and (non-functioning) HD partitioning program (read on for improved version)

pdf Firmware 1.9, utilities

Partitioning program by Adriano daCunha
pdf Partitioning program by Adriano daCunho (read on for improved version)

– BEER202 BIOS manages a fixed number of 5 drives (each drive is a “partition” );
– each partition is max 32MB in size;
– partitioning scheme is proprietary;
– only CHS mode is supported
– no memory mapper or MSXDOS2 required (but supported)
– 52KB/s reading speed with WSX;

Two more remarks:
-partitioning program was hanging with a Samsung SV0432A HD during initialization (while getting drive identification). I discovered that patching BEER BIOS at offset 3862h from F0h to FFh solves this issue.
– unfortunatelly, BEER202 doesn’t work ok with two HDs (Samsung, 4.3GB, and a Seagate Medalist 8422, 8.6GB).

Beer MSX
(Photo by Juan Carlos Fekete)

Beer MSX
(Photo by Juan Carlos Fekete)

A group of Argentinian MSX users, who work togther in the Yahoo mailing list MSX Error 51 Argentina have built with succes many Beer IDE interfaces. The photos and files on these pages are supplied by one of the members, Juan Carlos Fekete.
As you can see, a Compact Flash (via a CF to IDE converter) can be used beside standard IDE disks. The MSX Error 51 also supplied the following assembled, updated and working versions of the BIOS and the partitioning program.

pdf BEER 202 binary and sources of BIOS ROM

pdf Partitioning program
The original program to create partitions in the Beer interface has an error. It was impossible to create partitions larger than 16382 kB. Juan Carlos Feketemade the necessary corrections an can make now partitions of 32767 kB.

Pictures by DaBest of a build interface:

pdfhttp:/www.pjrc.com/tech/8051/ide/wesley.html from Luiz Leo.

Article that explains how the interface works: “How to connect an IDE disk to a microcontroller using an 8255”.
This document includes info about how it works, IDE commands, limitation of 32 mb per volume, etc. It can be useful to those who want to write utilities for this interface

PS/2 mouse

Controller PS / 2 mouse, computer mouse emulator for MSX.

PS/2 mouse

The basis of the controller is a Microcontroller (MC) ATTiny2313 from Atmel.
MK Taktiruetsya embedded generator at 8 MHz.
The circuit is very simple and cheap.

Firmware version 1.0 provides the controller with mouse emulation mode, when connected to any joystick port of the MSX.
In the next version emulation of the joystick will be added .
The LED on the board is fault, when connected to the mouse controller is blinking with a frequency of 1 hertz.

Archive with all sources
In the normal mode mouse, LED is lighted.
When you set jumper JP1, speed of the mouse is reduced by 2 times.

The controller is tested on a real MSX Yamaha YIS503II, and OCM DE1 while working in Symbos.

Also tested is the game Breaker

Original artice: http://zx.pk.ru/showthread.php?t=9392

PS/2 mouse

Kamil Karimov (caro)
k2k@list.ru
27.01.09

Do It Yourself

MSX Do It Yourself Enhancements

See also the Books and Magazines pages for do it yourself items. And the Technical information for computer-specific information.

Choose from the menu one of the the DIY article groups:

You want to design a MSX cartrdige? Make a PCB with Cadsoft Eagle freeware edition.
Download the Eagle MSX cartridge library by Arnold Metselaar, that may help you design a cartridge PCB with the MSX connector.

SVI.738 Xpress

Spectravideo SVI.738 X’Press

The SVI.738 is a very special MSX computer. It was presented as a MSX-1 computer with 80 column display facilities. Also a quality CP/ M 2.2 system was delivered in the box.
It is a ‘portable’ machine with dimensions slight bigger than a modern notebook. Ofcourse in those days LCD screens were not available so it needs a television or a monitor. But the carrying bag is really convenient.

Under the hood it was a surprise: the video chip is the V9938, and in fact it was nearly an MSX-2. Missing was enough memory, the clock IC and the MSX-2 BIOS ROMS. Many X’Press machines were converted later, for example in the Netherlands by the CUC and in Denmark by Henrik Gilvad. Missing was the memory mapper (external memory mappers do function though if you change the slot address of the cartridge connector. Note that several revisions of the motherboard exist, the first were having space reserved on the print with notes where to place the clockchip.

Manuals


The SVI.738 X’Press Technical Reference Manual circuit diagrams in PDF format.

The SVI.738 X’Press User Guide pages in PDF format.

SVI.738 CP/M 2.2 and MSX-DOS system disks

The Spectravideo SVI.738 is a special machine: it comes standard with CP/M 2.2 and MSX-DOS. The system disks contain the usual files and utilities and also special utilities to exchange files between the two operating systems.

Here you can download the SVI.738 CP/M 2.2 and MSX-DOS system disks including the tools to recreate real floppy disks.

SVI.738 system disks stickers scanned by Gerrit Dijkstra

Clock circuit diagrams design notes for the SVI-738 X’Press (Henrik Gilvad and other scandinavion designers)

Sources of Termtype and Sysgen , the SVI.738 Xpress CP/M utilities, commented by Luis Claudio Grosso

Disassembled and commented source of the SVI.738 utilities Editfkey and Loadfkey , made by Luis Claudio Gross

Disassembled and commented source of the SVI.738 DUMP utility , made by Luis Claudio Gross

The dutch original text of the SVI.738 CP/M bios patches I designed for C.U.C. Computer Info, which appeared as a long series.

Louis Claudio Grosso has updated his information on the CP/M BIOS of the Spectravideo SVI.738 X’Press.
Not only the source of the BIOS is now available but also a program to write the boot information to disk.

Henrik Gilvad even made the X’Press into a MSX2+ with internal memory mapper. If you know how he did that: please mail me!
Dan Derpaux send me this info how to do the SVI.738 MSX-1 to MSX2+ conversion!

SVI.738 MSX2+ ROMS (dump made by Bjoye Skjoldhammer) some part is not correct alas. I do have such a MSX-2+ myself so i should dump it soon!

The instructions to convert the SVI.738 to MSX-2
New and in english, combined the CUC dutch (translated) info and the danish/finnish info

The international SVI.738 MSX-2 Roms (thanks JP Grobler) without clockchip

The international SVI.738 MSX-2 Roms (CUC version) with clockchip

Add an RGB connecter to the SVI.738

Change slot settings for MSX-DOS 2, SCC, etc

Second diskdrive for the SVI.738

Reset button for the SVI.738

Improve sound for FM-PAC, SCC

Internal SVI.738 32K static RAM (contributed by Dan Derpaux, translated for the Syntax magazine)

Another MSX2 conversion

Louis C. Grosso did, independent of the conversions above, also an update of the SVI.738 to MSX2, without clockchip. The videorams are updated as in the other descriptions, he modified the MSX2 ROMS of a DAEWOO MSX2 computer and placed them in EPROMs with the following circuit

No picture

This SVI.738 was equiped further with a 720k internal drive, and a 360k 5 1/4 external drive, no memory mapper.

Here are the EPROMs, here are the utilities to format the 5 1/4 inch floppy drive.

The SYS02.BIN is the system rom and the EXT02.BIN is the sub rom. The original roms belong to a DAEWOO TPC310 sold in Argentina under the brand ‘TALENT MSX2’ model TPC310

The roms were patched for the following:
– Skip all the RTC access to avoid system hang during startup.
– Make the logo screen indicate 64k main ram instead of 128k.
– Program a 2 PIAs based memory mapper I never constructed.
– Translate the error messages to English (copy the English messages from the original SVI rom over the DAEWOO Spanish messages).
PS. The EXT02.BIN rom also contains the TURBO BASIC compiler that works also in MSX1 mode.

RTC circuit diagram by Henrik Gilvad

Spectravideo SVI-738 MSX2+ Mod

14 september 2013, the following text by kilroy-71

I have two Spectravideo SVI-738 computers. One in mint condition for my collection and one for daily use. The SVI-738 is perfectly suited to be modified as it has plenty of room in the case for modifications and there are also many instructions available to do various mods. It is originally a plain MSX computer but it comes with the V9938 videochip available in MSX2. It is therefore often referred to be a MSX1.5. I planned to upgrade it to a real MSX2, by exchanging the original 16K VRAM to 128k and replacing the ROM-files with MSX2 ROMs. But then I found out that Nyyrikki had managed to do a MSX2+ of his SVI-738 (Home made weird MSX2+) so I decided to contact him and ask how he had done the conversion. He kindly offered his help and the modification described here is done using his instructions.

The mod consists of doing the following:

  • Exchanging VRAM with 4 x TMS4464 chips
  • Exchanging the V9938 with a V9958 chip
  • Exchanging the Main ROM, Disk ROM and RS-232 ROM (I do not think that the disk ROM is necessary to change, but I wanted full 720k floppy support)

I have also done the following mods at the same time

  • Exchanged the internal 360k drive with a new PC drive to be able to use 720k
    disks.
  • Exchanged the very stiff and easily breakable flat cable between the keyboard and the motherboard.
  • Exchanged the wires between the motherboard and the power supply with cables usings Molex connectors to make it easy to separate the PCB:s
  • The FM-PAC-, SCC-mod to make the sound with these extensions to work properly

VRAM Exchange

The VRAM on the motherboard is easily exchanged by desoldering the four TMS4416 (IC22-25) and soldering back IC-sockets and adding two 0.1uF capacitors (C17 and C18) in front of the IC sockets. Then place the four TMS4464 circuits in the IC sockets. Start the computer after the VRAM is in place and check that the computer starts normally.

ROM Exchange

This is the more tricky part, not only do we need to desolder IC49 (RS-232 ROM) and put a socket in place, but as the new ROMs are of different size and with different contents than the original ROMs we need to do some additional modifications.Some address lines missing; A13 and A14 which need to be connected on the EXT/RS232-ROM (previously just RS232-ROM). The original ROM was 8k (IC49 2764), but the new ROM is 32K (27256). I chose to connect the A13 line on the underside of the PCB to A13 on IC50.

The A14 line was connected to A14 on the Main ROM (IC51).

Next problem is that we need to change the inverted output enable (/OE) signal to IC49 to make it work properly. The combined EXT/RS-232-ROM that I used had the RS-232 ROM in the upper half of the ROM (address #4000-#7FFF) and the EXT-ROM in the lower half (address #0000-#3FFF). The original RS-232 ROM was activated by /CS1 and the /SLT30 (slot select) signal. The problem is that the combined output is only activated for the memory range #4000-#7FFF. This means that the EXT-ROM will never be visible. The trick Nyyrikki uses here is to use A15 combined with /SLT30 as the /OE signal to IC49 as A15 is low in the memory range #0000-#7FFF. So what needs to be done is to disconnect the /CS1 signal from pin 10 on IC62 and replace it with A15. I did this by cutting the trace to pin 10 on IC62 and taking the A15 signal from IC40. (The cut is marked with a red circle in the picture below)


The disk ROM (IC50) was originally a 16K 27128, but the ROM I used was a 27256. The A14 line on the 27256 controls which half of the 27256 ROM is used (when only using 16k) and it is originally connected to VCC on the motherboard. The Disk ROM needs therefore be placed on the upper half of the ROM or alternatively on both the upper and lower half to make it work with both high and low signal on A14.

Start the computer when everything is soldered and in place and test that it starts up correctly.

V9938 Exchange

The V9958 chip must be prepared before it is connected to the IC37 socket. Pins
4, 21 and 27 are bent upward. Then connect pins 4, 20 and 27 together with a
wire that are soldered to the pins. These are connected to ground through pin
20. Solder also a wire between pins 21 and 58. This connects pin 21 to 5V.

FM-PAC/SCC-mod

This is simply done by replacing the 4k7 R2 resistor with a 150k resistor so
that the sound volume is lowered. Here is before…

and after…

Disk Drive Exchange

I found a PC TEAC floppy drive in my stuff that had a jumper for setting DS0/DS1. I changed the jumper to DS0. The floppy cable in the SVI-738 is very short and pin 1 on the new floppy drive was on the wrong side so I needed to exchange the cable to a longer one. I used a normal PC-floppy cable, but connected the drive using the B-drive connector, thus avoid using the twisted
part of the cable that cannot be used with the SVI-738.

An inconvinient thing with the original floppy drive is that the screw holes are not in the standard locations. I mounted the floppy on a frame from a PC that I cut and tried to drill holes at the correct locations, but I did not manage to do it properly. So what to do? Yes, hot glue to the rescue! It works, but I do not think that it will hold the floppy in place for very long. I plan to take two steel plates and drill holes in the right locations and mount them between the floppy and the stands.

The original floppy drive was a little bit higher so there is a gap in the case
now, but it looks ok anyway.

Keyboard Cable Exchange

The cable between the keyboard and the motherboard is known to break easily and it cannot be disconnected either. I wanted to have the possibility to disconnect the keyboard when working with the motherboard so I replaced the cable with a 50-pin SCSI cable. I desoldered the old cable and soldered a straight male 22-pin header on the motherboard. Then I soldered a similar on the keyboard PCB. Don’t do this!

The problem is that it makes it impossible to close the case. Use instead a 90 degree angled connector.

You can also take advantage of the fact that the keyboard has been opened and clean the gold plated parts for all keys with alcohol:

Here is a picture of the backside of the keyboard:

And here is everything connected:

Power Supply Cable Exchange

As I was exchanging the keyboard cable, I decided to also exchange the power supply cables. I use two PC power T-connectors that I had. I wanted to use the
correct color coding so I switched some of the wires.

Final Touches

Now everything is connected and the computer is ready to be run for a final test.

Push the power switch and wait:

Great! Lets try the keyboard and the floppy:

Excellent! We are done! Or wait a minute… There is one last thing, the MSX2+ logo…

That is better!

TODO

First off is to add a Real Time Clock-circuit to the motherboard. My SVI-738 is of the older model so it has already a part of the PCB dedicated to a RTC.

… and then I would also like to add an internal memory mapper. Unfortunately I have not found any instructions how to construct one, especially for the
SVI-738.

Credits

All credits for this mod goes to Nyyrikki. Thank you very much for all your help and your patience answering my questions!

MSX Video computers

Programs for the NMS8280 and partly the HB-G900P) with scanned guides (all in dutch)

The NMS8280 or the HB-G900(A)P are a good addition to a video workbench.

ArchiveSuperimpose & Video 1.1
AcrobatGuide in dutch

ArchiveSuperimpose & Video 1.3 (Version 2),
can be used on MSX2+, MSX-DOS2, hard disk, no list or copy protection, see leesme.txt

ArchiveVideobench
AcrobatScanned guide in dutch

ArchiveVideomanager
AcrobatGuide in dutch

ArchiveVideographics 5.2
AcrobatShort guide in dutch

ArchiveVideographics 5.4

ArchiveVarious programs for the 8280

ArchiveTestbeeld tonen
ArchiveTijdmenu: tijdcode in beeld

Luxe program, but not real time code

ArchiveTimec.bas
Short but powerfull program to show real timecode on screen, requires 7 MHz

ArchiveMusical Wipes and Animations
by Harry Berghuis, it uses the Moonblaster 1.4 replayer to add music to the wipes for the overlay computers HB-G900P and the NMS8280
AcrobatUserguide in dutch

ArchiveQuick Telopter and Halos programs, HB-G900P and NMS8280

Digitize program for MS-DOS Huib Walta has written a
Archiveprogram to digitize a video image (on NMS8280 for example)

Background and programming information

AcrobatHow to digitize in other screens like 5 and 7 (hardware modification and programs)

AcrobatDigitise screen 5 to 8 and make films

AcrobatThe SET VIDEO command

AcrobatHow to add a third slot to the VG82xx and the NMS8250/55/80
Additional information by Luciano Sturaro (via Ricardo Jurczyk Pinheiro): add pull-up resistors (10K will do) to pin 6, 8 and 11 of the new 74LS15, because the 74LS15 has open collector outputs.

AcrobatKoelproblemen oplossen voor NMS8250/55/80

AcrobatHow to write programs to digitize

AcrobatProgramming the NMS8280

AcrobatAdd MSX-DOS 2.x to the NSM8250/55/80

AcrobatFix the video level : better white instead of grey

AcrobatNMS8280 modified to MSX2+ roms

Videosplit and the HB-900P in space

See the page with material contributed by Wolfgang Borrman for:
– Videosplit: a video editing program for the NMS820 – the HB-900P in space, in russian MIR spacestation.

DIY Video computers

How to digitize in other screens like 5 and 7
pdfHardware modification and programs

How to add a third slot to the VG82xx and the NMS8250/55/80.
Additional information by Luciano Sturaro (via Ricardo Jurczyk Pinheiro): add pull-up resistors (10K will do) to pin 6, 8 and 11 of the new 74LS15, because the 74LS15 has open collector outputs.
pdfArticle how to add a third slot

Solve cooling problems for the NMS8250/55/80
pdfCooling problems NMS8250/55/80

Add MSX-DOS 2.x to the NSM8250/55/80
pdfMSX-DOSX 2 in NMS8250/55/80

Get real white color instead of grey on the NMS8280
pdfFix the video level

Another MSX 2+ mod
pdfNMS8280 modified to MSX2+ roms