“The Abominable iPhone Zombies”
– A PETSCII Horror Doom Scroller

A new game for the Commodore PET, also, how to detect keyboards on a Commodore PET.

A Brand New PET Game

Rumors about me working on a game for the Commodore PET may not be entirely unfounded. In fact, I’ve been doing so, and I’ve progressed to the point that there is a playable WIP (work in progress). It still lacks sound and I may tune the level progression, but story and essential game mechanics are already in place.

Speaking of which, this is how the game (and our story) starts, right at the beginning:

The first screen of "The abominable iPhone Zombies" for Commodore PET

The game is intended for any Commodore PET with a 40-column screen, ideally running at 60Hz. It will run on 50Hz models, as well, but the timing has been set up with 60Hz in mind. And, while I have invested in some PETSCII text effects, it runs on minimal memory requirements of 8K RAM. (There’s still some left in order to fit sound.)

As may be told by the title screen, the game isn’t meant exactly dead seriously, more as a playable joke. So, in the spirit of bringing the story home, it’s not an easy game. (In fact, I tried an easier introductory level, but found that it really harms the game and the general idea.) Just as in real life, there is no guaranteed path to success, but it’s astonishing where you can actually sqeeze through.

The title screen of "The abominable iPhone Zombies" for Commodore PET
The Abominable iPhone Zombies, title screen.
For a change in green phosphor emulation.

The real inspiring aspect of this, though, is that the game has been drafted and developed entirely in the emulator. The screens were drafted with convenient use of the “click cursor”, which allows you to position the PET’s cursor anywhere on the screen by a simple mouse click or touch-tap. Then, the drafts were exported as BASIC programs for later review and change, and eventually exported as hex-dumps, ready for integration in assembler code. This has been written in a simple text editor and was then assembled and test-run by a simple drag&drop of the source file onto the emulator. Finally, the assembled program was exported as a PRG-file, which is now ready to play.

So, without further ado or spoilers: you can always find the latest code here (in the “PRG Library” inside the emulator, in the ”New PET Games” section, or under this link,

where you will find links for both download and a to fire it up in the emulator.

Or just click here, for a direct link to the game in emulation:

We could have included a demo video, but why should we, if you can have the “real thing”?

Well, here’s a video, anyway:

(That transition, BTW, is not a simulation, but a proper implementation of the “10 PRINT” random maze swiping by.)

The emulator came also handy for testing the various ROM versions and keyboard types. (Just switch the configuration in the ROM menu and reload the assembled object code by a right-click on the displayed file label, which brings up its associated context menu.) — Speaking of keyboards…

PET Keyboard Adventures, Continued

Complementing our previous excursion into PET keyboards, here‘s how to detect the keyboard type of a Commodore PET (as used in “iPhone Zombies”), in order to implement our own low-level keyboard scan routine in 6502 code.

Generally speaking, there are just two types of keyboard layouts and related kezboard matrices, the graphics keyboard (including the chiclet keyboard of the original PET 2001) and the business keyboard.
Moreover, there are 3 ROM revisions to consider:

Regardless of the keyboard type and the editor used, each of these ROMs has the keyboard decoding table in their exact same location. Which, in turn, allows us to determine the keyboard type by inspecting that table.

So, first, we’re going detect the ROM revision, based on a well known value. Say, based on the IRQ vector, which is distinctive for each of the ROMs and easy enough to locate (at the very top of the addressable memory range, at address $FFFE.)

And here are the IRQ vectors of the major ROM revisions (we will check just the low-byte, as this is already significant):

Once we have figured out the ROM revision, we may try to determine the keyboard type:

And here is our little subroutine:

kbdDetect
                lda $FFFE               ;IRQ vector, low-byte
                cmp #$1B                ;is it ROM 2?
                beq kbdROM2             ;yes, branch…
                cmp #$42                ;is it ROM 4?
                beq kbdROM4             ;yes, branch…
kbdIsGfx        lda #0                  ;must be the graphics keyboard
kbdStoreFlag    sta kbdBusiness         ;store as keyboard type flag
                rts                     ;exit (all branches)
kbdROM2         lda $E727               ;ROM 2: load code for row 4, column 0
kbdCheckCode    cmp #$41                ;is it "A"?
                beq kbdIsGfx            ;yes: it's the graphics keyboard
                lda #$FF                ;no:  it's the business keyboard
                bne kbdStoreFlag        ;unconditional
kbdROM4         lda $E63A               ;ROM 4: load code for row 4, column 0
                jmp kbdCheckCode

kbdBusiness     .byte 0                 ;keyboard type flag:
                                        ;    0 .... graphics
                                        ;  $FF .... business

Feel free to use this in your code. :-)

And that’s it, for this post.

Note: the section on the Japanese PET character ROMs and keyboard, found previously here, has moved to a post of its own: Japanese Attractions: Kana on the PET 2001.