1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
* 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 ( D - T(I)
*END_FOR
*
ORG $400
MOVEA #T, A0 A0 point at base of array T
MOVEA #J,A1 Al points at base of array J
MOVE #1,D0 Use D0 as a counter to hold I
MOVE #5,D1 X = 5; Dl is X
MOVE #7,D2 Y = 7; D2 is Y
Next ADD D0,D2 Y = Y + I
MOVE (A0), D3 Read T(I) into D3
MOVE (A1),D4 Read J(I) into D4
MOVE D4,D5 D5 is a temp copy of J(I)
ADD D1,D5 Compute J(I) + X in D5
CMP D5,D3 IF T(I) = J(I) +X
BNE Else
MULU #4,D3 THEN compute T(I) * 4 -Y
SUB D2,D3
MOVE D3, (Al) J(I)= T(I) *4 -Y
BRA End_loop
Else SUB D3,D4 J(I)=J(I) -T(I)
MOVE D4,(Al)
End_Loop ADDA #2,A0 Point to next element in T
ADDA #2, Al Point to next element in J
ADD #1, D0 Increment the loop counter
CMP #10,D0 Repeat until I=10
BNE Next
|