Information wants to be free...

uIP support for GR-SAKURA

I have now managed to get the uIP TCP/IP network stack running on the GR-SAKURA board. I'm using the Renesas PHY driver, but my own heavily modified (and simplified) implementation of the Ethernet driver.

The Renesas Ethernet controller has a "Zero Copy" mechanism that uses DMA transfer on incoming and outgoing packets. This is nice and all, but it comes into conflict with the uIP architecture with a single buffer. So I ended up with the separate single uIP buffer and two separate ethernet buffers instead, doing CPU based (memcpy) copying between them. Even though this is not as efficient, it prevents the need for any modifications to the core uIP source code.

One limitation with this initial implementation is that there is no handling of link up or down. The code expects the Ethernet plug to be plugged in at boot and remain connected.

To start using it, get the code from here and unpack it in the uIP source folder. (The "sakura" directory should be alongside the "unix" directory.) Then run "make" inside the "sakura" directory to create the "uip.bin" binary that may be uploaded the GR-SAKURA board.

I have also forked the original uIP repository and made the necessary changes on GitHub.

Topic: Open Source, by Kjetil @ 01/01-2019, Article Link

Joystick Mouse on GR-SAKURA

Here is another project based on the GR-SAKURA board. It translates joystick movement into mouse movement, so it can be used on a PC. This is done reading three analog inputs from the joystick and forwarding data over an UART using the simple Microsoft Serial Mouse format.

The software is based heavily on the 30JH joystick that I happen to have. This is a 3-axis joystick, and the last axis is used to simulate the button presses.

This command in Linux can be used to get it connected:

sudo inputattach -bare /dev/ttyUSB0
          


Here's a photo of the setup:

GR-SAKURA wth Joystick


Here is the main part of the code, which implements the serial mouse protocol:

#include "uart.h"
#include "adc.h"

/* Raw ADC reference values: */
#define JOYSTICK_POS_MAX 2464
#define JOYSTICK_POS_MIN 2080 /* JOYSTICK_POS_MAX - (128 * 3) */
#define JOYSTICK_CENTER  2048
#define JOYSTICK_NEG_MIN 2016 /* JOYSTICK_NEG_MAX + (128 * 3) */
#define JOYSTICK_NEG_MAX 1632

static unsigned char prev_buttons = 0;

static unsigned char convert_adc_to_move_value(short value)
{
  /* Scaling and manual conversion to two's complement. */
  if (value > JOYSTICK_POS_MIN) {
    if (value > JOYSTICK_POS_MAX) {
      value = JOYSTICK_POS_MAX;
    }
    return (value - (JOYSTICK_POS_MIN + 1)) / 3;

  } else if (value < JOYSTICK_NEG_MIN) {
    if (value < JOYSTICK_NEG_MAX) {
      value = JOYSTICK_NEG_MAX;
    }
    return ((value - (JOYSTICK_NEG_MAX + 1)) / 3) + 128;

  } else {
    return 0; /* Filtered. */
  }
}

static unsigned char convert_adc_to_button_value(short value)
{
  if (value > JOYSTICK_POS_MIN) {
    return 0b10; /* Left button pressed. */

  } else if (value < JOYSTICK_NEG_MIN) {
    return 0b01; /* Right button pressed. */

  } else {
    return 0b00; /* No buttons pressed. */
  }
}

static short invert_adc_value(short value)
{
  if (value > JOYSTICK_CENTER) {
    return JOYSTICK_CENTER - (value - JOYSTICK_CENTER);
  } else {
    return JOYSTICK_CENTER + (JOYSTICK_CENTER - value);
  } 
}

static int mouse_format(short x_move_adc, short y_move_adc,
                        short button_adc, unsigned char *data)
{
  unsigned char x_move, y_move, buttons;

  x_move = convert_adc_to_move_value(x_move_adc);
  y_move = convert_adc_to_move_value(invert_adc_value(y_move_adc));
  buttons = convert_adc_to_button_value(button_adc);

  data[0] = 0b11000000;
  data[1] = 0b10000000;
  data[2] = 0b10000000;

  data[0] |= (buttons << 4);
  data[0] |= ((y_move >> 4) & 0b00001100);
  data[0] |= ((x_move >> 6) & 0b00000011);
  data[1] |= (x_move & 0b00111111);
  data[2] |= (y_move & 0b00111111);

  if (y_move > 0 || x_move > 0 || buttons != prev_buttons) {
    prev_buttons = buttons;
    return 1; /* Activity */
  } else {
    return 0; /* No activity */
  }
}

