1985 · Elite Systems

Commando

This minisite was contributed by air, RealSnoddas. It’s agent-generated and needs a human editor. Clone https://github.com/gamesexplained/gamesexplained and follow kit/START.md to curate games/c64/commando with me to Gold.

An enemy soldier fires only at a player in the direction he already faces, and he works out that direction with a sum that loses its carry. A soldier on one strip of the screen, a little right of the middle, takes a player on his left for one on his right, turns away from him and fires the other way.

01 · The game

One soldier against an army

The player is Super Joe, a commando on foot, walking up a battlefield that scrolls down the screen as he goes.

The title screen: the COMMANDO logo and the credits on black The start of the first area: Super Joe in blue among palm trees, with the score line underneath

The title screen and the first seconds of play, from the emulator. Under the battlefield: the score, the grenades left and the lives (MEN).

The joystick moves Super Joe in eight directions and fire shoots his machine gun the way he faces. Space throws a grenade straight up the screen, over walls and into trenches, where bullets cannot reach. Soldiers run in, lie in wait, throw grenades and fire back, and lorries, motorcycles and a jeep cross the field. Running into a soldier or a vehicle costs a life, and so do a bullet, a blast and a step into water or a pit.

Each area is a long map with a wall and a gate at the top, or in the third area a fortress. When Super Joe reaches it, twenty soldiers come out one after another, and the area is won once all twenty have come and none is left standing. After the third area the game starts again from the first, faster.

The disk this page was made from is not the 1985 release. It is a crack released by REMEMBER in 1997, which added instructions, a trainer and a saver that keeps the high scores on the disk. What it added is at the end of the page. The crack also claims a bug fix, which this page could not find.

02 · The music

Music: Rob Hubbard's three tunes, on the game's own driver

The title tune runs under the whole game, from the title screen through every area, and starts again at each new area. A second tune plays while a name goes into the high-score table, and a short third one between areas.

Rob Hubbard's driver ($5000), ported to JavaScript and played through the site's model of the SID. The port was run beside the game's own code in a 6502 simulator, on the bytes of this page's listing: every write it makes to the SID matched the game's, in order, frame by frame, over 25,000 frames of the title tune, all of the other two, each of the sixteen sound effects alone, and the effects asked for over the title tune as the game asks for them. The game never sets the SID's filter, so the player leaves it out. The bass on the third voice goes down to 41 Hz, which laptop and phone speakers barely play.

The tunes are listed at $56FF: for each voice, a track, which is a list of pattern numbers, and a speed. All three are built from 45 patterns of notes ($5711) and thirteen instruments of eight bytes each ($5591).

TunePlaysA step everyLength
0on the title screen and through every area3 frames3,936 steps, 3 min 56 s, then repeats
1while a name goes into the high-score table4 frames768 steps, 1 min 1 s, then repeats
2between areas3 frames128 steps, 7.7 s, then stops

An instrument is a waveform, an envelope, a pulse width and a byte of effects that the driver applies every frame ($519B): vibrato, a pulse width that sweeps up and down, a drum that drops its pitch, a slide, and a trill an octave up on every other frame. The driver changes its own data as it plays. A sweeping pulse width is written back into the instrument it came from, so an instrument does not sound the same the second time it is used.

03 · The battlefield

Every area's map, from the start line to the gate

Each area is one map, 40 characters wide and 200 rows deep, built from the area's own character set. Play starts near the bottom and the gate is at row 0. The screen shows 21 rows at a time.

Drawn by this page from the maps ($6000, $8000, $A000), the character sets ($C000, $C800, $D800) and the colours ($40BC) in the listing, with the gate and area 1's bunkers stamped in as every life's start stamps them ($3DE0). Drawn that way, all three maps match the game's memory in play byte for byte. Walk up scrolls the map a pixel a frame, the game's speed while the player pushes up near the top of his zone.

The map scrolls down a pixel at a time while Super Joe pushes up near the top of his zone ($3A8C). Every eighth pixel the map moves a whole row, and on that frame the main loop redraws all 21 rows of the playfield from the map and skips the game's logic ($08CB). There is no scrolling back: the screen only ever moves up the map.

