0

如果在 Ram[SP]/[0] 中指向堆栈中下一个位置的指针,我如何指示计算机打开该位置?我努力了

@0
D=M
@D

但它没有打开存储在 Ram[0] 中的地址 如何让它访问存储在 Ram[0] 中的 ram 地址 谢谢

4

1 回答 1

0

您使用 A/M 寄存器间接通过 ram 位置。

@SP  // loads the A register with the value SP (SP predefined to 0)
A=M  // loads the A register with the contents of MEM[0] (the stack pointer)
D=M  // loads D with the contents of MEM[Stack]

@D 将使用符号位置 D 的内容加载 A 寄存器,这将由汇编程序自动分配。@D(地址)和 D(寄存器)不是一回事,因此,使用 @D 不是一个好主意。

于 2016-08-23T10:43:29.643 回答