void mouse_loop(void)
{
  unsigned char data[3];

  while(1) {
    asm("wait");
    if (mouse_format(adc_get(0), adc_get(1), adc_get(2), data)) {
      uart0_send(data, 3);
    }
  }
}
          


Get the complete code under the MIT License here, which requires the RX GCC toolchain to compile.

Topic: Open Source, by Kjetil @ 12/12-2018, Article Link

eLua support for GR-SAKURA

I have managed to get eLua running on the GR-SAKURA board. It's an embedded version of version of The Programming Language Lua that can be run on bare-metal.

I forked the original eLua repository and made the necessary changes here on my own copy. Note however that this initial support is very basic; only limited versions of the "tmr", "uart" and "pio" modules are supported at the moment.

Here is an example Lua script that can be run on the board. Name it "autorun.lua" and put it in the "romfs/" directory to run it automatically on startup:

require "pio"
require "pd"
require "tmr"

print("Running LEDs on " .. pd.board())
print("Hold blue button to stop.")

while pio.pin.getval(7) == 1 do
  pio.pin.sethigh(0)
  tmr.delay(0,200000)
  pio.pin.sethigh(1)
  tmr.delay(0,200000)
  pio.pin.sethigh(2)
  tmr.delay(0,200000)
  pio.pin.sethigh(6)
  tmr.delay(0,200000)

  pio.pin.setlow(0)
  tmr.delay(0,200000)
  pio.pin.setlow(1)
  tmr.delay(0,200000)
  pio.pin.setlow(2)
  tmr.delay(0,200000)
  pio.pin.setlow(6)
  tmr.delay(0,200000)
end

print("Finished.")
          


Topic: Open Source, by Kjetil @ 09/11-2018, Article Link

GR-SAKURA Shell Update

I have added two new commands to the GR-SAKURA Shell. One is just a "button" command to print the state of the blue push button, known as SW2. The other "adc" command prints the binary value of the 12-bit A/D converter connected to analog inputs AN0 to AN5.

ADC command:

sakura> adc
AN0: 101111011010
AN1: 110000101110
AN2: 110001111111
AN3: 100000001000
AN4: 000000000001
AN5: 110000110001
sakura> adc
AN0: 101110111011
AN1: 110000000010
AN2: 110001010111
AN3: 110001000001
AN4: 011111000010
AN5: 000000000011
          


Button command:

sakura> button
released
sakura> button
pressed
          


Get the source code here or from my GitLab or GitHub pages.

Also consider using my updated instructions on to build the cross compilation toolchain for the Renesas RX CPU.

Topic: Open Source, by Kjetil @ 11/10-2018, Article Link

GR-SAKURA Shell

Renesas has more microcontroller reference boards. On another trip to Japan I picked up the GR-SAKURA board, which uses the Renesas RX63N microcontroller.

Like the GR-KURUMI, I have made a command shell interface for the GR-SAKURA as well, based on much of the same code, to control its LED and timer functions.

The shell is spawned as the UART on "SCI0", which has the RxD pin at P21 (aka IO0) and the TxD pin at P20 (aka IO1) on the board. The code and build environment also assumes that the pre-flashed USB mass-storage based bootloader is in use, so the binary may be transferred using that USB interface.

Get the source code here and follow this advice on how to setup the toolchain for compiling Renesas RX binaries. I have created custom C-runtime stubs and a linker script to work specifically with the pre-flashed bootloader. These are included in the source code tarball as well.

Here is a similar Python script that can be used to load script files remotely:

#!/usr/bin/python

import serial

