1987 · Domark

The Living Daylights: maps

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/the-living-daylights with me to Gold.

All eight levels, drawn whole. Each is unpacked here by the game's own code, run on a copy of the C64's processor in the page, exactly as the game unpacks it when the level starts.

01 · The levels

Eight pictures, 160 characters wide

A level's scenery is one picture of 23 rows of 160 characters, four screens wide, with a colour for every character and a character set of the level's own. The Fairground is the exception: a single screen, 40 characters by 25.

Scroll sideways to see the whole level.

The page runs $30CB, the routine that unpacks a screen, first for screen 8 and then for the level, as the game does between the title and the first level. It writes the level's characters, the map at $8000 and the colours at $8E60; the page draws them in the level's background and shared colours from the tables at $3C2D, $3C1D, and $3C25. For the Fairground it also runs $3CB9, which sets that level up. The figures, the doorways, and Bond are sprites, and are not part of the map.

LevelPacked sizeWhere the run endsObstacles
1 GibraltarOnly when Bond knocks down the assassin; at the end of the second time round he stops4
2 Concert HallThe second time round, at column 1595
3 The PipelineThe second time round, at column 1595
4 The MansionThe first time round, at column 83, once the doorway is clearedthe bomb craters
5 The FairgroundNo running: when the balloons are gone and the target is shot0
6 TangiersThe second time round, at column 159, once the doorways are cleared5
7 AfghanistanThe second time round, at column 159, once the doorways are cleared4
8 Whittaker's HouseThe first time round, at column 43, once Whittaker is out0

The column is the far layer's count ($56), checked by $3004. A packed size is the length of the level's Huffman-coded stream, as the Source tab gives it at the stream's start (how a level is packed).

02 · Three layers

Near things move faster

The picture is split into three bands that scroll at three speeds, so the ground near Bond rushes past while the hills behind him crawl ($3A07).

LayerMap rowsSpeedColumn count
Far (top)0 to 111 pixel a frame$56
Middle12 to 182 pixels a frame$57
Near (bottom)19 to 223 pixels a frame$58

The C64's video chip can scroll the whole screen smoothly by up to seven pixels, but only the whole screen. To move three bands at three speeds, the game changes the fine scroll part of the way down the picture: a raster interrupt at line $92 sets the middle band's scroll and one at $CA the near band's, and the next frame's top band is set at line $FB ($3A61, $3A9C, $3B19). When a band has moved eight pixels, a whole character, its characters have to shift one place along. The game keeps two screens, at $4000 and $4400, and draws the shifted band into the one that is not on show, a column at a time, then swaps them at that band's interrupt ($39BF). Each band has drawing routines of its own for each of the two screens, from $7278 to $7655, written out in full rather than as loops, which is faster.

03 · How a level loops

Round and round the same picture

Each band keeps its own count of where it has got to in the 160 columns, and each count goes round to 0 after 159. The near ground goes round three times for every once of the far hills.

A model of the scroll, not the game running: each band of the selected level drawn from the map at its own count, moving 1, 2, and 3 pixels a frame from the start, as $3A07 moves them. The game starts each count at 2, after drawing the first 40 columns ($71FA).

The long levels end the second time the far layer comes to its last column ($3004): about 317 columns of the far layer from its start at 2, which is some 2,540 frames of running, or 51 seconds. In that time the middle layer goes round four times and the near layer six, so every obstacle, which is a column of the middle layer, comes round four times. The Mansion and Whittaker's House end part of the way through the first time round. Bond only moves while he runs, so the time a level takes is up to the player.