Prince of Persia: the Apple II source

It’s been a good few months for the 8 bit versions of Prince of Persia. Last October saw the release of a C64 version. Yesterday the original source code for the Apple II version was uploaded to github! Read about how Jason Scott recovered that source code from 20 year old disks (similar to what I did recently!)

The game was originally written in assembler so the source code was already out there. How? Machine code is the language a machine understands and assembler is a human representation of that machine code. For example, the machine code “A9 00 8D 20 D0” is actually this more readable assembler: (that inserts the value 0 into the memory location $D020)

LDA #00
STA $D020

The assembler code released yesterday goes one step further. It uses labels, variables and comments. See BOOT.S as a good example. Variables are defined at the top and labels are used throughout making it a lot easier to deal with moving and adding code around. Look for the text “skewtbl” where you’ll find a simple loop that reads in data from memory and inserts it into 2 registers.

:0 ldy sector
 lda skewtbl,y
 sta $3d
 lda sectaddr,y
 beq :1
 sta $27
:rdsect jsr $005c
:1 dec sector
 bne :0

 lda SLOT
 jmp $900

skewtbl hex 00,0d,0b,09,07,05,03,01
 hex 0e,0c,0a,08,06,04,02,0f

sectaddr hex 00,09,00,00,00,00,00,00
 hex 30,31,32,33,34,00,00,00

Jordan Mechner puts it more poetically:

Non-programming analogy: Video game source code is a bit like the sheet music to a piano sonata that’s already been performed and recorded. One might reasonably ask: If you have the recording, what do you need the sheet music for?
You don’t, if all you want is to listen and enjoy the music. But to a pianist performing the piece, or a composer who wants to study it or arrange it for different instruments, the original score is valuable.

Props to this Slashdot post for the extra links. Also worth a look is the development diary of the C64 version and there are videos showing how the game was made back in 1985!

Giants: Citizen Kabuto going cheap!

If you want a humorous FPS and have $2.99 to spare you can’t really get any better than Giants: Citizen Kabuto. It’s 50% off right now as part of an Interplay promotion at GOG.

It’s an old game, released back in the dawn of time (or the year 2000, whichever came first) but it holds up well. There’s very funny dialogue, the graphics were amazing for their time and still look great. Back then you’d be hard pressed to find a machine that could play it well but that’s not a problem with any sort of modern machine.

Go on, go on, go on. It’s lots of fun and I can’t recommend it enough.

RIP Jack Tramiel

Jack Tramiel, the man who founded Commodore and brought Atari back from the dead died on Sunday at the age of 83. RIP.

lemon64 thread.

Here’s a great Cringley post on Jack Tramiel.

What I learned this week that I didn’t know before was that the people who worked for Tramiel really loved him. Jack Tramiel was no Steve Jobs: he was better.

The Commodore 64 was a phenomenal success. People forget that in the early 1980s the C64 outsold the Apple ][, IBM PC, and the Atari 400/800 combined. Commodore was the first to sell computers through discount retailers, opening whole new distribution channels. And don’t forget it was Jack who saw the value in Amiga, which in many ways set performance targets that took Apple years to beat. It would have been very interesting to see how the Amiga would have faired had Jack Tramiel stayed at Commodore.

I should have written more in this post yesterday but I didn’t have time. The Commodore 64 was the first computer I really obsessed about and learned loads about. Previously I had dabbled in BASIC using the Vic 20 and then a 48K Spectrum but after I got a C64 I learned how games were coded, learned quite a bit of assembler and produced and distributed my first software. That software wasn’t amazing or anything but I was always learning new things.

So, thanks Jack for creating the company that created such an amazing computer that had a huge influence on my life. When Steve Jobs died last year there were glowing blog posts about his machines. I vaguely recall an Apple II in a school lab but I hardly ever used it. The C64s in the same lab were much more interesting!

Gaia Machina


How did they manage to squeeze all that into a 64k executable? Watch it fullscreen. Amazing.

Reading the top voted comments on this post gives the impression that some /. visitors are not altogether that geeky but the replies are a lot more interesting.

I can’t seem to make heads or tails of this post. It’s techno-babble and word salad. I guess I should remember this feeling when I talk about programming with my non-programming friends.

Sort of sad as a programmer you have no knowledge of some of programming history.

Scroll like you mean it in Windows

One of the most annoying aspects of Windows after using Linux on the desktop for 10+ years was how the mouse wheel scrolled windows.

On Linux desktops I could hover over a window and scroll it without focusing. It was really useful when I had a browser window with instructions behind a terminal or just comparing the contents of two windows. The same happened when scrolling panes in file managers. I could scroll directories when hovered over that side of the window and files when over on the other..

So, imagine my frustration when I realised I had to click the side of the Explorer window I wanted to scroll in Windows? It was doubly annoying if I had selected files as I’d have to click an empty area or CTRL click an already selected file to select that side of the window.

Well, there’s a simple solution. Alex Leonard found and blogged about Wizmouse. It simply does what I expect, it scrolls the window under my pointer, whether it’s focused or not.

Wonderful!

Speedy password cracking

Earlier today Jeff Atwood tweeted:

you should *really* be scared if your passwords are all lowercase. 12 chars in 75 days on my box..

He was referring to his post on speed hashing where a video card GPU is used to calculate the hash of any given text. Compared to a computer CPU it does it much faster.

all 6 character password MD5s 47 seconds
all 7 character password MD5s 1 hour, 14 minutes
all 8 character password MD5s ~465 days
all 9 character password MD5s fuggedaboudit

It’s honestly scary and really time for everyone to use pass phrases. They’re not perfect either but they’re better because they’re longer and easier to remember. Some of my passwords are not phrases yet, this pass phrase generator (or this one) should help make it easier to change those.


* obligatory xkcd cartoon.

I bought an app: Podkicker Pro


I use the free version of Podkicker, a free podcast player for Android every day so when I saw there was a pro version I immediately bought it.

It has a vastly different UI and it somehow detected my original Podkicker subscriptions (I presume from the cloud?) but did not detect my already downloaded podcasts so it looks like I’ll be using the free version for a while. The UI will take some getting used to too as it’s so different but I wanted to support the author as I like the free version so much. Here’s a great review of the pro version if you’re interested.

Related: I don’t buy apps (some great comments in that thread too)