class Sakura(object):
    def __init__(self, port):
        self.s = serial.Serial()
        self.s.port = port
        self.s.baudrate = 9600
        self.s.bytesize = serial.EIGHTBITS
        self.s.parity = serial.PARITY_NONE
        self.s.stopbits = serial.STOPBITS_ONE
        self.s.xonxoff = False
        self.s.rtscts = False
        self.s.dsrdtr = False

        self.s.open()
        self.s.flushInput()
        self.s.flushOutput()
    
    def __del__(self):
        self.s.close()

    def _command(self, cmd):
        print ">", cmd
        for char in cmd:
            self.s.write(char) # Write one character at a time...
            self.s.read(1)     # ...and read the echo.
        self.s.write("\r") # Finish command...
        self.s.read(10)    # ...and read the prompt.

    def script(self, filename):
        self._command("stop")
        self._command("d1 off")
        self._command("d2 off")
        self._command("d3 off")
        self._command("d4 off")
        self._command("clear")
        with open(filename) as fh:
            for line_no, line in enumerate(fh):
                self._command("%s %s" % (line_no, line.strip()))
        self._command("run")

if __name__ == "__main__":
    import sys
    s = Sakura("/dev/ttyUSB0")

    if len(sys.argv) > 1:
        s.script(sys.argv[1])
    else:
        print "Usage: %s <script file>" % (sys.argv[0])
          


One difference compared to the GR-KURUMI is that the LEDs on GR-SAKURA are all blue and named D1 to D4 instead. Here is a sample script:

d1 on
sleep 50
d1 off
sleep 50
d2 on
d3 on
sleep 100
d2 off
sleep 100
d3 off
sleep 500
d4 toggle
          


Topic: Open Source, by Kjetil @ 04/02-2018, Article Link

GR-KURUMI Shell

A follow-up on my previous articles about a GR-KURUMI Writer and the GR-KURUMI Makefiles. Here is a program written for the GR-KURUMI that provides a command shell interface against its LED and timer functions.

The shell is spawned on UART #0, the same one used for flashing, since this is most convenient. The DTR signal must be disconnected in order to avoid the chip going into flashing mode though. The shell provides a simple BASIC-style scripting interface. Commands can be put into a script/program buffer, indexed by 0 to 99, which can be run continuously.

Get the source code here and check the article on Makefiles on how to get the tool chain up and running. Then use the article on the Writer to flash the chip.

Here is a Python script that can be used to load script files remotely in an easy manner:

#!/usr/bin/python

import serial

class Kurumi(object):
    def __init__(self, port):
        self.s = serial.Serial()
        self.s.port = port
        self.s.baudrate = 9600
        self.s.bytesize = serial.EIGHTBITS
        self.s.parity = serial.PARITY_NONE
        self.s.stopbits = serial.STOPBITS_ONE
        self.s.xonxoff = False
        self.s.rtscts = False
        self.s.dsrdtr = False

        self.s.open()
        self.s.flushInput()
        self.s.flushOutput()
    
    def __del__(self):
        self.s.close()

    def _command(self, cmd):
        print ">", cmd
        for char in cmd:
            self.s.write(char) # Write one character at a time...
            self.s.read(1)     # ...and read the echo.
        self.s.write("\r") # Finish command...
        self.s.read(10)    # ...and read the prompt.

    def script(self, filename):
        self._command("stop")
        self._command("red off")
        self._command("green off")
        self._command("blue off")
        self._command("clear")
        with open(filename) as fh:
            for line_no, line in enumerate(fh):
                self._command("%s %s" % (line_no, line.strip()))
        self._command("run")

if __name__ == "__main__":
    import sys
    k = Kurumi("/dev/ttyUSB0")

    if len(sys.argv) > 1:
        k.script(sys.argv[1])
    else:
        print "Usage: %s <script file>" % (sys.argv[0])
          


A typical script file can look like this:

red on
sleep 50
red off
sleep 50
green on
blue on
sleep 100
green off
sleep 100
blue off
sleep 500
          


Topic: Open Source, by Kjetil @ 25/11-2017, Article Link

SDL-Man for SDL2

Eight years ago I released a Pac-Man clone called SDL-Man. Now someone has expressed interest and asked me to update the code to use the newer SDL2 library instead of the older SDL1 library. And so I did. The changes are mostly related to the initialization and handling of video and graphics, which has changed a lot with SDL2.

