CA65 currently assumes that zero-page/direct-page references resolve to absolute address $0000-$00FF.
This isn't correct on the HuC6280 where zero-page/direct-page references resolve to absolute addresses $2000-$20FF.
This leads CA65 to generate inefficient/wrong code for instructions referencing addresses $0000-$00FF and $2000-$20FF on the HuC6280.
I'm adding a pull request for a fix to this that differentiates between instructions with one-byte immediate operands that are always $0000-$00FF (handled by the existing old Emit1() function), from instructions that have one-byte direct-page/zero-page references where the top-byte of the address is different on different processors (handled by the new EmitZP() function).
EmitZP() is just a copy of the existing Emit1() function but with the check for the top-byte changing depending upon the currently-selected processor.
The text was updated successfully, but these errors were encountered:
Added new Pull Request #319, with notes on the fix.
The only "safe" solution that I've been able to come up with causes the HuC6280 to assemble zero-page instructions for both $0000-$00FF and $2000-$20FF.
This isn't perfect, but it is acceptable because the PC Engine doesn't ever need to access $0000-$00FF if the VDC is accessed through one of its mirror locations in $0100-$03FF.
CA65 currently assumes that zero-page/direct-page references resolve to absolute address $0000-$00FF.
This isn't correct on the HuC6280 where zero-page/direct-page references resolve to absolute addresses $2000-$20FF.
This leads CA65 to generate inefficient/wrong code for instructions referencing addresses $0000-$00FF and $2000-$20FF on the HuC6280.
I'm adding a pull request for a fix to this that differentiates between instructions with one-byte immediate operands that are always $0000-$00FF (handled by the existing old Emit1() function), from instructions that have one-byte direct-page/zero-page references where the top-byte of the address is different on different processors (handled by the new EmitZP() function).
EmitZP() is just a copy of the existing Emit1() function but with the check for the top-byte changing depending upon the currently-selected processor.
The text was updated successfully, but these errors were encountered: