The Legend of Zelda: Ocarina of Time
BACK TO GAMES
The Legend of Zelda: Ocarina of Time

The Legend of Zelda: Ocarina of Time

Nintendo
1998

A revolutionary action-adventure game that set the standard for 3D gaming. Famous for its countless glitches and sequence breaks used in speedruns.

Nintendo 64GameCubeNintendo 3DSNintendo SwitchWiiWii U
BACK TO WIKI

Arbitrary Code Execution (ACE)

Arbitrary Code Execution (ACE) represents the ultimate level of game exploitation in Ocarina of Time. It allows players to write and execute custom code through nothing but controller inputs, effectively reprogramming the game in real-time. This technique has enabled everything from credits warps to running entirely custom programs on unmodified N64 hardware.

What is ACE?

ACE is a glitch that causes the game's instruction pointer to jump to a section of memory that players can write to—such as file names, actor positions, or even raw controller inputs. When the instruction pointer reaches this memory, it executes the data there as if it were legitimate game code.

In simpler terms: you can write "code" using normal gameplay and make the game run it.


How ACE Works

The Two Requirements

Every ACE exploit needs two things:

  1. Writable Memory Region - A section of memory the player can control (filenames, positions, controller data)
  2. Code Redirection - A way to make the game execute that controlled memory as code

The SRM Connection

In Ocarina of Time, ACE typically builds on Stale Reference Manipulation (SRM):

  1. SRM provides control over memory regions
  2. Function Pointer Manipulation redirects code execution
  3. Player-controlled data becomes executable code

Controller Input as Code

The most mind-bending aspect of OoT ACE is using controller inputs as code:

"We modify an instruction in memory to start reading controller data as N64 instructions. Normally, this would crash, but with TASBot, we can simulate controllers and manipulate them at inhuman speeds to look like N64 instructions."

The TASBot Demonstration

At Games Done Quick 2022, the speedrunning community demonstrated the full power of ACE:

  1. Performed a series of glitches to create memory errors
  2. Connected TASBot to controller ports 2-4
  3. Streamed a custom ROM hack from a laptop to the N64's memory
  4. All through an unmodified US 1.0 cartridge on original hardware

Speedrun Applications

Credits Warp (Any%)

The primary speedrun use of ACE is warping directly to the credits:

MethodTime RequiredDifficulty
Kokiri Forest ACE~7 minutesVery Hard
C-Up Method~10 minutesHard
Ramwrite Method~8 minutesExpert

Total Control

By performing ACE three times with specific filenames, runners can remove the character limit on file names entirely. This unlocks "Total Control"—the ability to input any payload and do practically anything:

  • Force item spawns
  • Modify Link's position instantly
  • Change game state flags
  • Load arbitrary scenes

The Technical Process

Step-by-Step Overview

  1. Setup SRM - Create stale references through actor heap manipulation
  2. Position Link Precisely - Your X/Y/Z coordinates become data values
  3. Manipulate Memory - Overwrite function pointers with SRM
  4. Execute Payload - The game runs your "code"

Filename Payloads

File names in OoT are stored in memory and can be used as code:

  • Each character translates to specific byte values
  • Specific character combinations create valid N64 instructions
  • Multiple file names can be chained for longer payloads

Platform Differences

PlatformACE ViabilityNotes
N64 (US 1.0)Full SupportMost developed setups
N64 (US 1.2)PartialSome methods patched
GameCubeFull SupportDifferent memory layout
Virtual ConsoleFull SupportWii/Wii U compatible
3DSLimitedHeavily modified engine

Category Rules

Due to its power, ACE has specific rules in speedrunning:

  • Any% - ACE allowed (Credits Warp is the primary route)
  • No ACE - Specifically bans arbitrary code execution
  • 100% - ACE typically banned
  • Glitchless - All major glitches banned including ACE

Learning Resources

Prerequisites

Before attempting ACE, you should understand:

  1. Basic OoT glitches (superslides, bombs, etc.)
  2. Stale Reference Manipulation fundamentals
  3. N64 memory architecture basics
  4. Hexadecimal number systems

Practice Tools

  • kz Practice ROM - Save states, memory watching, frame advance
  • Project64 with debugging - Emulator-based memory analysis
  • OoT Decomp - Decompiled source code for research

See Also

  • Stale Reference Manipulation (SRM)
  • Wrong Warp
  • Deku Stick on B

Sources