The source code is still released under GPL3 and can be found here. As before, the main SDL2 and SDL2_mixer libraries are required.

Topic: Open Source, by Kjetil @ 11/06-2016, Article Link

Directory Tree Diff Front End

You may recall the Directory Tree Diff program I presented earlier. This is a new and improved version of that program. Instead of just dumping the differences, they are now displayed through a curses-based interface, which can be navigated. The program can also start the regular "diff" program on any different files found.

Have a look:

Screenshot of new difftree.


The source code is released under the MIT License here.

Topic: Open Source, by Kjetil @ 06/02-2016, Article Link

Curses Cave Scroller

I like experimenting with curses, so I made yet another curses-based game. This time a side scroller, so check out this screenshot:

Screenshot of cave scroller.


Get the source code under a MIT License here.

Topic: Open Source, by Kjetil @ 02/11-2013, Article Link

Morse Input

I got this strange idea of using a telegraph key to input characters to the computer, after inheriting such a key from my grandfather.

So I made a SDL based program to try it out. SDL makes it easy to display a kind of oscilloscope screen to show the incoming pulses, and also generate a simple tone for "realism". The actual signal input can be provided in two ways, either by just hitting space or by using an actual telegraph key connected as a switch between the CTS and RTS signals on a RS-232 serial port! The program attempts to convert the incoming pulses using some timing rules, into characters that are output on standard out.

Here is the source code released under a MIT lisence.

Here is a screenshot of the SDL "oscilloscope":

Morse Oscilloscope


This is the ancient telegraph key that I used:

Morse Key


Topic: Open Source, by Kjetil @ 03/08-2013, Article Link

Playlist Frontend

Here is a simple playlist frontend (in curses, as usual) for other media players. It communicates with the player program through signals, so the functionality is rather limited, just stop and start, but it's very generic. I have tested the program against mplayer and mpg123.

The main feature, and the reason I coded this in the first place, was to get a filter function. This means taking a large playlist with filenames and entering a (search) text to filter out which songs to listen to.

Here is a screenshot:

Screenshot of playlist frontend.


The code is available under a MIT License here.

Topic: Open Source, by Kjetil @ 01/04-2013, Article Link

Crazy Eights

Here is a Python implementation of the card game commonly known as Crazy Eights, using the SDL-based pygame framework. I have designed it around a client-server model using a custom UDP-based network protocol, to be able to support multiplayer. It's possible to play in singleplayer, but the server still needs to be started, and the client simply connects to localhost. The game is always played with four players, and the remaining positions will be filled by bots.

The rules of the game are of the simplest variant. A player who puts an eight on the table does not get to decide the next suit, meaning the eight only acts as a universal (always allowed) card.

The source code is released under a MIT license and can be downloaded here.

Here's a screenshot:

Crazy Eights screenshot


Topic: Open Source, by Kjetil @ 04/08-2012, Article Link

Sudoku Solver in Curses

Once again I present a curses-based program. This time, it's a curses front-end for a set of sudoku solving algorithms that I developed.

The program tries to apply two different algorithms that will find unique solutions, and if both fail, it will start guessing. After a guess has been made, the two other algorithms will be applied again, and this may hopefully produce a solution. It is not as advanced as other solvers out there, so there is no guarantee that the sudoku will be solved. But I have been able to use it with success on many sudokus.

The user interface is fairly simple and is explained on the screenshot below. It is possible for the user to enter invalid numbers, and this will not be "detected" by the program. The result is just that the solving algorithms will fail.

Screenshot of sudoku solver in curses.


I have released the code under a MIT License here.

Topic: Open Source, by Kjetil @ 21/01-2012, Article Link

Curses Invaders

Following the tradition of curses-based games, I have now created another clone of a game popular in the 70's and 80's.

Here is a screenshot:

Screenshot of invaders in curses.


I have realeased the source code under a MIT License here. Also, for convenience, I have compiled (with MinGW and PDCurses) a Windows binary that can be downloaded here.

Topic: Open Source, by Kjetil @ 01/08-2011, Article Link

