RosettaCodeData/Task/Array-concatenation/68000-Assembly/array-concatenation.68000

24 lines
585 B
Plaintext

ArrayRam equ $00FF2000 ;this label points to 4k of free space.
;concatenate Array1 + Array2
LEA ArrayRam,A0
LEA Array1,A1
MOVE.W #5-1,D1 ;LEN(Array1), measured in words.
JSR memcpy_w
;after this, A0 will point to the destination of the second array.
LEA Array2,A1 ;even though the source arrays are stored back-to-back in memory, we'll assume they're not just for demonstration purposes.
MOVE.W #5-1,D1 ;LEN(Array2), measured in words
JSR memcpy_w
JMP * ;halt the CPU
memcpy_w:
MOVE.W (A1)+,(A0)+
DBRA D1,memcpy_w
rts
Array1:
DC.W 1,2,3,4,5
Array2:
DC.W 6,7,8,9,10