Skip to content

Boot

Boot is the path from the BIOS handoff to the first title frame. A C runtime stub prepares the CPU, SYS_Main initializes the console, LOGO.EXE plays the Capcom movie, and two callbacks load the first two archives and start the title. The frame loop then runs until power-off. Title states: game phases. Loader steps: loading.

The BIOS reads SYSTEM.CNF, loads SLUS_004.22 and jumps to its entry address (copies t_size bytes to t_addr, then jumps to the start address; BIOS behavior [inferred]). Header fields: executables and boot files.

The payload is far larger than the resident code; the rest is zero fill that reserves RAM for later loads (memory map).

Three stubs prepare the CPU and start the game. The header’s start address is stup2.

Stub What it does
stup2 (exe/slus_004_22@0x8014AA0C) zero-fills 0x8018B2B8..0x80190C60, the BSS (memory map), then falls into stup1
stup1 (exe/slus_004_22@0x8014AA30) sets sp to 0x80200000, gp to 0x8018B2B4, copies sp to fp, calls InitHeap(0x80190C64, 0x673A0)
stup0 (exe/slus_004_22@0x8014AAAC) jal SYS_Main, followed by a break that is never reached

stup1 sets the stack top to 0x80200000 (top of RAM) and ends the heap 32,768 bytes below it, at 0x801F8004. The heap range overlaps the resident game program at 0x80195800 and the overlay arena at 0x801CE000. The executable has no malloc, free, calloc or realloc, so the heap is declared and never used. [inferred] __main (exe/slus_004_22@0x8014AA04) is a bare jr $ra.

SYS_Main initializes, then enters the permanent loop:

  1. __main, then clear g_SysHardwareInitialized.
  2. SYS_InitRuntime (exe/slus_004_22@0x8014ACA0): SYS_InitHardware, SYS_InitDisplay, reset both render records, CallbackInitThreads, clear all of VRAM, DrawSync(0), SetDispMask(1) and SYS_PrepareFrame.
  3. SYS_StartLogo: run the logo program, described below.
  4. Install SYS_CaptureDrawTime as the DrawSync callback and CallbackRegister(0, SYS_StartFrontend).
  5. Enter the permanent loop. The first CallbackRun opens slot 0.

SYS_InitHardware (exe/slus_004_22@0x8014AD28) runs twice, once before the logo and once after it. It does this in order:

  1. ResetCallback, then EMI_Init (exe/slus_004_22@0x80161F58). The loader init loops on CdInit until the drive answers, waits VSync(3) and clears the 24 loader slot states.
  2. On the first call: VSync(0), ResetGraph(0), SetVideoMode(MODE_NTSC), set g_SysHardwareInitialized and enable the CPU trap event with SYS_ShowException as its handler. On the second call: VSync(0) and ResetGraph(3), which keeps the display.
  3. InitGeom, SetGeomScreen(0x3E8), SetGeomOffset(0xA0, 0x78).
  4. PadInit(0), SYS_InitCard (seven card events, InitCARD(1), StartCARD, _bu_init) and ChangeClearPAD(0).

SYS_ShowException (exe/slus_004_22@0x8014B3C4) draws a register dump on a double-buffered screen and never returns. Sound is not initialized here. SYS_StartFrontend does it after the logo.

SYS_InitDisplay (exe/slus_004_22@0x8014AE08) sets up two draw and display environment pairs of 320 x 240. One draws at y = 0 and displays y = 0xF0, and the other draws at y = 0xF0 and displays y = 0. The frame loop alternates between them.

SYS_StartLogo (exe/slus_004_22@0x8014AEE0) loads LOGO.EXE and runs it as a separate PlayStation program:

  1. SYS_LoadExec (exe/slus_004_22@0x8014E0FC) finds the file with CdSearchFile, reads its header sector into the buffer at 0x800E4800, copies the ten header words to D_80143E70, then reads t_size bytes from the next sector to t_addr (executable load).
  2. It sets the stack address of the exec block at 0x80143E80 (D_80143EA0) to 0x801FF000, stops the callback, pad and card services, and calls Exec inside a critical section.
  3. When Exec returns, it runs SYS_InitHardware again, clears the display and the VRAM, and turns the display on.

LOGO.EXE loads at 0x801CE000 and runs to 0x801ECEC0 with its BSS. The payload of the main executable is zero over that range, apart from two stamp words, so the logo overwrites no resident byte. No overlay is loaded yet.