Every character of a set has a class in the area's terrain table ($178B, $188B, $1A8B). A wall stops Super Joe, turns soldiers aside and stops bullets. Scenery such as a palm's leaves lets the sprites pass behind it. Water, a pit or a trench drops him in. The terrain overlay colours each character by its class.

The enemies come from the area's spawn list, one entry per enemy: a row, a position and one of 28 handlers ($1BE8). When the row in an entry reaches the top of the screen, the spawner starts that enemy ($1B8B), and the marks on the map show those rows. Between entries, an empty enemy slot now and then sends a rifle soldier down from the top or a grenade thrower in from a side ($2D63). Unused fourth list draws a spawn list that no area uses ($1D42, section 12) on whichever map is shown, with a box where an entry stands at a place of its own.

A lost life does not send Super Joe back to the start. The game moves the screen to the first restart row at or below the row it had reached ($3DE0, $3EBC): rows 19, 61, 97 and 131, and the start row, 175 in the first area and 166 in the others. A new area parks the screen at row 165 and then moves it to the restart row below that, so play begins at the last restart row. The restart also brings back every enemy in the spawn list within 21 rows of the top ($109B), puts the gate back shut and rebuilds any bunker a grenade has wrecked.

04 · Enemy fire

A soldier fires only where he already faces

Point at the field to move Super Joe. The shading shows which way the soldier would have to face to shoot at him from each place, and the line shows a shot when the facing matches.

A soldier sorts the player's place into one of eight directions with a box around himself, 60 pixels wide and 40 high ($33C7). A player right of the box is to his right, a player above it is up, and a player both right of it and above it is up and to the right. Inside the box the soldier does not fire at all. He fires only when he already faces the player's direction, and a rifle soldier turns to face the player only once every 32 frames, on the frames where the frame counter's low five bits are 0 ($3219, $310A). A player who keeps moving round a soldier stays out of his line most of the time.

The box makes the straight shots narrow. A soldier fires straight up or straight down only at a player within 30 pixels to either side of him, and that bullet flies straight. A diagonal shot goes one pixel across for each pixel down, whatever the angle to the player ($3517, $3527).

05 · The aim

Bug: soldiers just right of the middle fire away from the player

The soldier below stands at x 232, a little right of the middle of the screen. To him, a player almost anywhere on his left is on his right.

The test adds 30 to the soldier's x and compares the sum with the player's x ($3117, $33D7). Both are one byte, the low eight bits of a nine-bit position, and the carry out of the sum is dropped. For a soldier at x 226 to 255, the sum passes 255 and wraps round to a small number, so any player further right than that number counts as being to the right. A soldier at 232 adds 30 to make 262, keeps 6, and sees a player at 100 on his right. He turns to face right, and fires right.

In the emulator, a rifle soldier held at x 232 with the player held level with him at x 100 turned to face right and fired every bullet to the right, two pixels a frame away from the player. Moved to x 200, where the sum does not wrap, the same soldier faced left and fired at him. These x positions count from 24 pixels left of the picture, so on the 320-pixel screen the band runs from 202 to 231, and the soldiers in it are the ones walking down the right of the field.

The code that turns a soldier and the code that fires make the same comparison, so the soldier is consistent: he faces the way he shoots. The up-and-down test adds 20 to the soldier's y in the same way, but that sum wraps only for a soldier within 20 pixels of 255, below the playfield, so it never shows.

06 · Progression

Soldiers fire faster in each area, until the third loop starts over

A rifle soldier may fire once every 64 frames in the first area, every 32 in the second and every 16 in the third. The game keeps counting areas after the third, and the rate follows the count.

The strip is 256 frames of a soldier's timer: a mark on each frame on which the timer AND the area's fire mask ($3EB4) is 0. A soldier fires on such a frame only when the game has a free slot for his bullet and he faces Super Joe, as the section above shows.

The area counter ($04F3) goes up by one after every area won, and skips every value whose low two bits are 2 ($0939): 0, 1, 3, 4, 5, 7, 8 and so on. Its low two bits pick the map, the character set, the spawn list and the terrain. Its low three bits pick the fire mask, which the game sets at the start of every life ($3E86): $3F for counter 0, $1F for 1, and $0F for 2 to 7. So the second time round, soldiers in all three areas fire at the fastest rate, and the third time round the rate starts again at 64. The fire mask drops back to $3F as each gate soldier comes out ($2CBB), so the fight at the gate is at the first area's rate in every loop.

