Bluish Coder

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


2007-02-08

Concurrency via Generators in Javascript 1.7

Neil Mix, the author of Narrative Javascript, has a post about implementing concurrency in Javascript 1.7 using the new generators feature of the language.

His example is here and the threading code behind it is just 4K. The example requires Firefox 2.0 for the new Javascript 1.7 features.

Tags: javascript 

2007-02-08

Installing Zimbra on Ubuntu 6.10

Zimbra is an open source email server. It does email, calendar, contacts, and various other useful things that software like Microsoft Exchange does.

Zimbra has some very nice web based tools that make it operate very much like a desktop application. Some screenshots from Wild Bill's blogdom are here.

Zimbra is open source. They have a commercial version with extra features and support. And an open source version with limited support through the forums. You can apparently build from source but the process is a little painful and not well documented. The problem is that Zimbra has a number of dependencies on other open source projects and they don't provide direct downloads for those dependencies.

This means you spend a lot of time tracking down what software is needed (OpenLDAP, MySQL, etc) and need to get the specific versions required by Zimbra. These versions are listed in a 'howto build from cvs' document but that is out of date. So you need to trawl through the Makefiles for each of the Zimbra third party requirements to find the version numbers and track down where these can be found. Even after all that I was unable to get things to build so for now I'm sticking to their binary release until I can find out what the problem is.

The binary release for Ubuntu was also a bit tricky to install. After installation it wouldn't start OpenLDAP, giving this error:

Initializing ldap...TLS: error:02001002:
system library:fopen:No such file or directory bss_file.c:352

It turns out that this is the result of Ubuntu 6.10 not using 'bash' as its primary shell. '/bin/sh' is symbolically linked to '/bin/dash', a lightweight bash-alike. It doesn't have 'source' which is required by most of the Zimbra scripts ('source' is the same as '.' which Zimbra could also have used). Changing Ubuntu to use '/bin/bash' for 'bin/sh' fixes the problem and Zimbra installed fine.

Here are the basic steps I did to get Zimbra installed on Ubuntu 6.10 under VMWare Server:

  1. Install Ubuntu 6.10
  2. relink '/bin/sh' to point to '/bin/bash'
  3. sudo apt-get install curl openssl libxml2 libexpat1 libgmp3c2 libpcre3 fetchmail libidn11 openssh-server
  4. Setup DNS A and MX records for the server
  5. Download and unpack the Zimbra Ubuntu open source binary
  6. Run the installer
The key part is changing the 'bin/sh' link.

Tags: zimbra 

2007-02-05

Firefox 3 talk at Kiwi Foo Camp

Rod Drury writes about Rob O'Callahan's talk at 'Kiwi Foo Camp' about Firefox 3.

A session with huuuuge implications first up today from Robert O'Callahan from Mozilla. He's based in NZ but drives the rendering engine of Mozilla/FireFox. (Aside1: I think that it is completely cool that such a web significant thing is being built from a guys sun room in New Zealand - rocking!)

Tags: mozilla 

2007-02-04

Emulating other Intel 8080 Based Arcade Games

I've done some refactoring of the Intel 8080 emulator I wrote in Factor and split the games out into separate libraries. ROM's can now be stored anywhere with the path to the root of the ROM directory set in the 'rom-root' variable.

Many of the 8080 based arcade games use similar hardware to Space Invaders. If they use a similar control mechanism and you don't mind non-perfect emulation (colours and sounds will be as per Space Invaders) it's easy to create an emulator if you have the ROM files.

The main thing you need to know is where the ROM files need to be loaded in the emulated RAM. For example, you can get a list of 8080 based games here. For this example I chose 'Balloon Bomber'.

You can find out where the ROM's need to be loaded by looking in MAME's drivers/8080bw.c file. Look for ROM_START( ballbomb ):

ROM_START( ballbomb )
  /* 64k for code */
  ROM_REGION( 0x10000, REGION_CPU1, 0 )     
  ROM_LOAD( "tn01",         0x0000, 0x0800, ... )
  ROM_LOAD( "tn02",         0x0800, 0x0800, ... )
  ROM_LOAD( "tn03",         0x1000, 0x0800, ... )
  ROM_LOAD( "tn04",         0x1800, 0x0800, ... )
  ROM_LOAD( "tn05-1",       0x4000, 0x0800, ... )

  /* color maps player 1/player 2 */
  ROM_REGION( 0x0800, REGION_PROMS, 0 )  
  ROM_LOAD( "tn06",         0x0000, 0x0400, ... )
  ROM_LOAD( "tn07",         0x0400, 0x0400, ... )
ROM_END

For this quick example we're interested in the CPU region, It lists the files and their starting memory locations and lengths.

In Factor this game can be emulated by calling the (run) word from Space Invaders. It takes the title of the window, a sequence describing the ROM files and a CPU object as parameters on the stack.

For the CPU object we just use the <space-invaders> CPU since the hardware is pretty close to the Space Invaders machine. The sequence contains 2 element arrays, each containing the ROM file name and the location to load it. So to run Balloon Bomber, this is all that's needed:

"apps/space-invaders" require
USE: space-invaders
"Balloon Bomber" &lt;space-invaders> {
    { HEX: 0000 "ballbomb/tn01" }
    { HEX: 0800 "ballbomb/tn02" }
    { HEX: 1000 "ballbomb/tn03" }
    { HEX: 1800 "ballbomb/tn04" }
    { HEX: 4000 "ballbomb/tn05-1" }
  } (run)

You'll need the ROM files in the 'ballbomb' subdirectory off the 'rom-root'.

I've added 'Balloon Bomber' to my repository as an example in 'apps/balloon-bomber'.

For some games you need to adjust the controls and graphics displays, etc. I'll do a later post on how to do this but it basically involves specialising various <space-invader> generic words.

Tags: factor 

2007-02-04

Lunar Rescue Emulator

The Space Invaders emulator I wrote is actually a generic 8080 emulator. Quite a few arcade games used similar hardware to the old Space Invaders machines.

One of those is Lunar Rescue. I added a Lunar Rescue emulator by using the Space Invaders routines but with the Lunar Rescue ROM code loaded. This works fine. The sounds are probably slightly different and the colours are not right but the game plays fine. I'll work on these issues to get it as correct as possible.

To implement the Lunar Rescue game I create a TUPLE specific for the game and delegated all functionality to the Space Invaders TUPLE. To implement the correct colours and sounds I'll add methods specific to the Lunar Rescue TUPLE. Factor does OO easily.

I did some refactoring of Space Invaders and now running the 'apps/space-invaders' module brings up a window with buttons for the supported games. Clicking a button runs Space Invaders or Lunar Rescue.

The ROM files have moved too. They now live in subdirectories off 'apps/space-invaders/resources'. You'll need to create 'invaders' and 'lrescue' subdirectories, each containing the require ROM files. These are specifically:

  • invaders/invaders.e
  • invaders/invaders.f
  • invaders/invaders.g
  • invaders/invaders.h
  • lrescue/lrescue.1
  • lrescue/lrescue.2
  • lrescue/lrescue.3
  • lrescue/lrescue.4
  • lrescue/lrescue.5
  • lrescue/lrescue.6

You'll notice I've gone towards using the separate ROM files for Space Invaders rather than the complete 'invaders.rom'. This is to make it easier so you don't have to manually concatenate the files.

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