因此,我正在为以下内容创建汇编语言:
X = 5
Y = 7
FOR I = 1 TO 9
Y = Y + I
IF T(I) = J(I) + X THEN J(I) = T(I) * 4 - Y
ELSE J(I) = J(I) - T(I)
END_FOR
并不断收到
"Address Error: Instruction at 418 accessing address 44f
Execution halted"
我到目前为止的代码是:
ORG $400
MOVEA #T,A0
MOVEA #J,A1
MOVE.B #1,D0 //D0 is a counter to hold I
MOVE #5,D1 //X = 5
MOVE #7,D2 //Y = 7
NEXT
ADD D0,D2 //Y = Y + I
MOVE (A0),D3
MOVE (A1),D4
MOVE D4,D5 //D5 is a temp copy of J(I)
MOVE D5,D1
CMP D5,D3 //IF T(I) = J(I) + X
BNE ELSE
SUB D2,D3
MULU #4,D3
MOVE D3,(A1)
BRA END_LOOP
ELSE
SUB D3,D4 //J(I) = J(I) - T(i)
MOVE D4,(A1)
END_LOOP
ADDA #2,A0 //POINT TO NEXT ELEMENT IN T
ADDA #2,A1 //POINT TO NEXT ELEMENT IN J
ADD #1,D0
CMP #9,D0
BNE NEXT
MOVE.B #4,D0
TRAP #15 //; halt simulator
* Variables and Strings
T DC.B 6,2,5,4,9,7,3,1,0
J DC.B 5,7,1,9,2,5,6,6,1
END $400 //; last line of source
我在看什么?