nm45 lists the symbols (imports and exports) in .o45 and .o65 relocatable object files. It follows the conventions of the standard Unix nm tool.
Both 32-bit .o45 files (produced by ca45 -c or cc45 -c) and standard 16-bit .o65 files (from other 6502 toolchains) are supported.
nm45 [options] <file.o45|file.o65> [...]Each line displays one symbol:
OFFSET TYPE NAME
- OFFSET: 8-digit hex address (segment-relative offset for exports, blank for imports).
- TYPE: Single letter indicating the symbol's segment and linkage.
- NAME: The symbol name as stored in the object file.
| Letter | Meaning |
|---|---|
U |
Undefined — imported symbol (.extern) |
T |
Text segment — code (.global in .code/.text) |
D |
Data segment — initialized data (.global in .data) |
B |
BSS segment — uninitialized data (.global in .bss) |
Z |
Zero Page / Direct Page segment (.global in .zp) |
A |
Absolute — not relative to any segment |
| Flag | Description |
|---|---|
-u |
Display only undefined (imported) symbols |
-g |
Display only global (exported) symbols |
-n |
Sort by address instead of name (defined symbols first) |
-r |
Reverse the sort order |
-p |
No sorting — display in file order |
-A, -o |
Prepend filename to each line (file.o45:offset T name) |
-? |
Display help message |
$ nm45 main.o45
U _printf
00000000 T _main
00000000 D _counter
$ nm45 -u main.o45
U _printf
$ nm45 -n program.o45
00000000 T _init
00000000 D _buffer
0000002c T _main
00000050 T _cleanup
$ nm45 -r main.o45
00000000 D _result
00000000 T _main
U _add
Use -A to prepend filenames, making the output grep-friendly:
$ nm45 -A *.o45 | grep _main
main.o45:00000000 T _main
math.o45: U _main
This shows that main.o45 defines _main and math.o45 references it.
Without -A, multiple files get headers:
$ nm45 main.o45 math.o45
main.o45:
U _add
00000000 T _main
00000000 D _result
math.o45:
00000000 T _add
| Format | Extension | Width | Description |
|---|---|---|---|
.o45 |
.o45 |
32-bit | MEGA65 relocatable objects (produced by ca45 -c or cc45 -c) |
.o65 |
.o65 |
16-bit | Standard Andre Fachat 6502 relocatable objects (from xa65, cc65, etc.) |
Both formats share the same magic bytes ($01 $00 "o65"), option structure, relocation encoding, and symbol table layout. The reader auto-detects the width from the SIZE32 mode bit. 16-bit values are widened to 32-bit internally.
The CPU_EXT mode bit is also handled: when set, an extended CPU ID byte is read after the segment fields (e.g., $45 for 45GS02, $03 for 65CE02).
nm45 reads object files produced by:
ca45 -c input.s -o output.o45— assembler in relocatable modecc45 -c input.c -o output.o45— C compiler in relocatable mode- Any
.o65-compatible toolchain (xa65, cc65, etc.)
It is the primary diagnostic tool for inspecting symbol tables before linking with ln45.