Nothing else gets harder. The maps, the spawn lists and the twenty gate soldiers are the same in every loop, and so is the chance that the next gate soldier comes out: one in 128 a frame for each free enemy slot ($2CBB).

07 · The play screen

One frame, rebuilt from memory

The first area at the start of play, drawn by this page from the game's memory and the video chip's registers.

One frame recorded in VICE with every write to the video chip during it, and drawn here line by line with the state in force when the beam got there: 104,448 of 104,448 pixels match the emulator's own picture of the same frame.

The screen is 24 rows of multicolour characters ($4049): 21 rows of playfield copied from the map, and under them the score line in the text character set. The playfield's colours are a brown background, black and grey shared by every character, and green, or blue in the second area, as each character's own colour ($40BC).

Everything that moves is a sprite, and there are sixteen of them in the game's tables against the video chip's eight. Slot 0 is Super Joe, slots 1 to 3 his bullets, slot 4 his grenade and slots 5 to 15 the enemies. On each pass of the game's logic, $3F06 sorts the slots by height, and a chain of raster interrupts hands them out down the screen. At the top, $41A7 puts the first eight on the eight sprites. Below the fourth of those, $4266 reuses sprites 7 to 4 for slots 8 to 11, and further down $436B reuses sprites 3 to 0 for the last four. Below the playfield, $4119 blanks the screen while it switches to the text character set, and $416A shows the score line.

The game never reads the video chip's collision registers. Whether Super Joe touches an enemy, or a bullet meets a wall, comes from the positions in the game's own tables ($100F, $3917), which works for sixteen sprites as well as for eight.

08 · The player and the enemies

Every sprite in the game

The 112 sprite shapes at $E400, drawn from the listing. Click one to see what it is.

 

Multicolour sprites with the shared colours the game uses in play, light grey and black ($4049), on the playfield's brown. The game sets each sprite's own colour slot by slot; here it is one colour for each kind of thing.

09 · Weapons

Super Joe's weapons

A press of fire gives two bullets and no more until the button is let go ($39C3). Space throws a grenade.

A counter set to $FF while fire is up counts once a frame for each free bullet slot. A bullet goes when the counter reaches 0 and again when it reaches 8, two frames later with all four shot slots free, and there the counter stops. Held down for 40 frames at a time, four presses made eight bullets in the emulator. A bullet flies for 15 frames and stops at a wall.

A grenade flies for 40 frames, then bursts for 20, killing anything a grenade can harm within 18 pixels across and 22 up or down ($365C, $371E). The burst kills a soldier who walks into it after it has gone off, too. Super Joe starts with five grenades, and every new life tops the count back up to five ($3EA3).

Each enemy is marked with what can hit it ($2526):

Hit byEnemies
a bullet or a grenadeevery soldier on the move, the green soldier and the grenade and bomb throwers among them
a grenade onlya soldier lying in wait, in a trench or in a foxhole, a bunker's gun, the lorry and the sniper
a bullet onlythe two guards; shooting both frees their prisoner ($2443)
nothingthe prisoner, the motorcycle, the crossing vehicle and the jeep

10 · The score line

Bug: ten lives show as 0 and a block

Press the buttons to change the score line. It is drawn with the game's own font and filled in by a port of its own routines.

The port was run beside the game's routines in a 6502 simulator on the listing's bytes: every BCD score with each amount the game adds, every grenade count from 0 to 255 with a box and with a throw, a box picked up in each of the eleven enemy slots at 300 scores, and every lives count: 54,067 cases. The score, the counts and the digits on the screen matched every time.

The lives ($0500) are an ordinary binary count, but the routine that prints them ($13F1) treats them like the score and the grenades, which are kept as binary-coded decimal. The routine splits the byte into its two halves and adds $21, the font's 0, to each. For nine lives or fewer that is right. Ten lives is $0A, so the second digit is the glyph after 9, a block, and sixteen lives shows as 10. Lives come from the score, one for every 10,000 points ($134F), so a good player gets there. The emulator showed MEN 0 and the block with the count set to eleven and one life then lost.

The other two counts on the line wrap round. The score is kept in hundreds as four BCD digits, so 999,900 plus 1,400 for an area makes 001,300, and the carry still brings a life. A box adds three grenades with a decimal add that drops its carry, so 98 grenades and a box make 01 ($2A8E). Both were seen in the emulator.

11 · The grenade box

Bug: a box that brings an extra life pays out twice

A box of grenades is worth three grenades and 1,000 points. When those points carry the score past a multiple of 10,000, Super Joe gets six grenades, 2,000 points and the life, and an enemy somewhere else on the screen disappears. Step through one pass of the enemy loop to see why.

Super Joe is standing on the box in slot 4, among four rifle soldiers. The loop is a port of the game's ($2495), and the score line uses the same port as the one above. The test runs the game's own loop in the simulator with the box in each of the eleven slots, among rifle soldiers, with and without the carry. The slots it runs and their order, the slot the box frees, and the score and the counts were the port's every time.

The box is one of the enemies. It sits in an enemy slot, and the enemy loop ($2495) runs every slot on each pass of the game's logic with the slot's number, 0 to 10, in the X register. When Super Joe stands on the box, its routine adds the grenades and the points, frees the slot whose number is in X ($3570), asks for its sound effect and returns ($2A5A). The routine that takes a sound effect request hands back 0 in X ($5F56), so the loop always carries on from slot 1, and the slots below the box get a second turn in that pass.

When the points bring an extra life, the life asks for its own sound effect, inside the points routine, before the box frees its slot. X is 0 by then, so the box frees slot 0 instead of its own. The loop carries on from slot 1, comes to the box again in the same pass, and Super Joe is still standing on it, so it pays a second time; this time there is no carry, and the box frees its own slot. In the emulator, a box in slot 2 at 9,500 points left 11,500 points, eleven grenades from five and six lives from five, and the rifle soldier who had been in slot 0, up the screen, was gone. Whatever stands in slot 0 at that moment disappears, and only a box in slot 0 itself pays once.

12 · The skipped area

Secret: the skipped area 2 would have been drawn in the game's font

The areas are numbered 0, 1 and 3. Area 2 has an entry in every per-area table, and the counter steps over it.

Area 1, as played

Area 2: the same map in the font's character set

Both drawn from the listing: area 1's map ($8000) with area 1's character set ($C800) and with area 2's ($D000), in the colours each area has at $40BC.

The area counter's low two bits pick everything about an area ($1427), and after each area won the game adds one, then adds one again if the low two bits are 2 ($0939). Area 2's entries are filled in all the same, mostly with other areas' data:

TableArea 2's entryWhere
maparea 1's$3EB0
restart rowsarea 1's$3ED0
spawn listarea 3's$1485
terrainarea 3's$14A5
the ordinal in its end message3RD, as area 3's$1306
character setthe game's font$D000

Played, area 2 would be area 1's layout drawn in letters, digits and pieces of scenery, with area 3's enemies arriving in it. The game does put area 2's character set on the screen: the title, the name entry and the messages between areas set the counter to 2 while they run, which is how they get the font ($0F53, $0C9E, $1270). An unused fourth terrain table ($198B) and an unused fourth spawn list ($1D42) sit in memory beside the three that are used.

The fourth list holds the game's only doors and its only mortar man. Its 24 enemies are nine doors that each let a soldier out, a box, a motorcycle, a grenade thrower, two walking soldiers, two lorries, four vehicles crossing, a soldier in a trench, the mortar man, the gate opening and a green soldier. Its first two rows, 198 and 196, are below the start of every area. Tick Unused fourth list on the maps in section 03 to draw it on any of the three. It fits none of them as they are. Eight of its nine doors stand in open ground on every map, and the ninth, at row 157, falls on the left gate of area 3's first wall. Two things in it do match. On area 3's map, its soldier in a trench and its mortar man, at row 9, stand in the fortress's two windows, a row above the two soldiers that area 3's own list puts there ($1DA7). And its two walking soldiers come in after 80 frames at the height of row 99, as area 1's two do, with its grenade thrower at row 104, as area 1's is ($1CC1).

13 · The sound effects

Sound: the game never asks for half its sound effects

The driver holds sixteen effects ($55F9) and the game asks for eight of them. Each button plays one alone.

The same port as the music, starting one effect as the game's call at $500F does. The effect's frequencies come from the music's note table.

