1990 · System 3

Last Ninja Remix

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

A joystick sequence that ends any level, credits hidden behind a key in the intro, a title screen the game never calls, and a clock that runs fast in America.

01 · Secret

Secret: a joystick sequence ends any level

Facing up and to the right, with the second fire button held down, the player pushes the stick up, up, left, left, right, right, down, down and left, letting it go back to the centre after each push. The game then asks ARE YOU SURE YOU ARE PREPARED FOR THE NEXT LEVEL, and YES takes Armakuni on to the next one.

second button

The sequence is read from the level's listing in the built site.

Each step is an entry of the table at $95D6, read from the listing, and the count is the one the game keeps in $BF. The page's recogniser is a port of the check at $95AB-$95D5. All seven levels carry the same check and the same table.

The check runs each time the game reads the joystick (ScanAndNormalizeInput, $9418). It keeps each reading in $AD and acts on one only when the next scan finds $7C the same, so a direction held counts once and a reading that lasts a single scan is passed over. It does this only while Armakuni faces heading 1 ($69), up and to the right: facing anywhere else puts the count back to 0. Each reading it acts on must be the next entry of the table, the stick's bits with bit 5, the second button, set in every one, or the count starts again. After the eighteenth the check sets $02AF to $FF, the request to end the level that an exit leading out of the level makes too ($92C4).

The question comes from the routine that ends a level, ResolveLevelCompletion, which asks it only when the player lacks an object the level needs. Answering YES goes on all the same. In Central Park the sequence brings the question up, and facing any other way the same pushes put the count back to 0 every time.

02 · Secret

Secret: holding L on the intro's logo scrolls hidden credits

While the LAST NINJA REMIX logo is on the screen, holding L starts a line of text running along the badge's bottom strip, the one lettered SYSTEM 3, between the S and the 3. It names the intro's makers, promises The Last Ninja III and thanks a long list of people, and the logo stays up until it has finished.

The whole text

The text is read from the intro's listing in the built site.

The text is the intro's own, at $8002 up to the $ that ends it at $8424, read from the listing. The ticker is the badge's strip of twelve cells, drawn in the intro's font at $8425 by a port of RunCreditsScroller ($112E) and ScrollCreditsRow ($1197): one multicolour pixel a frame, a new letter every fourth frame. The font's pixels come in pairs, so every letter takes the cells' colour RAM, light grey.

The intro scans the keyboard twice a frame (ScanKeys, $1105). With L held while the logo is up it sets credits_state ($3D) to $80, and the interrupt then draws the text into cell row 22, columns 14 to 25, a character every fourth frame, in a font of its own at $8425. The whole text, 1,058 characters, takes 4,232 frames, about 85 seconds, and the temple scene waits for it. The text credits Stan Schembri with the programming and Robin Levy with the graphics, then thanks people at System 3 and others by name, among them JOHN TWIDDY A PROGRAMMER OF STUNNING BRILLIANCE.

03 · Secret

Secret: Central Park's first load carries a title screen that would crash

Above the title card's code, Central Park's first load holds a routine that the game never calls. It draws the same card with PRESS FIRE TO CONTINUE under it and waits for fire, and its interrupt calls into the tune at an address that is no longer an entry point.

The screen is drawn in the built site, which serves the listings it comes from.

The leftover routine at $6000, run in the page over the engine and the title load, up to its wait for the fire button at $606B, and drawn by the site's renderer.

The routine saves the zero page to $8000, draws the card with DrawTitleCard ($4E00) and puts the zero page back, then sets a raster interrupt at line 0 with its handler at $60A0 and prints PRESS FIRE TO CONTINUE with the engine's text routine. When fire on port 2 is pressed it paints the window's bottom row and fades the volume from 14 to 0. The loader never goes near it: it calls $4E00 directly and plays the tune itself.

The handler calls $4002, as if the tune's player answered there. In this tune $4000 is a JMP, and $4002 is the high byte of its address, $40, which as an instruction is RTI, the return from an interrupt. Run in place of a return from a subroutine, it takes the top of the stack for a status byte and a return address: the first frame's interrupt would send the processor to $0060, in the middle of the game's variables.

04 · Bug

Bug: on an American C64 the clock runs fast by a fifth

The clock adds a second every 50 frames, which is a second on a European machine. An NTSC machine shows 60 frames a second, so there the clock gains 12 minutes an hour, although the game knows which machine it is on and slows the music to match.

Time playedPAL clockNTSC clock

The clock is kept by the raster interrupt ($1F1B): a count at $0228 of 50 interrupts, then a second. On a PAL machine 500 frames move the clock on ten seconds.

MachineSetup ($0E00) tells the two machines apart as the game starts, by asking for a raster interrupt at line 304, which only a PAL screen has, and keeps the answer in $AB. The interrupt reads it for the tune alone: on NTSC it skips the call to the player on one frame in six ($1EFB-$1F0E). The clock's count of 50 stays the same on both. The minutes and seconds the clock shows when The Basement ends become the code of the last lock, so an NTSC player's code is simply read from a faster clock.