AmiKIT – Compiling a C program to Play a MED module

I recently downloaded from the official AmiKIT site the free version of AmiKIT. It’s great! I love it! I love the Amiga!

While testing the AmiKIT in an environment, that reminds me of the environment I had with the good old Amiga 4000, I got a spark to learn Amiga things again.

It would be nice finish my old classic 2D Ultima style RPG game. But where to find the needed documentation?

Below is a little video of my AmiKIT early adventure:

In the video an old C program to play MED music modules is compiled and tested. The C compiler that is used is VBCC.

Below is that program in full:

/* This program loads a module, and plays it. Uses medplayer.library,
   octaplayer.library and octamixplayer.library, if required. Could be
   used as a small simple replacement of OctaMEDPlayer. */

#include <stdio.h>

#include <exec/types.h>
#include <libraries/dos.h>
#include <proto/exec.h>
#include <proto/dos.h>

/* These two must be included in this order. */

/* #include "proplayer.h" */
#include "proto/medplayer.h"
#include "proplayer.h"



int main(int argc,char *argv[])
{
    struct MMD0 *sng;

    struct Library *MEDPlayerBase = NULL;

    if(argc < 2) {
        printf("Usage: example2 <song>\n");
        return;
    }
    /* Assume 4-ch mode (medplayer.library)
       We use V7 to obtain RequiredPlayRoutine */
    MEDPlayerBase = OpenLibrary("medplayer.library",0);
    if(!MEDPlayerBase) {
        printf("Can't open medplayer.library!\n");
        return;
    }
    printf("Loading...\n");
    sng = LoadModule(argv[1]);
    if(!sng) {
        printf("Load error.");
        goto exit;
    }
   GetPlayer(0);
    PlayModule(sng);

    printf("Press Ctrl-C to quit.\n");
    Wait(SIGBREAKF_CTRL_C);

exit:
    FreePlayer();
    UnLoadModule(sng);
    CloseLibrary(MEDPlayerBase);
    return 0;
}

Time will tell if my RPG made on Amiga will be ever finished…