Memset

From Pico-8 Wiki
Jump to navigation Jump to search
memset( destaddr, val, len )
Writes a byte value to every address in a region of memory.
destaddr
The address of the first memory location to write.

val
The byte value to write.

len
The length of the region of memory to write, as a number of bytes.

The memset() function is a fast way to fill a region of memory with one byte value.

Examples

-- clear all user data, 0x4300-0x5dff
memset(0x4300, 0, 0x1b00)

-- fill the screen with white
-- (equivalent to rectfill(0,0,128,128,7))
memset(0x6000, 0x77, 0x2000)

See also