RosettaCodeData/Task/Apply-a-callback-to-an-array/68000-Assembly/apply-a-callback-to-an-array.68000
2023-07-01 13:44:08 -04:00

18 lines
345 B
Text

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: