It is currently Tue Dec 12, 2017 9:15 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Mon Oct 30, 2017 2:15 pm 
Offline

Joined: Mon May 25, 2009 2:20 pm
Posts: 38
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 ??

Image


Last edited by kuja killer on Mon Oct 30, 2017 2:41 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Mon Oct 30, 2017 2:21 pm 
Offline
User avatar

Joined: Tue Jun 11, 2013 1:04 pm
Posts: 60
there's no LDY $xxxx,y


Top
 Profile  
 
PostPosted: Mon Oct 30, 2017 2:26 pm 
Offline

Joined: Mon May 25, 2009 2:20 pm
Posts: 38
huh ??
Well it does exist in the NES for reals though :|
Image

or ...just doesnt exist in the NESASM 2.51 "only" ?? :|


Top
 Profile  
 
PostPosted: Mon Oct 30, 2017 2:31 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6509
Location: Seattle
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]


Top
 Profile  
 
PostPosted: Mon Oct 30, 2017 2:38 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5891
Location: Canada
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?


Top
 Profile  
 
PostPosted: Mon Oct 30, 2017 2:40 pm 
Offline

Joined: Mon May 25, 2009 2:20 pm
Posts: 38
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) ??


Last edited by kuja killer on Mon Oct 30, 2017 2:43 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Mon Oct 30, 2017 2:43 pm 
Offline
User avatar

Joined: Thu Sep 15, 2016 6:29 am
Posts: 455
Location: Denmark (PAL)
I think this is what you want:

LDA $0041,Y


Top
 Profile  
 
PostPosted: Mon Oct 30, 2017 2:45 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5891
Location: Canada
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), Y

Most assemblers use () for indirection syntax, but NESASM uses [] instead.

Edit: apparently this specific version of NESASM uses () instead of [].


Last edited by rainwarrior on Mon Oct 30, 2017 6:19 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Mon Oct 30, 2017 2:48 pm 
Online

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19334
Location: NE Indiana, USA (NTSC)
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.


Top
 Profile  
 
PostPosted: Mon Oct 30, 2017 3:05 pm 
Offline

Joined: Mon May 25, 2009 2:20 pm
Posts: 38
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 ??

Image


Last edited by kuja killer on Mon Oct 30, 2017 3:18 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Mon Oct 30, 2017 3:09 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5891
Location: Canada
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 [].


Last edited by rainwarrior on Mon Oct 30, 2017 6:20 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Mon Oct 30, 2017 3:26 pm 
Offline
User avatar

Joined: Mon Jan 03, 2005 10:36 am
Posts: 2982
Location: Tampere, Finland
For reference, he's using this version: http://www.2a03.jp/~minachun/nesasm/nesasm_x86.html

And 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.

_________________
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: kkfos.aspekt.fi


Top
 Profile  
 
PostPosted: Mon Oct 30, 2017 4:40 pm 
Offline

Joined: Mon May 25, 2009 2:20 pm
Posts: 38
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


Top
 Profile  
 
PostPosted: Mon Oct 30, 2017 6:25 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5891
Location: Canada
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.)


Top
 Profile  
 
PostPosted: Mon Oct 30, 2017 7:12 pm 
Offline

Joined: Mon May 25, 2009 2:20 pm
Posts: 38
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group