问题描述
- IAS的指令集操作中地址修改操作STOR M(x,)
-
向量A,B,C的起始地址分别为,1001,2001,3001.做A(i)+B(i)=C(i)的计算i从1到1000.代码如下,但是从7R开始有些困惑,为什么执行完Add M(2)后,累加器AC的地址就变成1002,而不是1001呢?(感觉add M(1)是AC的地址是1呀)
Location Instruction Comments
0 999 Constant (count N)
1 1 Constant
2 1000 Constant
3L LOAD M(2000) Transfer A(I) to AC
3R ADD M(3000) Compute A(I) + B(I)
4L STOR M(4000) Transfer sum to C(I)
4R LOAD M(0) Load count N
5L SUB M(1) Decrement N by 1
5R JUMP+ M(6, 20:39) Test N and branch to 6R if nonnegative
6L JUMP M(6, 0:19) Halt
6R STOR M(0) Update N
7L ADD M(1) Increment AC by 1
7R ADD M(2)
8L STOR M(3, 8:19) Modify address in 3L
8R ADD M(2)
9L STOR M(3, 28:39) Modify address in 3R
9R ADD M(2)
10L STOR M(4, 8:19) Modify address in 4L
10R JUMP M(3, 0:19) Branch to 3L
时间: 2024-10-30 15:11:08