Bluish Coder

Programming Languages, Martials Arts and Computers. The Weblog of Chris Double.


2007-02-03

Space Invaders gets Sound

Following up on my previous post, I've added sound to my Space Invaders Emulator written in Factor.

I used the .wav files obtained from the Space Invaders Didactic Emulator and also used the hardware information from that site to work out how the Space Invaders sound system worked.

If you have OpenAL and ALUT installed you should be able to run it with:

"apps/space-invaders" run-module

You'll need the Space Invaders ROM file, which you'll have to obtain, and place it in the 'apps/space-invaders/resources' directory.

So far it has only been tested on Windows but the sound support does work on Linux so it should be fine there. There is an issue with Mac OS X due to it having an older version of OpenAL. That issue is being investigated.

Tags: factor 

2007-02-03

OpenAL library wrapper for Factor

I've written a wrapper for the OpenAL sound library for Factor.

It's a thin alien wrapper around the C interface and was pretty easy to write given Factor's great C FFI support (called 'alien'). It has been tested under Windows and Linux and should be easy to get going for the Mac.

You'll need to install OpenAL and ALUT. Binaries for these are available from the OpenAL download page. With Ubuntu Linux you can install these libraries with:

apt-get install libopenal-dev libalut-dev

Note that you need the 'dev' versions for Factor to find the shared libraries.

Under Windows make sure you put the alut.dll file somewhere in your path. To test it from within Factor:

"libs/openal" require
USE: openal
play-hello

This should play the default 'Hello World' example. I want to use this to add sound to my Space Invaders emulator.

Tags: factor 

2007-01-27

Article Management System

I usually have a collection of notes and howto's that I've gathered as I worked out how to do things and file them away.

Sometimes they're not really relevant for blog postings or I prefer to be able to edit them over time to keep them up to date - which is not really useful for weblog postings without spamming people's RSS aggregators with old posts.

So around new years eve last year I wrote a very simple article management system in Factor. It allows me to write articles online using Wiky syntax, with an online preview. I can add tags and it automatically links tag pages to articles, lists of articles, etc. It basically does the bare minimum to do what I need. I'm hosting a couple of sites using it but the one for my technical articles is here: http://articles.bluishcoder.co.nz. Hopefully it stays up long enough after this weblog posting! It has been running another of my sites for the past month with reasonable traffic so it seems to be pretty stable.

The article manager can run multiple websites with different articles for each site and they're stored in a sqlite database.

I'll be tidying up the source code and making it available soon. It's written using the Factor 'furnace' web framework, and is the reason for the basic authentication code I wrote. It uses it to control site setup, content posting, etc.

Tags: factor 

2007-01-27

Zimbra Development with Eclipse

Following on from my earlier post about installing Zimbra, I wanted to setup a development environment so I could work on the source code. My development system is currently a Windows XP machine and I documented the steps I went through in this article: Zimbra Development with Eclipse.

Now I can use Eclipse to edit the code and deploy it on Tomcat for testing, using the Zimbra subversion repository code.

Tags: zimbra 

2007-01-10

Parser Combinators

Gilad Bracha has a post on parser combinators in Smalltalk. It's a good introduction to parser combinators and how to implement them in an OO language.

Christian Plesner follows up with more details on writing and using parser combinators in Smalltalk.

Christian mentions the left recursion problem for parsing things like lists. For example this grammar:

<expr-list> -> <expr-list> "," <expr> | <expr>

With a direct translation to parser combinators you get an infinite recursion due to expr-list calling itself immediately on entry.

The solution Christian presents is a good one and we have it in the Factor parser combinator library as well. The 'list-of' combinator takes two parsers and returns a parser that parses a list of items. The first parser that 'list-of' expects is the parser for the items, and the second is the parser for the separators. For example, a parser for a comma seperated list of numbers:

'number' "," token list-of

Another combinator I recently added was 'pack'. It is for parsing items enclosed in a begin and end token. It takes three parsers. Two of them are the parsers for the begin and end tokens and the other is the parser for the body inside them. So a expression surrounded in parenthesis would be:

"(" token 'expr' ")" token pack

Or a Dylan style block:

"begin" token 'expr' <*> "end" token pack
Tags: factor 


This site is accessable over tor as hidden service 6vp5u25g4izec5c37wv52skvecikld6kysvsivnl6sdg6q7wy25lixad.onion, or Freenet using key:
USK@1ORdIvjL2H1bZblJcP8hu2LjjKtVB-rVzp8mLty~5N4,8hL85otZBbq0geDsSKkBK4sKESL2SrNVecFZz9NxGVQ,AQACAAE/bluishcoder/-61/


Tags

Archives
Links