- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在查看 here 中 MOS 6502 指令集的寻址模式.
间接、Y 索引
的描述与其他来源有点不一致。
上面写着
OPC ($LL),Y operand is effective address incremented by Y with carry; effective address is word at zeropage address
但是其他来源没有提到进位位的加法。喜欢here .
计算有效地址的正确方法是什么?
最佳答案
如有疑问,最好查看官方文档。
MOS 有一份令人着迷的原始数据表 here 还有[ 1 ] 内容为
INDIRECT INDEXED ADDRESSING - In indirect indexed addressing (referred to as
( Indirect) , Y
), the second byte of the instruction points to a memory location in page zero.
The contents of this memory location is added to the contents of theY
index register, the result being the low order eight bits of the effective address.
The carry from this addition is added to the contents of the next page zero memory location, the result being the high order eight bits of the effective address.
因此,第二次加法是通过进位进行的。
您可以将其视为 Immediate
指向的 16 位字(在 little-endian 中)与 Y
寄存器零扩展到 16 的内容之间的 16 位加法。位。
例如,如果内存和Y
是
All values in hex
Address 00 01 02 03 04 ...
Value 80 02 f3 00 03 ...
Y = 90
那么(0),Y
就是
low 8 bits: 80 + 90 = 10 (with carry = 1)
high 8 bits: 02 + 00 + 1 = 03
提供有效地址0310
。类似地(3),Y
是
low 8 bits: 00 + 90 = 90 (with carry = 0)
high 8 bits: 03 + 00 + 0 = 03
这会产生值为0390
的有效地址。
您可以看到,当考虑为 16 位量时,0 处的字为 0280
,Y
为 0090
,它们的相加为 0310
正如预期的那样。
长描述只是对这些事实进行编码:a) Indirect
指向的 16 位字存储在小端 b) Y
是零扩展的 c)加法是 16 位的。
在 C 语言中,它应该是这样的
uint16_t effective_addr(uint8_t indirect)
{
//Take the INDIRECT immediate and make a pointer to a 16-bit LE word out of it
//In C int-to-ptr is implementation define, we assume an identity map here
uint16_t* page_zero_ptr = (uint16_t*)indirect;
//The Y register is 8-bit, we consider it a 16-bit one instead
//Assume y is of unsigned type
uint16_t y_zero_ext = y;
//Do a 16-bit addition, this is equivalent to two 8-bit additions with carry
return *page_zero_ptr + y;
}
关于assembly - MOS 6502 中的间接 Y 变址寻址模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46262435/
我正在尝试提供即时转码的视频。不幸的是,这意味着寻求不起作用。我假设这是因为浏览器不知道视频有多长,因此无法正确显示搜索栏。 有谁知道是否可以对视频的时长进行硬编码? 我想到的另一个选择可能是创建我自
我是一名优秀的程序员,十分优秀!