jibby/utils/memory

Memory allocation and manipulation functions.

Procs

proc initMalloc(): void {....raises: [], tags: [], forbids: [].}
Initializes the memory allocator. In the case of the Arena (or NimArena) allocator, this is basically your free function.

Templates

template setMem(start: pointer; value: byte; length: Natural)
Fills a section of memory with a single byte.

Example: cmd: --compileOnly -r:off

import jibby/utils/memory

# fill WRAM0 with 0xFF
cast[pointer](0xc000).setMem(0xff, 0xd000 - 0xc000)

# clear WRAM0
cast[pointer](0xc000).zeroMem(0xd000 - 0xc000)
template setMem(start: pointer; value: static byte; length: Natural)
This variant should be automatically called when you invoke setMem with a constant value, it just tells you to use zeroMem (from system) if you use it with a value == 0x00.