(no subject)

Friday, June 17th, 2011 09:42

Something I still miss from the ORCA development shell for the Apple IIgs (at least, I think that's where it was) is the option to interpret a command name which is directory as a command to change to that directory; essentially letting you omit “cd ”.

Old WireWorld

Wednesday, October 26th, 2005 17:45

When I used the Apple IIgs, I played with an implementation of an extension of the WireWorld cellular automaton.

My previous entry contains the programs I recently wrote to decode my old pattern files. (If you read it earlier: I've now updated it to include a full SHR converter.)

These were originally created in 1996-1998, except for “Sample.Fix”, which is a trivial modification of a pattern which came with the program.

The extensions are rather complex in the details, but essentially, green cells are crossovers (horizontally moving electrons don't interact with vertical wires, etc.) and cyan cells are switches (electrons arriving on the wire that ends at the switch break or join the wire that (typically) crosses the switch).

Larger views.

I recently found I wanted to retrieve some old Apple IIgs image files. After vague memories and some research, I found that they were “Super Hi-Res” images, which are dumps of screen memory in SHR mode, passed through the PackBytes compression routine.

I haven't found any on-the-web documentation of the SHR layout, but according to books and my successful decoding, the pixel data starts at the beginning of the file, has 160 bytes per row, 200 rows, and no end-of-row data.

After the image data are 200 scanline control bytes (SCBs) and 16 color tables. I haven't looked at decoding these yet.

In 320 mode, each pixel is 4 bits specifying that color in a 16-position color table. In 640 mode, each pixel is 2 bits, specifying ((x-position mod 4) + pixel) in the color table; the default color table has black and white in the same position in each group of 4, and the same colors in the 1st and 3rd, and 2nd and 4th, subgroups of the color table. Thus, any pixel can be black or white (which was used for fonts) and pairs of pixels can be any of 15 distinct dithered colors (there are necessarily two grays).

Here's a program in C to decompress PackBytes format:

unpackbytes.c )

This program, in Common Lisp, will convert an uncompressed SHR image to PPM:

shr.lisp )

The :ww-colors option exists because the particular files I wanted to convert were written by a program for running the WireWorld cellular automaton, which used a custom palette, but wrote its pattern files with the standard palette.