gbdev / rgbobj

A Rust program for humans to inspect RGBDS object files
MIT License
5 stars 1 forks source link

Miscellaneous output changes #6

Closed Rangi42 closed 5 months ago

Rangi42 commented 5 months ago

As we discussed:

And also:

This does not change assertions to print symbol names instead of "Sym#1337"; that's handled by the rgbds-obj package.

Rangi42 commented 5 months ago

Using a local rgbds-obj repo to support v9r9 objects:

$ cat file.asm
SECTION "Section1", ROM0
        Label1:
        db 1, 2, 3
        dw Label1
        Label2:
        db 4, 5, 6
        dw Label2
SECTION "Section 2", ROM0
        dw Label1 + Label2
        assert warn, Label1 + Label2 < $ffff
$ ./target/debug/rgbobj -s name,type -p none -a src,offset file.o
file.o [304 bytes]: RGBDS object v9 revision 9

Symbols
-------

Label1
Label2

Sections
--------

SECTION "Section 2", ROM0
SECTION "Section1", ROM0

Assertions
----------

file.asm(10) @ $0002
$ ./target/debug/rgbobj -A -r infix file.o
file.o [304 bytes]: RGBDS object v9 revision 9
    Symbols: 2
    Sections: 2
    Assertions: 1

Symbols
-------

Label1 (#0) [local]
    file.asm(2)
    SECTION: "Section1" [@ $0000]

Label2 (#1) [local]
    file.asm(5)
    SECTION: "Section1" [@ $0005]

Sections
--------

SECTION "Section 2", ROM0
    $0002 (2) bytes:
    0000: 0000

    1 patch:
    file.asm(9) @ $0000 (word)
        PC in "Section 2" @ $0000
        infix expression:
            Sym#0 + Sym#1
        RPN data (11 bytes):
            [81 00 00 00 00 81 01 00 00 00 00]

SECTION "Section1", ROM0
    $000a (10) bytes:
    0000: 0102 0300 0004 0506 0000

    2 patches:
    file.asm(7) @ $0008 (word)
        PC in "Section1" @ $0008
        infix expression:
            Sym#1
        RPN data (5 bytes):
            [81 01 00 00 00]
    file.asm(4) @ $0003 (word)
        PC in "Section1" @ $0003
        infix expression:
            Sym#0
        RPN data (5 bytes):
            [81 00 00 00 00]

Assertions
----------

file.asm(10) @ $0002 (warning)
    PC in "Section 2" @ $0002
    infix expression:
        Sym#0 + Sym#1 < $ffff
    No message