NESASM forces absolute addressing in zero page
Moderator: Moderators
Re: NESASM forces absolute addressing in zero page
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
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
$ 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
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
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
If that's the case, then this really isn't the best option for 6502 assembly.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.
-
- Posts: 592
- Joined: Thu Aug 28, 2008 1:17 am
- Contact:
Re: NESASM forces absolute addressing in zero page
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.
__________________________
http://pcedev.wordpress.com
http://pcedev.wordpress.com
Re: NESASM forces absolute addressing in zero page
Just let it known that I personally happen to prefer the way NESASM does it; zero page addressing is marked explicitly.
(Free Hero Mesh - FOSS puzzle game engine)
Re: NESASM forces absolute addressing in zero page
How about:
Code: Select all
LDA (zeroPageAddress + $800), y
- rainwarrior
- Posts: 8731
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: NESASM forces absolute addressing in zero page
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
LDA (zp), Y
Re: NESASM forces absolute addressing in zero page
My bad I meant:
To force opcode $B9.
Code: Select all
LDA zeroPageAddress+$800, y
- rainwarrior
- Posts: 8731
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: NESASM forces absolute addressing in zero page
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.
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
- morskoyzmey
- Posts: 13
- Joined: Sat Sep 15, 2018 2:59 pm
Re: NESASM forces absolute addressing in zero page
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.
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.