Python Instant Messaging

I looked around to find a simple way of setting up a private instant messaging server, but were unable to find anything easy. Instead, I just made a simple custom solution myself, with a server script and client script written in the Python programming language.

The finished solution turned out to be more like a conference/chat room (IRC with only one channel), but with some features found in instant messaging clients that I think are important. The idea is that there is one server, and then many clients connect to it and everyone will see everything anyone writes.

Here's a screenshot of the graphical Tk-based client:

PIMC client screenshot


I have tested the server with Python version 2.5.x and the client with versions 2.5.x and 2.7.x without issues. And since no special libraries are used, it is enough to just download the standard Python distribution, and start using the scripts.

The client and server is available under a MIT License, and can be downloaded here. Unfortunately, there is no documentation, but the scripts should be straightforward to use.

Topic: Open Source, by Kjetil @ 13/03-2011, Article Link

UDP P2P File Transfer

This is a highly experimental program to transfer files from one host to another using only UDP. It is not very fast (maybe about 4-5 times slower than a FTP transfer over TCP), but I can imagine that it may be useful in some rare cases where for instance TCP communications are blocked by a firewall. The program principle is similar to that of TFTP transfers, but this program contains a user interface to retrieve file listings, etc. Also, every program instance is both a client and a server, so it is more geared towards being a P2P application.

Be warned that the program probably contains a few bugs, and has at least the following known errors and problems:
- Files can become corrupted if some other source injects false UDP packages.
- Possible endianness problems. I had no way to test this, so there may be issues when using the application from a computer utilizing big endian.
- There is no check to prevent the same file from being shared twice.
- If the server changes a file, this is not detected by the client.

I have released the code under a MIT License here.

Topic: Open Source, by Kjetil @ 01/01-2010, Article Link

ASCII-fication Filter

I made a filter program to convert normal images into random colored ASCII characters. It is similar to aalib, but aalib does not use random characters, and uses only a few colors, (in order to comply with text terminals I think).

It operates on plain PGM (Portable Greymap) image files only, since this is easy to parse. You can involve the convert tool from ImageMagick to use any kind of image file, like this:

convert foo.jpg -compress none pgm:- | ./pgm-asciify | convert pgm:- foo.png
          


Please note that you will get the best results by using big images with high contrast.

The code is released under a MIT licence, and can be fetched here.

Here is an example:

Keyboard asciified.

Filtered from this image:

Keyboard in normal appearance.


Topic: Open Source, by Kjetil @ 19/04-2009, Article Link

Polaroid Digital 320 Camera

While digging around in my collection of junk (consisting of different hardware and electronics gathered over time), I found an old digital camera with the label "Polaroid Digital 320", presumably made sometime in 2001.

I searched the web to see if there was any Linux driver for this camera. It seems that some people have been trying to make a driver some time ago. The effort seems to have faded away, as there was little help to get from Polaroid (the camera maker) and Xirlink (the chip maker).

I decided to try on my own to get the picture data out of the camera, and learn more about the JPEG file format in the process. I was able to get further than the other people that have tried, because I was able to figure out more about the proprietary file format used by the camera, and how it differs from the official JPEG standard. (Details on these differences can be found in the README file in the source code.) This was possible because I made a JPEG decoder from scratch, and made adjustments to it everywhere to see what produced the best picture.

However, the result is not perfect, since there is still information missing about the optimal quantization for the different components in the picture. I attempted to reverse engineer parts of the official TWAIN driver from Polaroid, but with no success.

The source code for the download and decoder tool can be downloaded here. The code is released under a MIT licence, so feel free to reuse the code wherever you want.

The tool produces pictures in the portable PPM and PGM formats. You can use Netpbm to convert them something else.

Here is an example of a picture downloaded in three formats: color, grey scale and raw components (luminance, blue chrominance, red chrominance and another luminance component):

Color.

Grey scale (luminance only).

Raw components (Y1, Cb, Cr, Y2).


Topic: Open Source, by Kjetil @ 20/12-2008, Article Link

TinyBasic in Lex/Yacc

