Computing: DOS, OS/2 & Windows Programming

Exotic programming languages for DOS: MoonRock.

MoonRock is a BASIC-like language with several extensions. It produces small and tight executables (MS-DOS). 8086, 80186+ or 80386+ code, with support for DOS real mode and DPMI protected mode. MoonRock began as a pet project of Rowan Crowe in late 1994. It seems to be worked on nowadays, and maybe a new version, entirely written in MoonRock, will be released one day.

This tutorial is about the installation of MoonRock 0.50 on FreeDOS 1.3 RC5. It should apply to MS-DOS 6.22 and other DOS platforms, too.

MoonRock may be downloaded from Rowan Crowe's website. The download archive contains the program’s folder structure typical for a FreeDOS package. I extracted the files on my Windows 10 and copied the folder FDOS with its subdirectories APPINFO, DEVEL, DOC and LINKS to a floppy diskette. On my FreeDOS machine, I copied the files of APPINFO and LINKS to the corresponding FreeDOS directory, using the following commands (supposed that the FreeDOS installation directory is c:\freedos and that the actual directory is a:\fdos):
    cd appinfo
    copy *.* c:\freedos\appinfo
    cd ..\links
    copy *.* c:\freedos\links
I then created directories for the main program files (executables, examples) and the documentation, and copied the content of the other two subdirectories of a:\fdos to there; here are the commands (supposed that c:\devel exists):
    mkdir c:\freedos\doc\moonrock
    mkdir c:\devel\moonrock
    cd \fdos\doc\moonrock
    copy *.* c:\freedos\doc\moonrock
    cd \fdos\devel\moonrock
    xcopy *.* c:\devel\moonrock /E /I /H /Q

The screenshot shows the content of c:\devel\moonrock.

MoonRock on Free-DOS: Content of the installation directory

By default (creation of a real mode executable), building a MoonRock program requires these 3 steps:

Thus, an assembler is needed. The MoonRock installation files include the free ArrowSoft assembler. Normally, other assemblers, in particular MASM, should also do it. The build can be done with one command, running the program mrc.exe. A batch file, called moonrock.bat has been copied to c:\freedos\links. It sets the MoonRock installation directory as current and runs mrc.exe. Check this file in order to make sure that the path specified is correct. If your FreeDOS system is installed as mine (the DEVEL directory being located directly beneath the root of the C: drive instead of being a subdirectory of the FreeDOS installation directory), the change directory command in moonrock.bat has to be changed from cd \FDOS\devel\moonrock to cd \devel\moonrock. Now, you can build MoonRock programs by running the command
    moonrock <source-filename> [options]

Whereas the MoonRock language is well documented in the .doc file, that we copied to c:\freedos\doc\moonrock, I did not find any indications concerning the options of mrc.exe. In the source listings of some programs, the options /-c and /-m are used. No idea, what they mean (should we possibly always use them?). I also don't know, how to proceed to build DPMI protected mode programs...

The screenshots below show the build of the included sample program hello.moo (screenshot on the left), resp. the files created by the build and the execution of hello.com (screenshot on the right).

MoonRock on Free-DOS: Building the included sample hello.moo
MoonRock on Free-DOS: Running hello.com, built from the included sample hello.moo

The intermediate assembly file might be interesting for people who do programming in both BASIC and assembly. The screenshot below shows the assembly code of hello.asm, created when building hello.moo.

MoonRock on Free-DOS: Assembly created when building a MoonRock source file (opened in FreeDOS editor)

As MoonRock is a personal project of Rowan Crowe, rather than an official programming language, you will only find some rare sample MoonRock code on the Internet. The examples included with the installation files are rather demos than "real-world" programs. Really nice done, and maybe serving as inspiration for your DOS programs, is the demo of simple windows created with MoonRock. The screenshot on the left shows the screen when the program starts up. The windows may then moved around on the screen and positioned where you want. Pushing the F1 key will open the window shown on the screenshot on the right.

MoonRock on Free-DOS: Usage of windows demo [1]
MoonRock on Free-DOS: Usage of windows demo [2]

I did not further try out MoonRock programming, so I can't say how useful this language is in the practice. Based on the documentation, I would say that you'll have to consider that some features aren't yet implemented. On the other hand, the executables produced are really small and possibly also faster than those cretaed by official BASIC compilers (in particular, if graphics are involved). Also, the language includes several featrures that you normally don't find in BASIC, as well as some interesting ways to do things. Here are some points that I think are worth to be mentioned:


If you find this text helpful, please, support me and this website by signing my guestbook.