RosettaCodeData/Task/Array-concatenation/Z80-Assembly/array-concatenation.z80

32 lines
797 B
Z80 Assembly

org $8000
ld hl,TestArray1 ; pointer to first array
ld de,ArrayRam ; pointer to ram area
ld bc,6 ; size of first array
ldir
; DE is already adjusted past the last entry
; of the first array
ld hl,TestArray2 ; pointer to second array
ld bc,4 ; size of second array
ldir
call Monitor_MemDump
db 32 ; hexdump 32 bytes (only the bytes from the arrays will be shown in the output for clarity)
dw ArrayRam ; start dumping from ArrayRam
ret ; return to basic
ArrayRam:
ds 24,0 ;24 bytes of ram initialized to zero
org $9000
TestArray2:
byte $23,$45,$67,$89
; just to prove that this doesn't rely on the arrays
; being "already concatenated" I've stored them
; in the reverse order.
TestArray1:
byte $aa,$bb,$cc,$dd,$ee,$ff