Lex and Yacc are two wonderful Unix tools that can create lexical analyzers and parsers for interpreters or compilers of programming languages. I used the modern counterparts from the GNU project; Flex and Bison to create an interpreter for TinyBasic, a simple dialect of BASIC.

The reference implementation for TinyBasic can be found in the first issue of the computer magazine Doctor Dobb's Journal. The implementation I have made differs a little, and has some extensions. More information can be found in the README file in the source tarball.

Although using BASIC is considered harmful, it is very easy to learn, and therefore easy to write an interpreter for.

Here is some sample BASIC code that will work with the interpreter:
(Same program that I provided for the Attoscript interpreter earlier.)

10 LET C = 10
20 PRINT "There are ", C, " bottles of prune juice on the wall."
30 LET C = C - 1
40 IF C <> 0 THEN GOTO 20
          


The source code can be downloaded here. (Licenced under GNU GPL version 3.)

Topic: Open Source, by Kjetil @ 20/09-2008, Article Link

Xlib Calculator

This program is only an experiment, and is not intended for practical use. It has many shortcomings, and there is already a better calculator named xcalc that is present in most X distributions.

The purpose was to try out programming directly against the low-level Xlib library. I have released the source code under a MIT License here. Feel free to look around in the code.

Here is a screenshot of the simple calculator:

Xlib calculator screenshot


Topic: Open Source, by Kjetil @ 25/07-2008, Article Link

Simple TO-DO Application

I have made yet another curses-based application. This time it's a simple tracker of things to do that are stored in a list, and managed from a terminal user interface.

Entries are actually edited by calling an external text editor (like vim). In order to do this, a temporary file is created. This file contains the editable fields, and the information is read back when the editor is closed. This may be considered unsafe, so think twice about putting sensitive information in, if the application is used in a multi-user environment.

I have released the source under the GNU GPL version 3, and it can be downloaded here. I have managed to compile this application against the PDCurses-3.3 library instead of the more common (n)curses library. This makes it possible to make Windows binaries as well.

Here is a screenshot of a PDCurses (using SDL) compilated version:

Todo application with PDCurses screenshot

(The entries are taken from this guide, in case you're interested.)

Topic: Open Source, by Kjetil @ 29/06-2008, Article Link

SDL-Man

I have made a portable (as in compilable on several platforms) Pac-Man clone using the SDL library. Since it is of course an "unofficial" version, I named it SDL-Man after the library.

It is written in C, and released under the GNU GPL version 3 license. The source code can be downloaded here, and a Windows binary with SDL runtime libraries can be downloaded here.

If you compile it for yourself on a Unix platform; remember to have both the main SDL library and the supplemental SDL_Mixer library installed first.

Here is a screen-shot of the start menu:

SDL-Man menu screen-shot


And here is an ingame screen-shot:

SDL-Man ingame screen-shot


Enjoy!

Topic: Open Source, by Kjetil @ 23/02-2008, Article Link

LCD Controller Program

I recently bought a LCD display (Warning: RAS syndrome present :-P) from an online hardware store. It has 20x4 characters and uses the (common) HD44780 controller. A standard parallel cable is used to communicate with it.

The store and the supplier recommends using a program named LCD Smartie to control the display. Although this program is open source, it is unfortunately made specifically for Windows. I tried to use another program (for Linux) named lcdproc, but I could not get it to display anything at all on the LCD. The solution is of course: Make your own driver and program(s).

Yes, I hacked together some code to successfully drive it under Linux, and the result can be downloaded here. The code is released under a MIT License, so you can do (almost) whatever you want with it.

If you want to use it on another platform you almost certainly have to change some something, since I used Linux specific port programming functions.

Here is a photo of the LCD displaying a quote from Linus Torvalds:

LCD displaying Linus Torvalds quote.


Topic: Open Source, by Kjetil @ 20/01-2008, Article Link

One-Time Pad Communicator

In times of overwhelming paranoia and government conspiracies, secure communications is vital. I have made a ncurses based communication program that utilizes one-time pads to encrypt textual communication transferred over a TCP/IP network (like the Internet). The program is simply named "otp".

As long as the pads contain totally random data, and they are transferred safely, it is impossible to crack the encryption by eavesdropping on the communication.

For the system to be secure, the pads should be transferred on physical medium like a CD or a USB pen-drive instead of over the network. They should also be disposed of after use.

A screenshot of the program in action:

One-Time Pad Communicator screenshot


I have released the source code under the GNU GPL version 3, and it can be downloaded here. You will need the ncurses library in order to compile it (as usual :-) ). I have only tested the program on Linux, but it should be compilable on most POSIX platforms I believe.

