This document specifies the assembly output format generated by OpcodeOracle's export command.
OpcodeOracle always generates both outputs:
- Main disassembly file - Complete disassembly in one file
- Segment files - Separate file per segment in
segments/subdirectory
Segment files are derived by combining:
- Regions - define code/data type boundaries
- Symbols - identify subroutines/entries within code regions
-
Non-code regions (data) → one
_dat.asmfile per region -
Code regions are split by subroutine/entry symbols:
- Code at region start without a subroutine symbol →
_code.asm - Each
SymbolSubroutineorSymbolEntrystarts a new_sub.asm
- Code at region start without a subroutine symbol →
Given:
- Region $0800-$0FFF: code
- Region $1000-$10FF: data
- Symbol at $0800: entry
- Symbol at $0900: subroutine
- Symbol at $0A00: subroutine
Produces:
segments/
├── 0x0800_sub.asm # Entry at $0800, ends at $08FF
├── 0x0900_sub.asm # Subroutine at $0900, ends at $09FF
├── 0x0A00_sub.asm # Subroutine at $0A00, ends at $0FFF
└── 0x1000_dat.asm # Data region
All output files must include an auto-generated header:
; ============================================================
; AUTO-GENERATED FILE - DO NOT EDIT
; ============================================================
; Generated: 2025-01-22T10:30:00Z
; Source: game.prg
; State: game.orc (if loaded from state)
; ============================================================This header appears at the top of every generated .asm file.
See disassembler.md for:
- Instruction formatting and field specifications
- Operand formatting by addressing mode
- Data section format
; ============================================================
; AUTO-GENERATED FILE - DO NOT EDIT
; ============================================================
; Generated: 2025-01-22T10:30:00Z
; Source: game.prg
; ============================================================
.ORG $0801
; === CODE SECTION ===
L_0810: LDA #$00 ; Initialize border color
STA $D020
...
; === SUBROUTINE: SUB_1000 ===
SUB_1000: LDX #$00 ; Loop counter
LDA $2000,X
...
RTS
; === DATA SECTION ===
$0900 .BYTE $48,$45,$4C,$4C,$4F,$20,$57,$4F,$52,$4C,$44,$00,$00,$00,$00,$00 ; "HELLO WORLD....."
...
; End of disassemblyOutput is organized as:
output/
├── game.asm # Main file with entry point
└── segments/
├── 0x0810_code.asm # Code block at $0810
├── 0x1000_sub.asm # Subroutine at $1000
├── 0x1200_sub.asm # Subroutine at $1200
└── 0x0900_dat.asm # Data section at $0900
Main file (game.asm):
; ============================================================
; AUTO-GENERATED FILE - DO NOT EDIT
; ============================================================
; Generated: 2025-01-22T10:30:00Z
; Source: game.prg
; Segments: see segments/ directory
; ============================================================
.ORG $0801
; === INCLUDES ===
.INCLUDE "segments/0x0810_code.asm"
.INCLUDE "segments/0x1000_sub.asm"
.INCLUDE "segments/0x1200_sub.asm"
.INCLUDE "segments/0x0900_dat.asm"
; End of disassemblySubroutine segment (segments/0x1000_sub.asm):
; ============================================================
; AUTO-GENERATED FILE - DO NOT EDIT
; ============================================================
; Generated: 2025-01-22T10:30:00Z
; Source: game.prg
; Segment: subroutine @ $1000
; ============================================================
; === SUBROUTINE: SUB_1000 ===
SUB_1000: LDX #$00 ; Loop counter
LDA $2000,X
...
RTS
; End of segmentData segment (segments/0x0900_dat.asm):
; ============================================================
; AUTO-GENERATED FILE - DO NOT EDIT
; ============================================================
; Generated: 2025-01-22T10:30:00Z
; Source: game.prg
; Segment: data @ $0900
; ============================================================
; === DATA SECTION ===
$0900 .BYTE $48,$45,$4C,$4C,$4F,$20,$57,$4F,$52,$4C,$44,$00,$00,$00,$00,$00 ; "HELLO WORLD....."
...
; End of segmentFiles are named 0x{address}_{type}.asm:
| Type | Suffix | Example | Description |
|---|---|---|---|
| Subroutine | _sub |
0x1000_sub.asm |
Code reached via JSR |
| Code | _code |
0x0810_code.asm |
Code not associated with a subroutine (e.g. entry) |
| Data | _dat |
0x0900_dat.asm |
Data section |