1

Lately I am writing (or trying) an emulator for the 6502 NES CPU.

I am learning many many things, some of them really surprise me and I was wondering what's the explanation for those, in particular, two things came to my mind

  1. The existence of bugs, in particular the 6502 seems to have a bug in the indirect addressing mode, at least for the first processors (it affects the one used in the NES)
  2. Unofficial operation codes: Again, really surprising that there are codes not official yet usable, some of them seem to be totally useless (like DOP and TOP which are variations of NOP), and some of them seem to be composition of other operation codes (such SAX or DCP).

The question is, how is it possible that when manufacturing millions of those CPUs, they ended up with bugs (such the indirect addressing mode) and also, why on earth would you as a manufacturer include unofficial operation codes that may be removed in following revisions? Does this happen also with newer CPUs?

4

1 回答 1

4

1:有时甚至在流行且经过良好测试的处理器中也存在错误,例如Pentium FDIV 错误。任何复杂到真正有用的系统都有错误。

2:无证操作码的存在主要是为了简化操作码识别过程中的逻辑。

例如,如果我们看一下LDY、和操作(零页寻址模式),操作码的值是:LDALDXLAX

operation  hex  binary
-----------------------------
LDY        A4   10100100
LDA        A5   10100101
LDX        A6   10100110
LAX        A7   10100111

如果您查看低两位,您会发现它们用于指定操作的目标。00表示Y寄存器,01表示A寄存器,10表示X寄存器,并且由于11设置了两个位,数据最终都在AX寄存器中。

于 2014-12-07T22:06:19.337 回答