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:
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.
Checklist
Thanks a lot for your contribution! Please tick off the following:
make test
)clang-format -i <file>
Also tested palette loading with xemu, worked fine both with cc65 and llvm-mos. Without this fix linking fails on llvm-mos with: