Hello, im posting again with a little tiny problem i have involving Zero Page ... Y register
Sometimes i need to use a LDA "zero page" RAM in some places, which is "B9 xx 00"
the problem is, i cant figure out how to actually do it, cause i always get "incorrect addressing mode" error no matter what i try, how many times i try.
This is for "NESASM 2.51 autoZP" version. i dont know if it's a bug or not.
The only way i can ever make it work is by manually typing out a .db command with the actual hex numbers.
I tried LDA ($41),y ... LDA [$41],y ... LDA ($41,y) ...LDA [$41,y] ... the weird accented brackets like { and } ...i tried everything i can possibly think of and nothing works
except just a plain .db only
is there some way to do it ??
huh ??
Well it does exist in the NES for reals though
or ...just doesnt exist in the NESASM 2.51 "only" ??
kuja killer wrote:
LDY ($41),y ... LDY [$41],y ... LDY ($41,y) ...LDY [$41,y]
Lazycow wrote:
there's no LDY $xxxx,y
kuja killer wrote:
[Picture of LDA $0041,Y]
For a good comprehensive reference on which instructions exist, I recommend this:
http://www.obelisk.me.uk/6502/reference.html#LDY$B9 is
LDA absolute, Y though; it is neither LDY nor zero page. You can point absolute addresses at the zero page if you need to, however.
There is a
LDX/STX zero page, Y, which I think is the only instruction with that kind of addressing?
oops first of all, sorry i said it wrong when i started this topic, i meant LDA, not LDY, my mistake.
Bottom line, i was trying to get "B9 xx 00" ...like if i try LDA (not y sorry above) ...it'll come out as "B1 41" which is not what i wanted. when it needed to be " B9 "
i supposed i could just do like "LDA label name + $800" to use that so called "mirrored" RAM thing, (so that i can get rid of the raw hex numbers) ??
I think this is what you want:
LDA $0041,Y
kuja killer wrote:
oops first of all, sorry i said it wrong when i started this topic, i meant LDA, not LDY, my mistake.
Bottom line, i was trying to get "B9 xx 00" ...like if i try LDA (not y sorry above) ...it'll come out as "B1 41" which is not what i wanted. when it needed to be " B9 "
i supposed i could just do like "LDA label name + $800" to use that so called "mirrored" RAM thing, (so that i can get rid of the raw hex numbers) ??
On NESASM, I think $B1 should only happen if you put [] around the address?
$B1 is
LDA (indirect), YMost assemblers use () for indirection syntax, but NESASM uses [] instead.
Edit: apparently this specific version of NESASM uses () instead of [].
LDA $41,Y (B9 41 00) calculates the effective address by adding Y to $0041.
LDA [$41],Y (B1 41) calculates the effective address by reading the bytes at $0042 and $0041, forming a 16-bit number out of them, and adding Y.
If NESASM is assembling LDA $41,Y as B1 41, it is misbehaving. Auto-ZP should not activate for aaaa,Y mode unless the instruction is LDX, which is the only official instruction on the 6502 to have both aaaa,Y and dd,Y versions.
hmm yea i get what ya guys are saying.
well.. i guess maybe it is a bug then probably, cause yea i use this type of NESASM's "auto zp" thing so that i dont ever have to type any of those " > arrow " things next to zero page lables and stuff
but i guess it wouldnt work only with the B9 ..but ehh
96 28:009C LDA Test1,y
Incorrect addressing mode! ww
well, this is not very pretty looking but this does work:
I've never once in my life used that "mirrored ram" that goes past $800, like this..
is it "NES Safe" to do this $800 ??
Yes it's safe but it's "unusual" and there's no reason that this shouldn't produce $B9 $41 $00:
LDA Test1,y
It will only produce $B1 if you put brackets [] in there.
Edit: for this version of NESASM, it is () instead of [].
For reference, he's using this version:
http://www.2a03.jp/~minachun/nesasm/nesasm_x86.htmlAnd looks like it has a bug where it refuses to assemble
lda $69, y (it says "Incorrect addressing mode!"). It's fine with
lda $6969, y.
That version also enables parenthesis () to be used instead of brackets [] in indirect addressing.
yea what fox said, i tried all the "label,y" like rainwarrior said, and tons of different ways, and either end up with B1 ...or "incorrect addressing mode" every time.
so finally i just was like screw it and did the +$800 thing.
I went through and replaced all the ".db $B9, xx, 00" with "LDA label+$800,y" instead ...had about 10 of these throughout a whole lot of ASM files
Ah, well that explains the problem. LDA abs, Y is broken in this assembler if the address is less than $100?
I guess the only thing I'd recommend is to report the bug and/or find a better assembler. If using +$800 gets you through your current project, though, that's fine too.
Whenever you use () around the address for LDA it should produce $B1, so that part is working fine. (Sorry I incorrectly said [] before, I didn't realize this was a special version of NESASM.)
i would more than love to be able to just fix it myself in this nesasm 2.51, though i dont know any programming languages whatsoever besides NES's 6502 stuff.
And since that was made in 2011 apparently...i would not be able to use a different assembler because i have a couple files from the author of Rockman 4 Minus Infinity (puresabe) that i use, ..which were formatted specifically only for NESASM, i dont have a clue how they would be made to work with ASM6 or whatever.
Why do you insist using a shitty broken nesasm when you could use another tool instead ?
Also, as a more basic solution - since "LDA $xxxx,Y" doesn't support ZP addressing mode either, why not just use a different area of RAM for this purpose? As far as I can tell, that would circumvent the supposed bug, and still work as intended with the same amount of CPU cycles?
I agree though - I don't see any reason to even use NESASM in the first place, but I have little experience with anything other than CA65 which I have come to become a great fan of, so maybe I'm missing out of NESASM features I don't even know anything about?
The feature you're missing is that OP is learning by modifying an existing project that was already written in NESASM.
https://pastebin.com/nsp241uQThis is one of puresabe's files from Rockman 4 Minus Inifnity that i use. (i dont know how any of this stuff would be translated to other assemblers, so i dont touch it, thats why i only use nesasm personally, to be honest)
I most frequently use all the branch-jump/jsr/rts ones, and i really love the "LONG_CALL" jsr, for example
Bregalad wrote:
Why do you insist using a shitty broken nesasm when you could use another tool instead ?
This kind of tone is what drives newcomers away from this site.
kuja killer wrote:
i dont have a clue how they would be made to work with ASM6 or whatever.
Shiru's famitone2 library comes with a program to convert nesasm code to asm6 and ca65, it's called "nesasmc".
It's specifically designed to convert the famitone2 library itself, but you might be able to modify it to your own use-case (famitone2 includes the source for nesasmc).
https://shiru.untergrund.net/code.shtml...Or you could try rolling your own code converter in something like Python.
I actually had to make a few changes to the CA65 version of famitone2 to make it work properly - mostly related to symbols that were defined inside code that was ignored as a result of other symbols. I figured something like this was the culprit.