mwc*_*wcz 5 decode 68000 emulation
我正在编写一个解释为68k的模拟器作为个人/教育项目.现在我正在尝试开发一种简单的通用解码机制.
据我了解,每条指令的前两个字节足以唯一地标识操作(有两个罕见的例外)和剩余要读取的字数(如果有的话).
以下是我想在解码阶段完成的工作:
1. read two bytes
2. determine which instruction it is
3. extract the operands
4. pass the opcode and the operands on to the execute phase
Run Code Online (Sandbox Code Playgroud)
我不能只将前两个字节传递到查询表中,就像RISC拱门中的前几位一样,因为操作数是"在路上".我怎样才能2以一般方式完成任务?
从广义上讲,我的问题是:如何从解码过程中消除操作数的可变性?
更多背景:
以下是程序员参考手册8.2节的部分表格:
Table 8.2. Operation Code Map
Bits 15-12 Operation
0000 Bit Manipulation/MOVEP/Immediate
0001 Move Byte
...
1110 Shift/Rotate/Bit Field
1111 Coprocessor Interface...
Run Code Online (Sandbox Code Playgroud)
这对我来说很有意义,但后来我看了每条指令的位模式,并注意到没有单个指令,其中15-12位是0001,0010或0011.必须有一些大的图片我失踪了.
这个解码Z80操作码网站明确地解释了解码,这是我在68k程序员的参考手册或谷歌搜索中找不到的.