Array concatenation: Difference between revisions
Content added Content deleted
Puppydrum64 (talk | contribs) |
|||
Line 3,849: | Line 3,849: | ||
b = [4,5,6]; |
b = [4,5,6]; |
||
ab = grow(a, b);</lang> |
ab = grow(a, b);</lang> |
||
=={{header|Z80 Assembly}}== |
|||
The routine <code>Monitor_Memdump</code> displays a hexdump to the Amstrad CPC's screen. |
|||
Credit to Keith of [https://www.chibiakumas.com ChibiAkumas] for creating it. |
|||
<lang z80> |
|||
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 |
|||
dw ArrayRam ; start dumping from ArrayRam |
|||
ret ; return to basic |
|||
ArrayRam: |
|||
ds 24,0 ;24 bytes 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</lang> |
|||
{{out}} |
|||
<pre> |
|||
801D: |
|||
AA BB CC DD EE FF 23 45 67 89 00 |
|||
</pre> |
|||
=={{header|zkl}}== |
=={{header|zkl}}== |