Re: [cc65-devel] HuC6280 zero-page addressing problem.
cc65 - a freeware C compiler for 6502 based systems
Brought to you by:
gpz
|
From: Damian Y. <te...@gm...> - 2016-07-25 21:40:41
|
On Wed, Jul 6, 2016 at 12:48 AM, Greg King <gr...@us...> wrote: > > On 2016-06-25 2:07 PM, John Brandwood wrote: > > > > The obvious question is ... would you allow the programmer to set the > > direct-page to a symbol whose location is not resolved until link-time? > > ld65 knows nothing about op-codes; therefore, it cannot change > instructions. .DPAGE's operand will need to be an assembler constant. A non-constant argument to .DPAGE can still be useful in theory if the *difference* between each affected operand and the .DPAGE operand is constant. Or if the program forces direct page, such as through a z: prefix or a direct-page-only addresing mode (such as (d),Y), it can assemble the instruction and add a link-time assertion that the operand is 0-255. .p816 .import someabsvar, another quarterin = someabsvar + $40 halfwayin = someabsvar + $80 pea someabsvar pld .dpage someabsvar ; These should assemble to DP opcodes because ; (quarterin - someabsvar) is constant at assembly time lda z:quarterin lda (quarterin),y lda quarterin ; These should assemble to DP opcodes followed by ; an assertion that (another - someabsvar) is in 0-255 lda z:another lda (another),y ; This should assemble to an absolute opcode because ; the difference between the symbols can't be determined ; at assembly time lda another |