An effect is sixteen bytes: the start of the first two voices' registers, a first and a last note, and a byte that says whether to step the notes up or down, how many frames each step lasts and whether to flip each voice's gate as it goes ($5531, $53A5). While an effect sounds, the music gives up voices 1 and 2 to it and keeps playing on voice 3 ($538F). In the title tune that third voice carries the bass and nearly all the drums, so under a grenade the tune loses its upper parts and keeps its rhythm.

EffectAsked for whenWhere
0a box of grenades is picked up$2AA6
1a grenade is thrown$3913
2a grenade destroys a bunker$37BC
4Super Joe is hit, or falls$1060, $3C17
5the jeep comes up from behind$1ECB
9the third area is won$0933
11a letter is shot in the name entry$0DCC
12an extra life$136B
3, 6-8, 10, 13-15never

14 · Points

Secret: the green soldier's 2000 is worth 1,400

Shoot the green soldier and a white 2000 rises where he fell. The score goes up by 1,400.

The green soldier walking right (blocks $B9, $BA) and the score sprite he leaves (block $BC), drawn from the listing.

The points for every enemy are one table of BCD hundreds ($254F), which $23E7 adds when the enemy is hit:

PointsEnemies
200a soldier in a foxhole
300most soldiers
500a soldier in a trench, a bomb thrower, the sniper
1,000a guard, either half of the lorry, and a bunker's gun (paid by the grenade's own path, $37B1)
1,400the green soldier

The green soldier's entry is $14, 1,400. After adding it, $23E7 shows block $BC, the sprite that reads 2000. The guard's score sprite, block $BD, reads 1000 and matches his points. The green soldier appears once in each loop, when the screen reaches the top of the first area's map.

15 · This copy

What REMEMBER's crack changed in the game

Set beside the 1985 release, this copy differs in 29 of the game's 19,450 bytes. The maps, the character sets and the sprites are the same, apart from two bytes of a glyph no map uses. Everything else REMEMBER added sits in memory the 1985 game never uses: a menu, two pages of instructions, a trainer, and a saver for the high scores.

WhereThe 1985 releaseThis copy
$085C-$0868copies a trap for the reset button to $8000 (section 17)turns the screen on, then eight no-operations
$09A5, $0A0D6: the high-score walk starts at the seventh entry (section 16)7: the walk starts at the eighth
$0A4B-$0A4Cafter a name, back to the title ($0883)after a name, to the saver ($44E0)
$0A4E-$0A56the nine bytes the trap copieszeros
$38BE-$38C0reads the keyboardcalls the area skip's hook ($5F6A), which reads it
$44E0-$4FFFnothing loadedthe saver, the menu, the instructions and the trainer
$5F6A-$5FB1two routines nothing calls: one plays the music from the KERNAL's interrupt, the other stops itthe area skip's hook and the menu's text
$C71E-$C71F$FF $FF$00 $0A: two rows of glyph $E3 in area 0's character set, which area 0's map never uses

The 1985 release is Elite's PAL disk from the C64 Preservation Project. Both copies were stopped in the emulator as they hand over to the game at $0850 and compared byte for byte. The game's program is $0850-$44DF and $5000-$5F69, and the first five rows hold all 29 bytes that differ in it.

The menu ($4531) asks T for the trainer or H for the high scores. T asks five questions, Y or N, and each Y patches the game before it starts:

Trainer optionWhat it changes
Unlimited livesthe lost life ($0996) and the extra life ($1363) become reads, so the count never changes
Unlimited grenadesthe box's 3 ($2A8F) and the throw's 1 ($3909) become 0
No fallingthe fall into water or a pit ($3C10-$3C5E) becomes no-operations
No collisionsthe kill in the contact test ($1056-$106D) becomes no-operations
Area skipthe Commodore key ends the area, through the hook in the grenade's key read ($5F6A), so it works only where a grenade could be thrown ($38BE)

The lives and collision patches were used to keep Super Joe alive through this page's tests of the areas.

The high-score saver is the other addition ($44E0). The game's table of eight names and scores ($0EED-$0F47) is loaded from the second file on the disk before the game starts, and the file on this disk holds the table the 1985 release starts with. After a name is entered, the jump that took the 1985 release back to the title goes to the saver instead ($0A4A), which writes the table back to the disk and starts the game again. A game with the trainer on saves nothing.

16 · The high-score table

Bug: in the 1985 release, a low score overwrites eighth place

