10000 Allow multiple passes for da65 to resolve labels by kugelfuhr · Pull Request #2723 · cc65/cc65 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Allow multiple passes for da65 to resolve labels #2723

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 23, 2025

Conversation

kugelfuhr
Copy link
Contributor

This adds -d/--debug and -m/--multi-pass options to the disassembler. The latter will make the disassembler run multiple preparation passes to find all addresses where labels must be placed. Without -m some label addresses are found in the final pass, where the disassembler cannot make use of them.

As in many other cases I would have added test but the test infrastructure is lacking for things like this one.

This should fix what is left from #2717.

@mrdudz
Copy link
Contributor
mrdudz commented Jun 20, 2025

As in many other cases I would have added test but the test infrastructure is lacking for things like this one.

In such cases it would help if you could propose such test - the test infrastructure can be updated :)

@kugelfuhr
Copy link
Contributor Author

In such cases it would help if you could propose such test - the test infrastructure can be updated :)

This file:

        .org    $E0ED
label_a:
        sta     label_b
label_b:
        bcs     label_a+1
        lda     #$00

as taken mostly from #2717 when assembled, linked and disassembled with -m should contain

LE0CB:  beq     LE0AD

and the label LE0AD of course defined instead of

LE0CB:  beq     * + (-30)

It should be possible to create an input file that needs more than just 3 preparation passes (as the one above does) by carefully constructing instructions where every new label breaks up another 3-byte instruction to form .byte plus a branch, but without any chance to get it into the tests this is probably wasted time.

…e latter

will make the disassembler run multiple preparation passes to find all
addresses where labels must be placed. Without -m some label addresses are
found in the final pass, where the disassembler cannot make use of them.
@kugelfuhr kugelfuhr force-pushed the kugelfuhr/fix-2717 branch from 5c08d89 to 4c81eac Compare June 23, 2025 12:59
@mrdudz
Copy link
Contributor
mrdudz commented Jun 23, 2025

Thanks!

813B

@mrdudz mrdudz merged commit a0c6c64 into cc65:master Jun 23, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0