6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Nov 15, 2024 5:28 pm

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Sun Sep 26, 2004 11:25 am 
Offline

Joined: Sun Sep 26, 2004 11:24 am
Posts: 6
Hello,
I hope you will understand my post since English isn't my native language.
I am writing a NES emulator for a Motorola 68000 platform (a TI-89 calculator to be more precise). But I'm not very familiar with 6502 assembly, although I've read a few tutorials. The emu core is under development right now, and I was wondering if the 'absolute y' addressing mode is a signed displacement?
For example: sta $700,y with y containing #$fe.
In this case, will the content of A reg be stored at address $6fe ($700-2) or $7fe ($700+$fe)?
I would appreciate if someone could give me more details about all the addressing mode wich are ambigous in this sense.
Thanks by advance. :-)


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Sep 26, 2004 2:35 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8541
Location: Southern California
No, it is not signed. It goes to 7FE. Indexing is never signed, although ZP indexed will wrap around to remain in ZP. For example, FE in ZP, indexed by 3, will result in 01, not 101. If you wanted the 101, you'd have to force the assembler to use abs instead of ZP addressing, so 00FE + 3 = 101.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Sep 26, 2004 2:41 pm 
Offline
User avatar

Joined: Tue Mar 02, 2004 8:55 am
Posts: 996
Location: Berkshire, UK
In absolute indexed instructions the index value is always unsigned so in your case an LDA $0700,X will load a byte from an address between $0700 and $07FF inclusive.

In zero page indexed instructions any carry from the low byte of the address caused by adding the index is ignored (because the processor forces the high byte of the address to be $00) so if X is $FF then LDA $80,X loads from $007F and not $017F. So these look signed.

_________________
Andrew Jacobs
6502 & PIC Stuff - http://www.obelisk.me.uk/
Cross-Platform 6502/65C02/65816 Macro Assembler - http://www.obelisk.me.uk/dev65/
Open Source Projects - https://github.com/andrew-jacobs


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Sep 26, 2004 4:42 pm 
Offline

Joined: Sun Sep 26, 2004 11:24 am
Posts: 6
I found a 6502 simulator on this site wich is a great help with all the doubts I had with addressing modes. Thanks :-)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 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:  
cron