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");
    /* 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");
    sng = LoadModule(argv[1]);
    if(!sng) {
        printf("Load error.");
        goto exit;

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

    return 0;

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

Rolling and Rotating scrolltext (Old School VIII)

I made today a little Monkey X Pro demonstration: Rolling and rotating scrolltext (Old School VIII). Now it works perfectly. Like in Old School VII, the letters fade in and out at the bottom of the circle of letters. I have used my Font 2 PNG program to grab individual characters of a ttf-font to png-images for the program. Perhaps I will later share the source code of the demonstration…

Enjoy the nostalgia! 🙂

The idea behind the code of the rolling and rotating scrolltext:

  • At every update frame 30 characters (png-images) from the scrolltext are drawn in a form of a circle, each character with 12 degrees step (12 *30 = 360), let angle related to this angle be angle1
  • When drawing the character images, the angle that increases in 12 steps is added to each character in addition to this angle is added other angle variable, let this be angle2, that is decreased (the direction of rolling and rotating) by 1 degrees at every update frame
  • Because of my (probably clumsy but working 🙂 )implementation:
If angle2 Mod 12 = 0 Then
  angle2 = angle2 + 12
  scrollTextOffset = scrollTextOffset + 1
  • in DrawImage method rotation angle is angle1 + angle2 + constant that adjusts the letters to the right place on the circle

As to he fade out and fade in for the letter images, you may adjust the letters with alpha values as you best you see it is sensible, probably somewhere at the bottom of the circle.

That’s it! Do try to make make your own version with programming language of your choice. I recommend my Font 2 PNG program for the font.

Good luck!

The first time I saw this kind of effect created was some time in the late 80s on Amiga in following demo:

Ah! Those good old Amiga demos. Kind of magic at their time.

Shortly about my early Amiga times

My first Amiga was Commodore Amiga 500 with Kickstart 1.3 plus TV-modulator in order to get the picture to TV. The contents on the TV were hardly readable as it comes to any text. For playing games quality of graphics output was decent.

Later I got SCART cable to connect the graphics output of Amiga to TV. That was something else, one could even read the text on the TV without getting red eyes and tears. 🙂 A bit later I finally got a 14” monitor to use with Amiga SCART cable as the connect cable for graphics and sound output.

It was 1988 when SoundTracker 2.5 was released, which was the first SoundTracker that didn’t crash on Amigas with Kickstart 1.3. I don’t have any real education on making music. The way I have learned making music was listening to ”real” music and music modules other people had composed with Amiga. As I got my Amiga 500’s audio output connected to an old Pioneer amplifier with big speakers it was simply amazing to listen to Amiga’s music that was built with 8-bit samples.

Working with an Amiga 500 with only 512kb of (CHIP) RAM was quite a limitation. Usually I didn’t use Workbench (Amiga’s graphical user interface) but AmigaDos as operating system environment when programming with Amiga. This was because Workbench of course took some of the limited amount of memory available for the user.

Here’s a video from one unfinished Amiga project I was working 2003 – 2004 (not from my early Amiga times, though 🙂 ):

You may be interested int the source code of the demonstration above.

With only one disc drive (with Amiga 500 I didn’t ever have a hard disk) all the AmigaDos commands were read from directory named ”c” – c for command. For the sake of speed (disc drives are slow) it was possible to put the most used AmigaDos commands to RAM disc or make them “permanent” to RAM memory. I don’t remember the AmigaDos command to do this, but this was faster than reading from the RAM disc anyway… Putting AmigaDos commands to RAM of course also decreased the amount of available memory for example for a text editor and testing the compiled and linked assembly program…

Later, when I bought an additional disc drive, Senator, to my Amiga 500 working got easier: It wasn’t only the question of available memory, but also the available space on a single disc. Full capacity of Amiga’s DD disc is 880kb, the space available after formatting the disc was of course a little less.

When working with the additional disc drive, I made boot disc of my own to start the system, where I had put all the needed AmigaDos commands, libraries, applications and so on. My own work was on the additional disc drive. Ah, how things got easier…

The description above compared to working with desktop systems nowadays may be a bit amusing to younger generations… 🙂

Shortly about my Amiga gaming history (1987 – 1993)

Soft start for this year, look back in time… In older blog post I wrote about my computer gaming history on Vic 20 and on Commodore 64, now something about my Amiga times…

My first Commodore Amiga was Amiga 500, which I got eventually upgraded with additional disc drive and 2 MB of (real) FAST memory.

Although I was more into programming, demo scene demos and making music with Amiga than playing games in my Amiga times, I had some fine moments with games too.

One of the first — if not the first — game that I saw on Amiga was Hybris in 1987 at my friend’s place, while I was still using my good old Commodore 64. Seeing Hybris on Amiga was quite a blast for me: I thought it was graphically and musically at the same level than coin up games I’ve seen as a kid.

Take a look and be amazed: 🙂

I remember, that I always wondered (and still do), how the programmers had the time and skill to program this kind of quality game in those early years of Amiga games. All those attack waves, complicated movements of enemy ships, so many bobs (blitter objects) in addition to sprite usage, all movement in one 50hz frame, though smooth scrolling was made every second frame. One thing that probably helped to make this game possible was the use of only 256 pixels as width of the screen; this allowed the programmer(s) to use assembly instruction lsl instead of mulu when calculating the position of an object to the screen. Assembly instruction mulu is much slower than lsl, which shifts the bits to the left making multiplications needed somewhat fast.

Some time at my high school (lukio) times I programmed a program that took an IFF image as input and as output the program produced a binary file that consisted of coordinates to “attack wave” one had drawn with some painting program, for example Deluxe Paint. If the drawn attack wave crossed itself, the problem which way to follow was solved by using different colors… Quite clumsy, but that’s me… 🙂 Anyway this program made possible an arbitrary possibilities of continuous attack waves (at least almost).

One early gem in the world of Amiga games is The Faery Tale Adventure. It took quite a lot of time to finish this game. The labyrinth of the wizard took a lot of patience to get through. Fortunately one of my cousins was an expert to draw maps of games and had a lot of patience. 🙂

Below is a long play video of the game:

One game I played with my friends a lot was Ports of Call. Though this game is quite one-sided in a way that in practice it is best to use only the route between San Francisco and Cape Town. Though, with friends this game was still fun to play.

This game is nowadays available to PC and smart phones as free game.

As to strategy games, Kingdoms of England was fun to play with friends. Though, again there is one thing, that made this game in practice pointless: The choice of starting place in the map. There was one area in the map that as starting area gave the player too much advantage: The one who gets at the beginning of the game most tax income, will win the game, if one uses the resources one has in sensible way.

But again with friends this game was still fun to play, because we could as human players make agreement, that the one who had most advantage at the beginning of the game, wouldn’t attack human players, but only against computer’s troops. Another way to play this game in reasonable way, was to agree, that none of as human players don’t choose as starting area the area which makes it too easy to get more tax income at the beginning of the game a lot faster than others.

Video below:

The sequel to Kingdoms of England, Kingdoms of England II: Vikings, has more elements as it comes to strategy. But there is one bug in the game: The computer as opponent can build a castle one playing turn faster than human players (it takes many playing turns to build a castle that can’t be built bigger anymore)…

A good game that taught a lot of strategy and sensible usage of resources is Empire: Wargame of the Century. Video below:

I wasn’t really into flight simulators, but with a friend Sky Chase was a good game; against computer the game was pointless: Too easy. When the game begins, the two plains are flying to opposite directions and the only thing one has to do to shoot down the computer controlled plane is, to turn one’s plain 180 degrees and fire. 🙂

 A game I had a lot of fun with friends was North and south. The game has fine graphics and lots of humor too. 🙂

 Shadow of the Beast was technically fine with excellent music. At first the game was very difficult, but eventually it got easier with practice, though I never finished it completely. I was only a few steps away from the end, but somehow I managed to fail. Though I saw the end: My friend managed to finish the game.

Just a quick mention of good game that I had only as demo from an Amiga magazine, namely nice mind game Bill’s tomato game.

At the time original and good view on teaching strategy — and sympathy to the poor lemmings — were the Lemmings games. Video below from the first Lemmings game:

A game that I still can’t believe is possible to implement on an Amiga 500 with only 512kb of CHIP memory is Turrican II. How on earth the programmers managed to implement all those many details, smooth scrolling, huge levels and so on — all happening in one 50hz frame! This game truly gave the player challenge for sometime! And the music of the game: One of the finest hours of Chris Hülsbeck on Amiga! It must be mentioned that in the intro there is 7 channel music, replay routine coded by the musician himself (Amiga has only 4 hardware channels).

One game was interesting in the way that some levels had completely different concept of gaming, namely Batman the Movie. The game is a mixture of a platform game, car game, flying game and puzzle solving.

As to racing games, the Lotus Turbo Challenge games were excellent. Video from second Lotus game:

Ah, one early gem in the world of Amiga games: Battle Chess. At the time I saw this game for the first time, I was still using good old Commodore 64. Seeing this kind of chess game on an Amiga 500 was amazing! Video below:

One game I almost forgot is Flood. If my memory servers me right, I had this game only as a demo, but it was something somehow new. Mind / puzzle game that was some how original at the time. See the video:

 Well, that was something I can remember from my good old Amiga times… If I remember some more games I had fine moments with my friends, I may update this post later… Of course this is just a brief view back in time…

A Game That I’ve Always Wanted to Create…

The computer games that have given me best gaming experiences ever, are Commodore 64’s Ultima IV and Ultima V. In my youth I always wanted to create a game like these. Many, many years ago I even started making some kind of Ultima like game on Amiga in assembly and C, but I never got that project finished. I made everything myself, the code, graphics and musics.

Here’s a screenshot from work in progress from WinUAE (Amiga emulator):


The screenshot is from a demo written in assembly where there is jumping scrolltext (in Finnish) with the three bitplanes jumping separately. In the demo there’s a little world where the boy in the picture wanders, destroys ghosts and in the end finds his love…

Both demo and the unfinished game that is written in C use Amiga’s system routines. The unfinished game doesn’t have (of course) a scrolltext. The graphics that are made with Amiga’s Deluxe Paint II, are only experimental…

Hopefully I will sometime in the future find time to make this kind of a game for PC, probably in BlitzMax. Because of lack of time, I prefer nowadays to use a programming language, that makes it possible to get something done pretty quickly. And for the sake of nostalgia, the game would have 2D graphics like the original Ultima IV and Ultima V of Commodre 64 (and Amiga).

In the scrolltext it says: ”[Ja he] elivät onnellisina jne…” That’s in English: ”[And they] lived happily etc…”