Merry Christmas!

This autumn was quit tough with studies for me.. Functional programming in Haskell is difficult.

But the autumn is over and the Christmas knocks on the door… Here’s little Christmas intro I wrote in Cerberus X:

The next semester is going be even more tough: I’m going to start and finish my Bachelor of Science thesis. That includes seminar and some education on writing academic text. And of course I’m having some other courses too.

What this means to Blue Bit Entertainment is, that I probably won’t have lots of time and energy for it.

Hard work.. But..

Merry Christmas and Happy New Year 2020 to all of you!

Easy Math Challenge v2.0 — now with sound again!

I have rewritten Easy Math Challenge in Cerberus X and now the game is with sound again. In the video below, the music is added to the video and the sound effects are off. The video is made with my phone and it was not allowed to record the sound.

When you have solved enough puzzles, you’ll get into a resting screen where there is different background music and old school text scrolling.

The game is a good time killer while sitting for example in a train. 🙂

Mid, Left & Right functions for Strings in Cerberus X

It’s beginning to be late night, but I want share these with you.

Many of you probably remember Mid, Left and Right functions for strings in basic programming languages.

  • Mid returns from given position x amount of chars
  • Left returns from left x amount of chars
  • Right returns from right x amount of chars

These are easy to implement in Cerberus X, since it has nice string slicing methods.

Implementation for Mid:

Method Mid:String(str:String, startPos:Int, howMany:Int)
        Return str[(startPos)..(startPos+howMany)] 
End

Implementation for Left:

Method Left:String(str:String, howMany:Int)
     Return str[0..howMany]
End

Implementation for Right:

Method Right:String(str:String, howMany:Int) 
     Return str[(str.Length()-howMany)..(str.Length())]
End

You can test these for example with print Mid(“This is String”,5,2).

That’s it for tonight..

Font Class for my Font 2 PNG’s fonts in Cerberus X

My studies keep me really busy and tired… Still, I’m working on Cerberus X version of Easy Math Challenge, because there seems to be problem with sound in Monkey2 with 64-bit compilations for Android.

Anyway, here’s direct implementation (earlier I did this for Monkey X) of font class to use with fonts made in my Font 2 PNG for Cerberus X.

The source (the code is directly from my Cerberus X editor, but highlighting isn’t quite right):

Import mojo2
Import brl.databuffer

Class MyFont
	Field maxHeight:Int
	Field fontDat:DataBuffer
	Field gfxFont:Image
End

Class FontTest Extends App

	Field bg:Image
	Field font1:MyFont
	Field canvas:Canvas
	
	Method OnCreate:Int()

		bg = Image.Load("cerberus://data/bg.jpg",0,0)
		
		' -------
		' Font
		' -------
		font1 = New MyFont
		font1.gfxFont = Image.Load("font.png")
		font1.fontDat = New DataBuffer(95*4*2) ' 95 characters, for each character two 4 byte integers
		font1.maxHeight = 51
		font1.fontDat = DataBuffer.Load("cerberus://data/font.dat")		
		
		canvas = New Canvas()
		
		Return 0
	End

	Method OnRender:Int()
	
		canvas.DrawImage(bg,0,0)

		' drawString assumes, that we have a canvas called canvas
		drawString(font1,"Sample Text", (640 - (stringWidth(font1, "Sample Text"))) / 2, 60)		
		canvas.Flush()
		
		Return 0
	End
	
	Method drawString(font:MyFont, text:String, x:Float, y:Float)
		Local len = text.Length()
		
		Local chrs:Int[]
		chrs = text.ToChars()
		
		For Local i = 0 To len - 1
			'                          width of a character in font                                          pos. of character in font
			canvas.DrawRect(x, y, font.fontDat.PeekInt((chrs[i]-32)*4*2 + 4), font.maxHeight, font.gfxFont, font.fontDat.PeekInt((chrs[i]-32)*4*2), 0, font.fontDat.PeekInt((chrs[i]-32)*4*2 + 4), font.maxHeight)
			x = x + font.fontDat.PeekInt((chrs[i]-32)*4*2 + 4)
		Next
 
	End
	
	Method stringWidth:Int(font:MyFont,text:String)
		Local len:Int = text.Length()
		Local chrs:Int[]
		Local length:Int = 0
		
		chrs = text.ToChars()
		
		For Local i:Int = 0 To len - 1
			'                                width of character in font
			length = length + font.fontDat.PeekInt((chrs[i]-32)*4*2 + 4)
		Next
		
		Return length
	End
		
End

Function Main:Int()
	New FontTest()
	Return 0
End

I’m a bit lost for words, but if you find my “poor man’s Font 2 PNG” useful, feel free to use this code.

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…

Suicide Express (C64) cover made with PO-28 Robot

I recently got for birthday present a Pocket Operator PO-28 Robot. It’s a pocket synthesizer with sounds that remind me of C64’s SID sounds.

20190703_154000 (2)

PO-28 Robot

 

I made a short cover of Commodore 64’s Suicide Express tune with it. For me it is an unforgetable tune. The cover is only 30 seconds loop..

In the video below it’s played for 4 times.

Back in the day I enjoyed Suicide Express as game probably because of the music. It would be fun to remake this game.

🙂

Calculus has gone long way — now at version 3.4.1

At this point there are no known bugs in Calculus, but I recently fixed a significant bug.

The function of undo button has be renewed. Now it undoes in intelligent way every term added to the polynomial.

Those bugs.. I should make some kind of checklist and before implementation do some planning. With Calculus, I have pretty much just written the code from scratch without planning…

Little video, I made with my phone:


I still have plans for a PC version. At the moment my studies don’t take so much time, thus the first PC version may see light reasonable soon… I hope so…

C64’s Stix – I wish I had the time…

Nowadays studies take all my time.. Now I’m actually a student of computer science in a university… Since January of this year, I’ve lived in the world of Python, JavaScript & Ajax, CSS and HTML in the context of web server programming… I wish that the 7th week assignment of this course was behind… I’m working on the 5th now.. Today begins the Algorithms 2 course too for me..

I just made a video of me playing C64’s Stix. There’s something magic in this game..

Perhaps next summer.. Though, I’ve already made plans what to study in the summer..