作者owlran (鳌伦)
看板TransCSI
标题[问题] 98政大资科第二题
时间Tue May 18 16:47:52 2010
2. Assuming that the variables a, b, c and d are stored in memory
locations 100, 101, 102, and 103, resprctively.
Using any of sample machine language instructions given below,
translate the following pseudocode operations into
machine language instructions sequences.
(a) Set a to the value b+c+d
(b) Set a to the value (b*d)-(c*d)
Operation Meaning
--
LOAD X
Load register R with the contents of memory location X.
STORE X
Store the contents of register R into memory location X.
MOVE X, Y
Copy the contents of memory location X into memory location Y.
ADD X
Add the contents of memory location X to the contents of register R,
Put the result back into register R. i.e., R=R+CON(X).
SUB X
Subtract the contents of memory location X from the contents of
register R, Put the result back into register R. i.e., R=R-CON(X).
--
MUL X
Multiplythe contents of memory location X from the contents of register
R, Put the result back into register R. i.e., R=R*CON(X).
上面是题目版面有点长 ( ̄ー ̄;),
machine langaue有需要将结果回存吗 ?
小弟认为答案是,可是对STORE这指令有些疑虑...有需要用到STORE吗?
请大大指教
(a)
LOAD 101
ADD 102
ADD 103
(b)
LOAD 101
SUB 102
MUL 103
--
◢█M◣ ◢
˙‥◣
,谢谢你救了我
▄ ▄ ●‥˙
◤○︹○ 将心比心 ˙˙◥● 可是公主在另一个城堡里…
◥ □◤ 好吗? ◥▼ ◤
◢ ◤ ◥ ▃ ◣
◤◥ ◤◥
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 219.85.184.10
1F:推 stator:我是觉的不用,因为题目没写到类似A=B+C+D,只写了算式 05/18 23:35
2F:→ stator:如果有写到,就要store a 05/18 23:36
3F:→ stator:修正,是STORE 100 05/18 23:36
4F:→ owlran:谢谢s大。记得之前写组语很像也没有回存的样子。 05/18 23:41