1986 · Imagine Software (Ocean)

Green Beret

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

Play the whole game in your browser: fight through the Missile Base, the Harbour, the Bridge and the Prison Camp with a knife and whatever weapons the soldiers drop, and free the four prisoners.

Loading the game's data…
  • Joystick: ← → ↑ ↓ move, X fires. Fire at the title page starts a game.
  • On the ground: left and right walk, up jumps, or climbs a ladder he stands at; down lies down, or climbs down; the diagonals jump left and right. Fire stabs with the knife, standing or lying down.
  • Space fires the weapon he carries, once he has picked one up from a white soldier: a flame thrower, a bazooka or hand grenades. The ones he has left show at the top of the screen.
  • Hold 1 during a jump and he hangs in the air until it is let go: a cheat the game kept (Discoveries).

The game's own screen, drawn from the port's memory each frame as the video chip would draw it, at the C64's own pace. The game reads one joystick, in control port 2, and two keys: the arrows and X are that joystick here, Space and 1 are the C64's.

01 · Differences

What differs from a C64

The game plays as it does on a C64, at the C64's pace. These are the places where the page cannot be the machine, and what it does instead.

On a C64On this page
The game loads from disk with a picture and a tune, and the loader unpacks it and starts it at $4000.There is no loading. The page starts at $4000 with the memory as the unpacker leaves it, and the title page and its tune come up at once.
Each instruction takes its cycles, and the video chip takes some of the processor's on the lines where it fetches characters and sprites.The port executes no instructions. Each routine costs the cycles it costs the game, and one whose work varies costs it by the work: the screen moved a character along, the new column of the map, the sprites the multiplexer places and the sort moves, a picture's and a text's bytes, and a block of graphics swapped in. The video chip takes its cycles as the beam passes those lines, so a stage draws and a frame runs long where they do on a C64.
An interrupt can fall between any two instructions. The multiplexer's lets the next one in before it ends.A handler runs whole when its interrupt comes, and then its time passes. A read of the raster line in it, and each write to a chip, are placed as far into the handler as its work so far has taken, so the multiplexer sets the next band from the line the beam is on as it gets there.
The SID plays the music and the effects. The sound driver reads the next notes in the main program, once a frame, and plays the effects in the interrupt, on the same SID registers, so an interrupt can come in the middle of the main program's writes.The game's own sound driver, Martin Galway's, runs on the site's 6502 in the port, and the site's model of the SID, with the filter of the C64's original 6581, plays what it writes as each frame is shown. The interrupt comes before or after the main program's writes, never among them, so on a frame where a note and an effect start together a register can end the frame with the other one's value.
Once a frame the game checks that CIA 2's serial port has shifted out the byte it was last given, and stops the machine if not: a copy protection.The page has a model of the serial port and its timer, which shift a byte out in the time the C64's do, and the check passes as it does on a C64.
A death in an end-of-stage fight, and a Bridge won, each leave two bytes on the stack for good. From 12 of them the stack reaches the sprites' tables and the game can crash; from 23 it crashes within half a minute (Discoveries).The port keeps no return addresses in memory, so the stack never reaches the tables. It counts the bytes, and at the 23rd the page stops the game. Between 12 and 22 the page plays on where a C64 might crash. Start again is the machine switched off and on, which clears them.
The game reads a joystick in control port 2, and the keyboard for Space and 1.The arrows and X are the joystick in port 2, because Space is the C64's own key here, as is 1; on a touch screen the pad is both. A tap shorter than a frame is held until the game has read it.