memory.copy
Copy a block of memory from one location to another. Because there is only one default memory area, this is done within the same memory.

Syntax

memory.copy

Stack In

i32 The offset within memory to copy data to.
i32 The offset within memory to copy data from.
i32 The number of bytes to copy.

Stack Out

NONE

Example

;; Create memory
(memory 1)
  
;; Create function
(func $resetMemory
  ;; Set the offset within memory to copy the data to
  i32.const 1024

  ;; Set the offset within memory to copy the data from
  i32.const 0

  ;; Set the number of bytes to copy
  i32.const 256

  ;; Copy the block of data in memory
  memory.copy

  ;; The first 256 bytes have been copied to offset 1024
)