1
0
Fork 0
mirror of https://github.com/imjasonh/nescript synced 2026-07-08 00:45:38 +00:00

CLI: --memory-map flag

Dumps a human-readable table of variable allocations sorted by
address, separated into zero-page and main RAM sections with a
final byte-usage summary. Struct fields show up as individual
entries under their synthetic \`var.field\` names.

Example output for examples/structs_enums_for.ne:

    === NEScript Memory Map ===
    Zero Page (\$00-\$FF):
      \$00-\$0F  [SYSTEM]  reserved (frame flag, input, state, params, scratch)
      \$0010    [USER]    enemy_y (u8)
      \$0011    [USER]    i (u8)

    RAM (\$0200-\$07FF):
      \$0200-\$02FF  [SYSTEM]  OAM shadow buffer
      \$0300        [USER]    player.x (u8)
      \$0301        [USER]    player.y (u8)
      \$0302        [USER]    player.vx (u8)
      ...

    Zero Page: 2/128 bytes used
    Main RAM:  11/1280 bytes used

https://claude.ai/code/session_01W6eQFStA66EuMKHUFo2rx3
This commit is contained in:
Claude 2026-04-12 17:43:39 +00:00
parent 496925344d
commit db234a6ca7
No known key found for this signature in database
2 changed files with 80 additions and 7 deletions

View file

@ -937,13 +937,14 @@ nescript build game.ne --asm-dump
nescript build game.ne --dump-ir
```
| Flag | Description |
|---------------|----------------------------------------------------------------|
| `--output` | Set output ROM file path (default: input.nes) |
| `--debug` | Enable debug mode with runtime checks |
| `--asm-dump` | Dump generated 6502 assembly to stdout |
| `--dump-ir` | Dump the lowered IR program (after optimization) to stdout |
| `--use-ast` | Use the legacy AST-based codegen (default is the IR codegen) |
| Flag | Description |
|-----------------|----------------------------------------------------------------|
| `--output` | Set output ROM file path (default: input.nes) |
| `--debug` | Enable debug mode with runtime checks |
| `--asm-dump` | Dump generated 6502 assembly to stdout |
| `--dump-ir` | Dump the lowered IR program (after optimization) to stdout |
| `--memory-map` | Dump a memory map of variable allocations to stdout |
| `--use-ast` | Use the legacy AST-based codegen (default is the IR codegen) |
### Check