Page 2 of 2

Re: NESASM forces absolute addressing in zero page

Posted: Fri Oct 31, 2014 6:53 pm
by tokumaru
Yes, this and other workarounds have been suggested. It's not like this is impossible to do, but the code is more readable if you don't have to do things like this, and not having to look up opcodes will save some time too.

Re: NESASM forces absolute addressing in zero page

Posted: Fri Oct 31, 2014 9:12 pm
by 3gengames
Would the preferred solution to be an assembler that optimizes all instructions for zeropage unless the object is denoted with a $ character preceding the object's name/value? :)

Re: NESASM forces absolute addressing in zero page

Posted: Fri Oct 31, 2014 9:29 pm
by tepples
$ is reserved for the hexadecimal constant prefix. I've seen that ca65 optimizes where possible (address is known to be less than $100 before it is used) unless a: is specified.

Re: NESASM forces absolute addressing in zero page

Posted: Sat Nov 01, 2014 6:29 pm
by tokumaru
A modifier is certainly the best solution, because it can be applied to anything (hardcoded addresses, variables and expressions) but I never heard of this syntax before (a:). Is it common or just a CA65 thing? I've seen .w appended to the operator a few times before, so I'm not sure which is more common. When you force an addressing mode like this, you're in fact modifying both the operator (different opcode) and the operand (16 bits instead of 8), so both make sense to me.

Re: NESASM forces absolute addressing in zero page

Posted: Sat Nov 01, 2014 7:01 pm
by tepples
In 68000 assembly, instructions use .W and the like to specify the size of the data (8, 16, or 32 bits), not the size of the address.

Re: NESASM forces absolute addressing in zero page

Posted: Sat Nov 01, 2014 7:13 pm
by tokumaru
tepples wrote:In 68000 assembly, instructions use .W and the like to specify the size of the data (8, 16, or 32 bits), not the size of the address.
If that's the case, then this really isn't the best option for 6502 assembly.

Re: NESASM forces absolute addressing in zero page

Posted: Sat Nov 08, 2014 9:25 am
by tomaitheous
Doesn't ASM6 support macros? It shouldn't be too difficult to write macros for instructions that need to read/write full address or zp addressing.

Re: NESASM forces absolute addressing in zero page

Posted: Sat Nov 08, 2014 1:50 pm
by zzo38
Just let it known that I personally happen to prefer the way NESASM does it; zero page addressing is marked explicitly.

Re: NESASM forces absolute addressing in zero page

Posted: Tue Jun 20, 2017 11:38 am
by keldon
How about:

Code: Select all

LDA (zeroPageAddress + $800), y

Re: NESASM forces absolute addressing in zero page

Posted: Tue Jun 20, 2017 11:41 am
by rainwarrior
That's not a valid 6502 instruction. The value within () needs to be < $100. There is no indirect indexed LDA that takes a pointer from outside the zero-page. (Only indirect JMP can do this.)

LDA (zp), Y

Re: NESASM forces absolute addressing in zero page

Posted: Tue Jun 20, 2017 2:08 pm
by keldon
My bad I meant:

Code: Select all

LDA zeroPageAddress+$800, y
To force opcode $B9.

Re: NESASM forces absolute addressing in zero page

Posted: Tue Jun 20, 2017 2:15 pm
by rainwarrior
Well, yes you can use mirrored addresses for ZP on the NES, though I don't think it's a good way to do this.

In NESASM it will be absolute anyway if you don't use the < prefix, so it's not relevant.

On ca65 you can force an absolute address with an a: prefix. I think it's better to use this instead of relying on mirroring.

Code: Select all

LDA a:zeroPageAddress, y

Re: NESASM forces absolute addressing in zero page

Posted: Fri Oct 19, 2018 6:54 am
by morskoyzmey
For those who found this thread.
I have a patch barely discussed in this topic
I'd like to get some feedback, and I could fix it to fit community needs.