Portal for Apple II

This is about an Apple II version of Portal, the cake acquisition simulator released in 2007 (not the similarly named contemporary Apple II game released in 1986). Note: this project is just for fun and is in no way endorsed by Valve, etc.

While attempting to travel to the future to get a copy of Portal 3. I accidentally traveled to alternate-1987 and obtained a copy of Portal 1 for the Apple II!

In actuality I originally just planned to do the end credits. But the Apple II high-res mode has the perfect Aperture Science orange and blue colors, and one thing led to another...

And yes, I realize I am behind the curve on which video games I play.

Also, before people get too excited, only two levels are implemented. It's not the entire game.


This has proved much more popular than I thought it would, so I've put together a list of frequently asked questions.


Watch the video where I give it a playthrough:
Sorry for the repeat of the grainy end credits, the emulator sound isn't that great but I couldn't figure out a way to sync up the emulator text with the actual sound.

If you don't want to sit through all of the above, here's just the part with the Apple II playing Jonathan Coulton's "Still Alive" from the end credits.
Sorry for the lousy video quality, as I currently do not have a monitor capable of properly displaying 80-column text. Also I apologize for the noisy people in the hallway toward the end.


The Hardware

I have an Apple IIe platinum which was a fairly late/high-end Apple II model. It has a 1MHz 65C02 and 128kB of RAM. It's currently the 30th anniversary of the release of the platinum (January 1987).

Disk Image

The disk image is available here, you can play it on your Apple II, your favorite emulator, or even in an online emulator (note, the online emulator is of a regular Apple II (not IIe) so lower case text comes out as gibberish, and the 80-column mode used for the "still alive" part won't work)

Source Code

Portal-appleII is written mostly in Applesoft BASIC. The full source code can be found as part of my apple II dos33fs utilities:
git clone https://github.com/deater/dos33fsprogs and look in the "glados3.3" directory.

The source code (pre-tokenization) can be seen here if you're curious:


16 January 2017
You all are wearing me down, I might start working on an assembly language version. The semester is starting though, so this is more of a long-term project.

Also I'll probably start on the end-credits first (I really want to add Mockingboard AY-3-8910 support).

15 January 2017
As many have asked by now, yes I suppose I could run some numbers on various Applesoft compilers and assembly vs raw BASIC. I'll write up the results once I do some more experiments. It's a shame
Kansasfest doesn't have a peer-reviewed paper track.

14 January 2017
Too much peer pressure. Maybe there will be an assembly version.

Or maybe I'll follow through on an idea I had to make an Applesoft profiler/optimizer and see if I can speed up the BASIC code. Yes I'm aware there are BASIC compilers and Beagle Bros software that does similar stuff, but I'm weird and I'd like to run stock ROM BASIC if possible.

Interpreted Applesoft BASIC is horribly inefficient in places (on a GOTO, from what I understand, it does a linear search *each time* to find the destination line. So having subroutines at low addresses can help performance, etc).

13 January 2017 (continued)
For those of you suggesting I should make an assembly language version of this: I'd love to. But I'm up for tenure this coming year, so unless you have a plan for how I can either get a peer-reviewed academic paper from the work, or else some sort of federal grant, then I should probably be working on less fun projects :(

13 January 2017
Now I feel like I should get a joystick for my IIe so I can test on actual hardware. I'm *not* getting a mouse, because that will give the IIe a programmable timer and then I'd feel obligated to write a multi-tasking UNIX-like OS for the machine.

12 January 2017 (continued)
I added joystick support for aiming. Much faster, but it really hurts the framerate, especially on level 19. I'm hitting the limit of what I can do in reasonable time under Applesoft.

12 January 2017
Yes, the cursor is painful to move with the keyboard. Some commenters on comp.sys.apple2.programmer have convinced me to add joystick/paddle and/or mouse support. That should be doable, but I can only test in the emulator as I currently don't have actual joystick/mouse hardware.

Although having a mouse in slot4 is going to make it a bit harder to add Mockingboard soundcard support.

10 January 2017
Full playable version and video released! Was fun, but I've experiments to run and there's research to be done.

9 January 2017
More wrestling with hires color issues. Have the engine for Level 1 more or less finished though.

8 January 2017
A lot of progress, though have to admit much of the time was spent trying to get a companion cube that looked OK. Gave up on having the heart be purple as again the hi-res graphics is such a pain. I'm impressed anyone ever got useful colors in hires mode.

7 January 2017
Finally figured out how to get XDRAW (xor-draw) to generate orange/blue instead of purple/green. Hint: the insane Apple II hi-res mode has two values for the color black.

6 January 2017
Have minimal gameplay going. Most of the trouble is trying to get pseudo-sprites working from Applesoft and dealing with the horrible NTSC artifact issues with the HGR display.

5 January 2017
Got the music working. Implemented from scratch based on some sheet music I found. Applesoft is not fast enough to drive the speaker (at best it can make a sad groaning noise) so had to use an assembly language routine for the sound. It's still slower than I'd like.

As part of this work I wrote an auto-translator that takes a text file of music notes (similar to the QBasic PLAY command) and generates a BASIC file that plays said music.

4 January 2017
Got the text version of still alive going. I used as a reference code by Thomas Moss (spinneretsystems) who has a nice 286 QBasic version. I fixed up some minor issues with the ASCII art and transcription.


I've been putting some ideas into a file. TODO list
You might also be interested in: KSP for the Apple II
Back to VMW Software Productions
Apple II Forever