📄 8.8.2.htm
字号:
<html>
<head>
<title>8.2的解答</title>
</head>
<body background="../images/background.gif">
<center><font class="title2"><b>练习8.2</b></font></center><br>
<p align="left">解:</p>
<p align="left"> 设栈顶活动记录的开始地址在R<sub>0</sub>中,用变量的名字表示其在活动记录中的偏移量(offset)。例如,变量a的地址表示成
a(R<sub>0</sub>)。<br>
目标代码如下:</p>
<p align="left"><span lang="EN-US"> (a)</span><span
style="font-family:宋体;mso-ascii-font-family:"Times New Roman";
mso-hansi-font-family:"Times New Roman"">
MOV #1 x(R</span><sub>0</sub><span
style="font-family:宋体;mso-ascii-font-family:"Times New Roman";
mso-hansi-font-family:"Times New Roman"">)</span></p>
<p align="left"><span lang="EN-US"> (b)</span><span
style="font-family:宋体;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"Times New Roman"">
MOV y(R</span><sub>0</sub><span
style="font-family:宋体;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"Times New Roman"">)
x(R</span><sub>0</sub><span
style="font-family:宋体;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"Times New Roman"">)</span></p>
<p><span lang="EN-US"> (c)</span><span
style="font-family:宋体;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"Times New Roman"">
ADD #1 x(R</span><sub>0</sub><span
style="font-family:宋体;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"Times New Roman"">)</span></p>
<p><span lang="EN-US"> (d)</span><span
style="font-family:宋体;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"Times New Roman"">
MOV b(R</span><sub>0</sub><span
style="font-family:宋体;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"Times New Roman"">)
R</span><sub>1</sub><br>
MUL c(R<sub>0</sub>)
R<sub>1</sub><br>
ADD a(R<sub>0</sub>)
R<sub>1</sub><br>
MOV R<sub>1</sub>
x(R<sub>0</sub>)<sub> </sub></p>
<p><span lang="EN-US"> (e)</span><span
style="font-family:宋体;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"Times New Roman"">
MOV a(R</span><sub>0</sub><span
style="font-family:宋体;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"Times New Roman"">)
R</span><sub>1</sub><br>
MOV b(R<sub>0</sub>)
R<sub>2</sub><br>
ADD c(R<sub>0</sub>)
R<sub>2</sub><br>
DIV R<sub>2</sub>
R<sub>1</sub><br>
MOV e
R<sub>2</sub><br>
ADD f
R<sub>2</sub><br>
MUL d(R<sub>0</sub>)
R<sub>2</sub><br>
SUB R<sub>2</sub>
R<sub>1</sub><br>
MOV R<sub>1</sub>
x(R<sub>0</sub>)</p>
</body>
</html>
<html><script language="JavaScript">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -