Apply a callback to an array: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 71:
ADC temp ;2a + a = 3a
RTS</lang>
 
 
 
{{out}}
Line 81 ⟶ 83:
1250: f0 f3 f6 f9 fc ff
</pre>
 
=={{header|68000 Assembly}}==
{{trans|11l}}
The following assumes all code/data is stored/executed in RAM and is therefore mutable.
<lang 68000devpac>LEA MyArray,A0
MOVE.W #(MyArray_End-MyArray)-1,D7 ;Len(MyArray)-1
MOVEQ #0,D0 ;sanitize D0-D2 to ensure nothing from any previous work will affect our math.
MOVEQ #0,D1
MOVEQ #0,D2
 
loop:
MOVE.B (A0),D0
MOVE.B D0,D1
MOVE.B D0,D2
MULU D1,D2
MOVE.B D2,(A0)+
dbra d7,loop
jmp * ;halt the CPU
 
MyArray:
DC.B 1,2,3,4,5,6,7,8,9,10
MyArray_End:</lang>
 
 
1,489

edits