Skip to content

feat: atomic CLI analysis primitives & short-abs/trampoline resolution - #6

Merged
mikolas merged 10 commits into
masterfrom
feat/agent-workflow
Oct 27, 2026
Merged

mikolas merged 10 commits into
masterfrom
feat/agent-workflow

Conversation

@mikolas

@mikolas mikolas commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner

Summary

Implements the 8 atomic CLI analysis and annotation primitives, analyzer improvements, and TUI sync for agent & human reverse-engineering workflows:

  1. hunks search <query> [-s <seg>] [-n <limit>] [--dense] [-f text|json]:
    • Exposes search over mnemonics (m:), operands (o:), strings (s:), comments (c:), labels (l:), bytes (b:), hardware/math clusters (cluster:3dmath|mul|div|trig|blitter|copper|paula|bitplane|sprite|cia|dma, with --dense for $\ge 3$ hits within 24B), and self-modifying code (smc).
  2. hunks data <target> [--len N] [--copper] [--struct <Name> [--count N]] [-f text|json] (alias inspect):
    • Inspects non-code cells (dc.b/dc.w/dc.l/pointer/string), decodes Amiga Copper MOVE/WAIT/SKIP lists (--copper), and formats record arrays using struct strides (--struct). Automatically invoked when hunks cg <target> is given a non-function address/label, and returns a clear error when given an unmapped out-of-segment address.
  3. hunks xref <target_or_range> [-f text|json] & .w (EAAbsShort) / movea.l #imm,An XREF Recording:
    • Records .w (EAAbsShort, excluding pea), flat .l (EAAbsLong), and 24-bit movea.l #imm,An memory references in xrefs (both low-RAM and in-segment) without altering .w operand emission parity. Supports single-address lookup (including PTR cells) and external range rollup ($1000..$1FFF, +3DDEE..+3EFFF).
    • Re-walks code cells on full hunks analyze so xrefs are populated when re-analyzing existing databases.
  4. Indirect-Call Resolution & hint pointer --follow:
    • Completes hint pointer <addr> [count] [--follow] (target resolution, label + XrefDataAddr creation, OpStr, and code seeding).
    • Extends RunTrace to bounce through low-RAM trampolines (up to 8 steps outside image) and record re-entry targets on the originating jsr/jmp site.
    • Resolves static memory-slot function pointers (move.l #Target,$1034.w + jsr $1034.w / movea.l $1034.w,An; jsr (An)) in propagateBaseRegs.
    • Adds hunks cg --indirect [-f text|json].
  5. hunks struct & hunks alias:
    • Adds struct add/list/remove (with --size and .b/.w/.l/.p field type hints) and alias (supporting function-scoped --fn <func> aliases), emitting <field> equ <offset> and <Struct>_SIZEOF equ <size> for 100% vasmm68k_mot parity.
  6. Strict Label+Offset / Label-Offset Comment Validation (hunks comment):
    • Prints dual +seg_off (+fn_off) offsets in cg --code, formats negative function-relative offsets as signed (Func-13E), validates instruction boundaries & function bounds in hunks comment, and supports --batch/--file batch files.
  7. Function Call-ABI (hunks abi):
    • Stores function_abis in project.json (automatically re-keyed on rename/undo), computes static in:/mod:/saved: registers, verifies claimed ABI strings against static ReadRegs/WriteRegs (--verify, including warning on overwritten input claims in memory-arg functions), and surfaces ABI in cg, TUI, and emitted .asm headers.
  8. Structured Project State Export (hunks dump [-f text|json] [--section <sec>]):
    • Exports entry_points, memory_regions, renames (with abi), non-auto comments, structs, register_aliases, and carves.
  9. TUI Sync (internal/tui/):
    • Renders ; ABI: headers, [ABI: ...] call-site hints, and live struct field alias substitution (ApplyStructAliasesToOpStr) in the disassembly listing.
    • Adds A (ModalABI) to edit function ABIs interactively, displays ABIs in f (ModalFunctions), syncs ReKeyFunctionABI and UndoRename on n/Ctrl-z, filters _size in t (ModalStructs), and filters unlabeled .w XREF badges.
  10. Emitter & Documentation:
    • Emits relative equ definitions for interior labels inside carved incbin cells and external/BSS equates in EmitAllAmiga.
    • Updates MANUAL.md (including the Agent Reverse-Engineering Playbook), ARCHITECTURE.md, and README.md.

@mikolas
mikolas merged commit a4a5013 into master Oct 27, 2026
2 checks passed
@mikolas
mikolas deleted the feat/agent-workflow branch October 27, 2026 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant