Ledmatrix Chip-8 Emulator

So the next thing could be an Chip-8 emulator runinng on a medium sized Atmega.

CHIP-8 is an interpreted programming language, developed by the late Joseph Weisbecker. It was initially used on the COSMAC VIP and Telmac 1800 8-bit microcomputers in the mid-1970s. CHIP-8 programs are run on a CHIP-8 virtual machine. It was made to allow video games to be more easily programmed for said computers.

Memory

CHIP-8′s memory addresses range from 200h to FFFh, making for 3,584 bytes. The reason for the memory starting at 200h is that on the Cosmac VIP and Telmac 1800, the first 512 bytes are reserved for the interpreter. On those machines, the uppermost 256 bytes (F00h-FFFh on a 4K machine) were reserved for display refresh, and the 96 bytes below that (EA0h-EFFh) were reserved for the call stack, internal use, and the variables.

Registers

CHIP-8 has 16 8-bit data registers named from V0 to VF. The VF register doubles as a carry flag. The address register, which is named I, is 16 bits wide and is used with several opcodes that involve memory operations.

The stack

The stack is only used to store return addresses when subroutines are called. The original 1802 version allocated 48 bytes for up to 12 levels of nesting; modern implementations normally have at least 16 levels.

Timers CHIP-8 has two timers. They both count down at 60 hertz, until they reach 0.

There are two version of the platform, the Chip-8 and schip (Super Chip). The biggest difference is the display size.

Chip-8 64×32 Super Chip 128×64

But most import it has some decent games:

I found some ugly c code code here, cleaned it up and made an SDL version on OS X.

git://github.com/optixx/megaledmatrix.git

chip8sdl.dmg

[flash]http://vimeo.com/2905435 [/flash]

Update: os x and DNS

I found some facts how os x is handling the dns lookups. Because i was wondering why changing the resolv.conf doesnt seem to change Safari’s or Firefox’s lookups. The key to this is lookupd and DNS Service Discovery. Actually i came across this from an iphone related problem, which is quite well documented at saurik webpage.

New iTunes and iPhoto importer

I updated my iTunes and iPhoto import scripts. Added Growl feedback and some hacks to handle iTunes performance problems, some iTunes really gets slow and i had to add timeut exception handling. So just call this from the terminal:

python addToiTunes.py -d /media/mp3s -r -p

Where all Mp3 Files below the path get imorted to iTunes and playlists get created. The playlist’s name depends on the subfolder structure below the import path. If u have arranged your stuff like /media/mp32/artist/album, u get a proper playlist name “Artist – Album”

The other script is just a bulk importer for iPhoto.

python addToiPhoto.py -d /media/photos -r

Where all pictures below the path are imported and each subfolder yields an new album in iPhoto. Quite simple and less pain if u have to import a huge photo collection. Tried to use Automator for this, but he outcome wasn’t so good.

addToiPhoto.py
addToiTunes.py

Stupid Fritzbox DNS

Since my DSL provider’s DNS updates are really slow i wanted to switch to opendns, which is a good a idea anyways. But wtf i cant change the default dns in my fritzbox. No way to do it via the web admin. Ok why bother i said to my self and went for the shortcut. To find out that Leopard is buggy and u cant unassign the default dns on the Airport device, its simply greyed out. Bummer!

So do it the old school way and editet the resolv.conf. Where nslookup and dig seem to eat this but Firefox and Safari seem to give a flying fuck about this. Even Network pref.panes doesnt seem so sync againt resolv.conf. Seems to be a know problem to the people at the opendns forums. Ok went back to the fritzbox, and found a way to force the dns via the a config file. Just fillin this:

overwritedns1 = 208.67.222.222; overwritedns2 = 208.67.220.220;

Used a java tool to pull and push the config directly from the box. Take a look here

Ja…funny. How easy u can spend an hour in front of a computer, just to take a shortcut for the slow dns cache update…

ITunes commandline importer

Since i swichted my fun computing (music, videos + web ) from linux to OS X i needed some tools to make thinks easier with iTunes. I was used to amarok, which make music library handling pretty straight forward. I really hate the way iTunes handles music libs, so i switched the iTunes self organzing features off and wrote a little script using python and appscript to import music via commandline.

Features

  • batch import of folders
  • create playlists on the fly
  • remove duplicates from playlist
  • recursive mode to import trees
  • Import Folder ‘Album’ to Playlist ‘New’ and set Artist to ‘Slayer’ and Album to ‘South of Heaven’

    python addToiTunes.py -d Album -p New -a 'Slayer' -A 'South of Heaven'
    

    Import from Folder ‘music’ recursiv, where Playlist ,Artist and Album get name after the Folders.

    Folder Sample

    music 
          artist
               album 1
               album 2
    

    Will yield playlists name like “artist – album 1″ and “artist album 2″

    python addToiTunes.py -d music -r
    

    download