More detailed information can be found in the README file in the archive.

If you do not trust this program, (For all you know, I could be a sinister government agent.) you are free to look at the source code to verify its functions, and possibly correct them. That's the beauty of open source.

Topic: Open Source, by Kjetil @ 18/11-2007, Article Link

M80 Framework

A long time ago I found an old DOS application on scavenged 386-based computer. The name of the application was "Micro 80", and it was meant to be (I think) some kind of small-business CRM system. I liked the interface the application was using and decided to recreate it on Linux using the ncurses terminal handling library. The result is "M80".

The M80 Framework is made up of a "main framework manager" which is the executable file and a lot of modules that are shared libraries/objects. The modules are loaded dynamically, and are therefore not compiled into the framework manager.

Here is a screenshot of M80 in action, showing some modules loaded:

M80 Framework screenshot


I have released the source under the GNU GPL version 3, and it can be downloaded here. You will need ncurses to compile it. Note that if ncurses has mouse support, M80 will also get mouse support.

For more information, please consult the README file in the archive.

Topic: Open Source, by Kjetil @ 26/10-2007, Article Link

Block Edit

After having trouble finding a program I needed for a special task (To be honest, I did not search very thorough.), I decided to create it myself. The result is "Block Edit", as it is called in lack of a more descriptive (and complicated?) name.

It is basically a special purpose text editor. Instead of working on lines (like most normal text editors) this program sees the text as one large block/rectangle. All editing happens "in place" and no text is shifted in any direction. It's task area is limited I think, and the only things I can imagine it being used for is ASCII art/graphics or specially formatted data files for certain applications.

Here is a screenshot of the program in action:

Block Edit screenshot


You will need the ncurses library in order to compile it and the source can be found here. There is no Windows binary to get this time since curses programs require special treatment on that OS.

I must warn that you use this program at your own risk and take backup of the files you are trying to edit. Files will be heavily mangled when loaded (in case they do not have static line widths, or have strange characters) and may not look like you expect after saving them back to disk.

Topic: Open Source, by Kjetil @ 08/10-2007, Article Link

SDL Pong

After experimenting with SDL, I created a pong clone. (For those who do not know, "Pong" is a very classic computer game.)

I have released it under the GPL, and you can download the source here. I also compiled a windows binary that you can download here. (The zipfile also contains SDL.dll which is required to run the game on windows.)

Here is a small screenshot:

sdl-pong screenshot


Enjoy!

Topic: Open Source, by Kjetil @ 15/09-2007, Article Link

Attoscript

Attoscript is a very small programming language and interpreter (only 15K of source) that I designed myself. It is severely limited in many ways, but is intended for one task; running other programs.

Since the names microscript, nanoscript etc. are taken, I choose attoscript as the name for the language. "Atto" is the SI-prefix for Quintillionth/Trillionth.

The reason I actually created this language, was to have an alternative to batch files.
These are some of the improvements in the language over batch:
* Sleep instruction, to halt execution. (Ping trick anyone?)
* Creating random numbers.
* Reading user input into variables. (No hacks like generating and reading other batch files needed.)
* IF-construct that makes sense. (No strange "errorlevel" stuff.)

Here is a sample of what the language looks like:

var count
set count 10
label loop
echo "There are $count$ bottles of prune juice on the wall."
decr count
if count ne 0 loop
          


The interpreter is written in C, and the source can be downloaded here. (Licenced under GNU GPL version 2.)
I have also created a windows binary that can be downloaded here. (Compiled with Dev-C++.)

More information about the scripting language can be found in the README file in the source tarball.

Topic: Open Source, by Kjetil @ 19/08-2007, Article Link