exe/logo starts at __SN_ENTRY_POINT (exe/logo@0x801CE724), which zeroes its BSS (0x801EB430..0x801ECEC0), sets gp and jumps to Logo_Main (exe/logo@0x801CEDFC). The logo carries its own copy of the PsyQ libraries. Logo_Main calls CdInit and Logo_Init, then loops until the stream ends or the Start button is held. At the end it fades the audio out, stops the stream, the callbacks and the pad, and returns to SYS_StartLogo per the BIOS Exec contract. [inferred]

The movie is read by sector number. Logo_Init receives the literal LBA 0x2D78C, the start of disc file slot 0x373; slot 0x374 starts 1,155 sectors later, so the file is 2,365,440 bytes, the size of LOGO/CAPCOM30.STR. Slots: disc and files. Movie code: loading.

After the logo, the first pass of the loop opens slot 0, which runs SYS_StartFrontend (exe/slus_004_22@0x8014EA80). It does this in order:

  1. Clear VRAM, then CallbackWait(1) to yield one frame.
  2. SND_Init, SND_SetBankLayout(0).
  3. Stream FIRST.EMI (slot 0x261) and wait with CallbackWait(1) until EMI_IsReady. Loading explains the stream.
  4. Set reverb depth, call SND_Start.
  5. Clear 4,272 bytes of game state from D_801448D8. Reset the game flags, the walk flags and g_EmiLoadedCharacterIndex (to 0xFF), and copy nine halfwords from D_8017F56C into g_InputMasks.
  6. Reset the panel tasks, palette fades, palette slots, draw flags and script table. Set the area draw mode to 6 and request a palette upload.
  7. CallbackRegister(1, SYS_EnterFrontend), then CallbackExit, which ends slot 0’s own thread.

SYS_EnterFrontend (exe/slus_004_22@0x8014EC64) starts in slot 1 in the pass where slot 0 registers it. It streams GAME.EMI (slot 0x262), waits for EMI_IsReady, and calls Game_UpdateTitle (emi/etc/game/01@0x801D0C04). Entry 0 of GAME.EMI is the resident game program at 0x80195800; entry 1 is the title overlay at 0x801D0C00, which holds Game_UpdateTitle.

Game_UpdateTitle clears its state and loops forever on slot 1’s thread. Each pass it yields with CallbackWait(1), handles the Start button, runs one of eight title handlers that g_UiTitleState selects, and updates the banner and fades. The first handler, Game_BeginTitle (emi/etc/game/01@0x801D0C90), selects sound bank layout 2, streams DEMO (slot 0x25F), resets the palette stage and starts music cue 0x8D. Title exits: phases.

sequenceDiagram
    autonumber
    participant B as BIOS
    participant M as SYS_Main
    participant L as LOGO.EXE
    participant S as callback slots
    participant E as EMI loader
    participant T as title overlay

    B->>M: stup2, stup1, stup0
    M->>M: SYS_InitRuntime
    M->>L: SYS_StartLogo: load,<br/>Exec
    L-->>M: movie ends, return
    M->>M: SYS_InitHardware again
    M->>S: CallbackRegister(0,<br/>SYS_StartFrontend)
    M->>S: CallbackRun<br/>(every pass)
    S->>E: slot 0: stream FIRST,<br/>poll until ready
    S->>S: CallbackRegister(1,<br/>SYS_EnterFrontend),<br/>CallbackExit
    S->>E: slot 1: stream GAME,<br/>poll until ready
    S->>T: call Game_UpdateTitle
    T->>E: Game_BeginTitle:<br/>stream DEMO

The first frame with the title drawn and input enabled is the first playable frame (phases).

Question What would settle it
How the BIOS loads the executable and returns from Exec A trace of a run, or the BIOS source; the game files do not show it
Whether PsyQ library code uses the InitHeap memory Search the linked PsyQ objects for heap users
Other readers of D_80143EFC, the DrawSync callback value Area_CanStartEncounter is the only reader found; search the overlays
Why the soft reset waits for EMI_IsReady Read the loader state machine in loading
  • Confidence: medium. The boot steps are read in the executable, the title overlay and LOGO.EXE; the BIOS behavior at load and at Exec, and the heap use, are [inferred] or [unknown].
  • Evidence: the code of stup2, stup1, stup0, SYS_Main, SYS_InitRuntime, SYS_InitHardware, SYS_StartLogo, SYS_LoadExec, SYS_StartFrontend, SYS_EnterFrontend and Game_UpdateTitle; the entry code of LOGO.EXE; the logo’s literal movie LBA against the disc file table.