It is currently Tue Sep 25, 2018 12:54 pm

 All times are UTC - 7 hours

 Page 1 of 1 [ 1 post ]
 Print view Previous topic | Next topic
Author Message
 Post subject: [原创教程] 汇编寻址与高级代码的对应关系Posted: Fri Oct 02, 2009 2:39 am

Joined: Sun Feb 15, 2009 8:23 am
Posts: 27

6502资料可以看"图解6502 指令集.pdf"或"6502编程大奥秘.chm(前三章节就够)"。我个人比较喜欢看后者。

6502的寻址有13个。

1。立即寻址

LDA #03 //就是将03传入A寄存器。

STA W //W为一个变量，这里用了“直接寻址”，下面有说明，这一行的作用是将A寄存器的值传到W上。

2。直接寻址

2.1

LDA #03

STA W //W为一个变量，W也是一个地址。高级代码不直接写地址而是写成变量。

2.2

2.3

LDA #03

STA \$0300

2.4

N=W

LDA W

STA N

3。零页寻址

4。累加器寻址

LDA W

ASL //操作数就在A中

STA N

N = W << 1

5。隐含寻址

6。直接X变址

6.1

LDX #03

LDA W,X

STA N

6.2

LDX #03

LDA \$0300,X

STA \$0200

LDA \$0303

STA \$0200

7。直接Y变址

8。零页X变址，这个与“直接X变址”相近，就是局限在零页，省略高位。

9。零页Y变址，这个与“直接Y变址”相近，就是局限在零页，省略高位。

10。间接寻址

JMP (P) //这个不是跳到P地址上，而是跳到P所指向的地址。

11。先变址X后间接寻址

ldx #03

lda (P,X)

sta W

W=*P(3)

12。先间址后变址Y

P记录着这个数组的首地址。即P=&W

ldy #03

lda (P),Y

sta N

P=&W

...

N=*P(3)

13。相对寻址

while....

{...

}

if .... then ... else ....

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 1 post ]

 All times are UTC - 7 hours

#### Who is online

Users browsing this forum: No registered users and 2 guests

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

Search for:
 Jump to:  Select a forum ------------------ NES / Famicom    NESdev    NESemdev    NES Graphics    NES Music    Homebrew Projects       2018 NESdev Competition       2017 NESdev Competition       2016 NESdev Competition       2014 NESdev Competition       2011 NESdev Competition    Newbie Help Center    NES Hardware and Flash Equipment       Reproduction    NESdev International       FCdev       NESdev China       NESdev Middle East Other    General Stuff    Membler Industries    Other Retro Dev       SNESdev       GBDev    Test Forum Site Issues    phpBB Issues    Web Issues    nesdevWiki