(back to project list)

Disassembly of Space Eggs for the Apple II

Space Eggs is a colorful shoot-em-up written in 1981 by Nasir Gebelli. According to Gebelli's wikipedia page, it was the sixth game he wrote and published through Sirius Software.

title action

The game is a "fixed shooter", with the player's ship moving horizontally across the bottom of the screen while aliens swoop down from above. It features fast, colorful animation, though it does flicker a bit due to the lack of page flipping.

The binary disassembled here is a 30.5KB single-file cracked version commonly found on Apple II sites. There are some vestiges of the copy protection in evidence, but it has largely been removed. The person who cracked the game was a bit sloppy though: about 25% of the file's contents are unused junk.

Space Eggs is copyright 1981 Sirius Software.

Playing the Game

Game play is straightfoward: paddle 0 controls the ship, button 0 fires shots. There are seven eggs per level, which do nothing but float around until opened. Crack the egg and shoot the alien that appears, taking care not to crack too many at once.

The first 4 waves have a single type of alien. After that, you get a randomized mix. If your ship is destroyed, the waves reset.

If you're flying the second-stage ship, and have at least 1,000 points, you will have one opportunity to merge with the first-stage ship on a level transition. You must line up your ship precisely with the descending ship, which is a little tricky with the joystick. If you succeed, you will have a merged ship with 3 cannons.

spider lips wolf fuzzball

Bugs & Quirks

The Fuzzball Bug

One notable quirk can be observed when a fuzzball hatches: if you move your ship to the left of the descending alien, it will slide horizontally across and kill you with no chance of escape. This appears to be due to a coding error in the fuzzball movement code:

                   ; Fuzzball movement homes in on ship.
1b20: a5 c3        MoveFuzzballDown lda     alien_col
1b22: c5 f9                        cmp     ship_pos_coarse   ;are we lined up on the ship?
1b24: f0 09                        beq     :move_down        ;yes, just move down
1b26: 90 05                        bcc     :move_right       ;we're to the left, move right
1b28: c6 c3                        dec     alien_col         ;we're to the right, move left
1b2a: 4c 2f 1b                     jmp     :move_down

1b2d: e6 c3        :move_right     inc     alien_col
1b2f: 20 58 19     :move_down      jsr     MoveAlienDown
1b32: 60                           rts

1b40: a5 c3        MoveFuzzballUp  lda     alien_col
1b42: c5 f9                        cmp     ship_pos_coarse   ;are we lined up on the ship?
1b44: f0 09                        beq     :move_up          ;yes, just move up
1b46: 90 05                        bcc     :move_right       ;we're to the left, move right
1b48: c6 c3                        dec     alien_col         ;we're to the right, move left
1b4a: 4c 2f 1b                     jmp     :move_down        ;BUG - should be move_up

1b4d: e6 c3        :move_right     inc     alien_col
1b4f: 20 78 19     :move_up        jsr     MoveAlienUp
1b52: 60                           rts

When the fuzzball is supposed to be moving up and to the left, it actually moves down and to the left, but can't move down because it's already at the bottom. Instead of zig-zagging toward the player's ship it just charges straight at it. The bug can be fixed by setting 1B4B:4F with a debugger, or:

] CALL -151
* 292B:4F
* 15FDG

Joystick Control

The game was designed to be played with a game paddle, which provides precise positioning in a single axis. The ship is positioned in two-pixel increments and isn't allowed to get too close to the screen edges, so values outside the range [0,104] are ignored.

This feels a little odd when a joystick is used, because the full range is [0,255], so a centered joystick reporting position 128 moves the ship all the way right. It usually feels okay because pushing left/right moves the right way, but the ship shouldn't move when the joystick is released, and it's kind of annoying to line up the ship when docking.

You can make the ship behave properly for a self-centering joystick (push left to move left, push right to move right, let go to not move) with a patch by Tom Phelps:

] CALL -151
* 1AAE: 84
* 1AB1: C0 57 B0 04 A6 FB D0 CD C0 7F 90 06 A6 FB E0 69 90 AD 60
* 15FDG

The patch actually treats 107 as the center rather than 128, because the game's modified paddle read routine under-counts by 16%.

Glitchy Screen Transition

If you watch the bottom corners during the screen transition, as the white screen is filled center-out with the title screen or a black screen, you can see some flickering. This is due to the way the code copies data.

The CopyScreenRect function starts by copying the top and bottom lines as whole bytes, then draws the left and right edges, blending the new content and the white pixels. The bytes in the four corners are written twice: once as a full un-blended byte, once with the correct blending. Because the sides are drawn top-to-bottom, there's a longer delay between the first and second writes of the bottom corners, so the the glitch is more noticeable there.

The appearance can be improved with a patch by Tom Phelps:

] CALL -151
* 4960: C8 B1 04 91 00 B1 06 91 02 C8 C4 0E 90 F3 EA EA
* 49A0: 02 B0 04 E8 4C 72 46 4C BF 49
* 15FDG

Copyright 2020 by Andy McFadden