1988 · Data East

RoboCop: graphics

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

Every figure of the three levels, drawn and moving; then two screens in two memory banks, switched part way down every frame; streets built from tiles; and every figure made of three sprites.

01 · The cast

Every figure, moving as the game moves it

Each figure below is drawn from the sprite shapes in its level's listing, put together the way the game puts them together, and stepped through the game's own animation tables at the game's own rate. Pick a level to see its cast.

The cast. Each tile names the routine that picks its shapes. The grey is see-through. Enemies take the next of eight colours each time one appears ($A42F); here each is drawn in one of them. Pause stops every tile on its current frame.

Every figure is three sprites (Three sprites to a figure, below): an outline in black at the top, another 21 lines lower, and a multicolour body stretched to double height behind both. So most tiles show three shape numbers. RoboCop's body is the exception. Its upper rows are his arm, copied in for the way he aims, and its lower rows are his gun hand, copied in for each step of his walk and each way he faces. The game keeps two of these bodies, $FE and $FF, and builds the next one in whichever is not on screen, so the swap never shows half a picture ($A069). The left-facing arms and hands are not stored at all: each level makes them when it starts by mirroring the right-facing ones, row by row and pixel pair by pixel pair ($A912). The tiles here build both the same way.

Shapes no tile above shows

The level's other shapes that hold any pixels, each drawn twice: as an outline in black above, and as a multicolour body below, since a shape's use decides which it is. Most are poses the tiles above leave out, or pieces of RoboCop's arm and hand that the body tiles copy from; the shape's comment in the Source names its owner where the listing knows it.

02 · The screen

A panel and a play area, from two banks of memory

The VIC-II chip, which draws the screen, can see 16 KB of memory at a time. RoboCop changes which 16 KB part way down every frame, so the status panel and the play area each have their own characters and their own screen.

Status panel: bank 3 screen $C000, characters $D000 black band Play area: bank 1 screen $4000 or $4400, characters $4800 sprites $5000-$7FFF line 0 NMI $E1

One frame. The panel (solid border) comes from bank 3 and the play area (dashed border) from bank 1. A raster interrupt near the bottom sets up the panel for the next frame; a timer interrupt (NMI) part way down switches to the play area, and a second one about eleven lines later ends the black band that hides the switch.

The switch is made by three interrupts (level three's at $851C, $83E3, and $8426). On raster line $E1, near the bottom of the screen, one points the VIC-II at bank 3 for the panel: screen $C000, characters $D000, with extended colour mode on, which gives the panel's text four background colours. On line 0 the next starts a one-shot countdown on CIA 2's timer B. When it runs out, its NMI points the VIC-II at bank 1 for the play area.

Changing banks in the middle of a line would show as a ragged edge. The game hides it. The NMI turns on extended colour mode and multicolour mode together, a combination the VIC-II cannot show, so it draws black, and makes the switch behind that black. A second NMI, about eleven lines later, turns extended colour mode off and the play area appears. The black band is the line between the panel and the street in every screenshot.

03 · Scrolling

Two screens, built in pieces and swapped

The play area has two screens, at $4000 and $4400. While one is shown, the game copies the other a column (or a row) along, a part on each frame, while the VIC-II's fine scroll moves the shown one a pixel at a time. When the fine scroll has moved eight pixels, the screens swap: one bit of the value written to $D018 is flipped ($9247 in level three), and the fine scroll starts again.

Colour RAM cannot be swapped, because the VIC-II has only one. So on the same frame as the swap, the game moves the colours of rows 7 to 22 one column across, and draws the new column. The stages whose maps are taller than the screen scroll up and down as well, with the same method for rows.

04 · Tiles

Streets built from tiles of four by four characters

Each stage's map is a list of tile numbers, a column at a time. A tile is 16 characters, four across and four down, so each map byte stands for a 32 by 32 pixel square. The tile sets and maps sit at $1000 to about $24FF in each load, with a colour for each of the 256 characters at $0F00; the colour's bit 3 makes that character multicolour. Stage seven is the exception: its tiles are not in level two's files at all, but come with level one and wait at $C400 until they are needed (Discoveries). The Maps page draws every stage from these tables.

05 · Figures

Three sprites to a figure

sprite 2 body, multicolour sprite 0 sprite 1 outlines, black together + =

A figure. Sprite 2 (dashed) is stretched to double height and holds the body in four colours. Sprites 0 and 1 (solid and thick borders) are 21 lines each, one above the other, and draw a black outline over it, in front because a lower-numbered sprite is drawn in front.

A C64 sprite is 24 pixels wide and 21 lines high, in one colour, or 12 double-wide pixels in three colours. Neither is enough for a tall figure with an outline, so each figure here is three sprites ($879A). Sprite 2 is a multicolour sprite stretched to double height: the body in the figure's own colour, orange, and blue. Over it sprites 0 and 1 draw a black outline at full width, sprite 1 starting 21 lines below sprite 0. The eight sprites make two figures of three sprites and a third of two, or, when four figures are on screen, the game sorts them by height and draws them with two sprites each.

The sprite shapes take $5000 to $7FFF, which the VIC-II sees as shapes $40 to $FF of bank 1. RoboCop's arm and gun are drawn into two shapes at the end, $FE and $FF, as he aims. Each level saves memory by building its left-facing arm and gun shapes when it starts, reversing the right-facing ones pixel pair by pixel pair: 174 rows in levels one and two ($A912, $AC49) and 86 in level three ($A36E).

When RoboCop dies, his three shapes are copied to $7F40 and rubbed out in nine passes, five frames apart. Each pass clears one bit of every byte through a list of eight masks, starting one mask later each byte, so the figure dissolves in a scatter of pixels ($9E70).