Skip to content
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

Fix fc_nyblswap on LLVM #60

Merged
merged 1 commit into from
Aug 2, 2024
Merged

Conversation

zeldin
Copy link
Contributor

@zeldin zeldin commented Aug 2, 2024

With a constraint "a", %0 will expand to "A" in the asm, meaning "ld%0" will become "ldA" without any address. But since we have constrained the operand to already be in A, there is no need to add any load or store instructions anyway, so just remove them.

Also the global variable "swp" is not needed either, so remove that as well when using LLVM.

Checklist

Thanks a lot for your contribution!
Please tick off the following:

  • Tests run successfully (i.e. make test)
    • using the CC65 compiler
    • using the LLVM/Clang compiler
  • Doxygen style tags are used for public API
  • Source code is properly formatted; run e.g. clang-format -i <file>
  • I agree to the License of this repository

Also tested palette loading with xemu, worked fine both with cc65 and llvm-mos.
Without this fix linking fails on llvm-mos with:

ld.lld: error: ld-temp.o <inline asm>:1:2: too few operands for instruction
        ldA
        ^
ld.lld: error: ld-temp.o <inline asm>:8:1: too few operands for instruction
stA
^
ld.lld: error: ld-temp.o <inline asm>:1:2: too few operands for instruction
        ldA
        ^
ld.lld: error: ld-temp.o <inline asm>:8:1: too few operands for instruction
stA
^
ld.lld: error: ld-temp.o <inline asm>:1:2: too few operands for instruction
        ldA
        ^
ld.lld: error: ld-temp.o <inline asm>:8:1: too few operands for instruction
stA
^
mos-mega65-clang: error: ld.lld command failed with exit code 1 (use -v to see invocation)

With a constraint "a", %0 will expand to "A" in the asm, meaning
"ld%0" will become "ldA" without any address.  But since we have
constrained the operand to already be in A, there is no need to add
any load or store instructions anyway, so just remove them.

Also the global variable "swp" is not needed either, so remove that as well
when using LLVM.
@mlund mlund merged commit 1235d9f into MEGA65:development Aug 2, 2024
1 check passed
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.

2 participants