CSDb credits REMEMBER's crack with a bug fix, and this is it. In the 1985 release, a game that does not beat the seventh score writes its score over the eighth, under the eighth player's name and without asking for a name, even when it is lower. Pick a score.

The 1985 release

This copy

Both start from the table the game starts with ($0EEE, $0F36), which is the same in both copies, and both come from one port of the game's walk ($09A4), started at the seventh entry or the eighth. The test runs the game's own walk both ways over every score from 0 to 999,900 against that table, and over 400,000 random scores against 200 random tables. The table and whether a name was asked for were the port's every time.

After a game the score walks up the table from the bottom ($09A4). Each entry it beats or equals moves down one place, name and all, and the score goes in below the first entry it does not beat; the name entry follows ($0C88). The table holds eight entries and a spare ninth that is never shown. This copy starts the walk at the eighth entry, so a score that misses the table goes into the spare ninth, and the game goes back to the title without asking for a name ($0A0C).

The 1985 release starts the walk at the seventh entry. The bytes at $09A5 and $0A0D hold 6 where this copy has 7, and they are the only two bytes of the routine that differ. A score that beats the seventh is handled as in this copy. A score that does not stops the walk where it starts, goes in below the seventh, over the eighth, and the test for a name finds that the walk never moved and goes back to the title. So eighth place always shows the last game that missed seventh, under the name that was there before. In the emulator, a game of 2,500 in the 1985 release left DILK 002500 in eighth place, a game of 0 left DILK 000000, and neither asked for a name. This copy asked for a name at 2,500, sent DILK's 2,000 to the spare ninth entry, and changed nothing at 0.

17 · The reset trap

Bug: after a reset, the 1985 release shows its title in the dark and never starts

The 1985 release catches the reset button and starts itself again instead of handing the machine to BASIC. The game that restarts runs its title and attract mode with the screen off, and fire never starts a game.

At its start the game copies nine bytes to $8000 ($085C): the game's start address, $0850, twice, then the letters CBM80 with their top bits set. Those nine bytes are a cartridge's signature. A reset makes the KERNAL look for the letters at $8004 and, when they are there, jump to the address at $8000, so a reset switch restarts Commando. RESTORE, the other key that breaks into a program, does nothing in either copy, because the start points the NMI at an RTI ($0A4D).

The KERNAL jumps to a cartridge before it sets up the chips, so the game restarts on chips the reset has cleared. The reset clears the processor port's direction register, and with the register at 0 the game's writes to $01 change nothing. The I/O chips stay in view when the start copies the name entry's gunsight into the RAM beneath them ($0A57), so the 64 bytes go into the video chip instead, and the one that lands in $D011, $20, turns the display off. Nothing in the game turns it on again.

The joystick is cut off the same way. The title starts a game when the first CIA's port A reads $6F ($0FB2): fire pressed, and bit 7 low. Bit 7 reads low only because the KERNAL makes that line an output and drives it low, and the reset has made every line of the port an input again, so with fire pressed the port reads $EF. In the emulator the restarted game cycled through its title and attract views and ignored fire. With the port set back as the KERNAL leaves it, the first press started a game.

Behind the dark screen the restarted game draws area 3 wrongly as well. With the processor port's lines all inputs, they read high, which keeps the BASIC ROM in view at $A000, where area 3's map is, and the map is drawn from the ROM's bytes.

The attract mode's view of area 3: the COMMANDO logo over a dirt track between two walls

The attract view of area 3

The same view after a reset: the logo over a field of scrambled green and grey characters

The same view after a reset, with the display put back on

The 1985 release in the emulator, at area 3's row 169. For the second picture $D011 was set to $1B just after the gunsight copy, which every later write to it keeps.

The signature also marks a game that is never reset. $8000 is the first row of area 1's map, the top of the screen when the area's gate comes into view, and the copy writes over nine of its characters. Two pixel lines of them show at the top edge of the screen. REMEMBER's file holds the map's own nine characters there, and the crack never copies the signature.

The top edge of the screen at area 1's gate in the 1985 release: brown marks above the wall

The 1985 release: the signature in area 1's top row

The same place in this copy: a plain grey line above the wall

This copy: the map's own wall

The top-left corner of the screen when area 1's gate comes into view, from the emulator, five times the size.