System

calloc View Source

Allocates memory for a given number of elements of a given size (that is, BC * A bytes total), then fills it with zeros.

Inputs

A

Size of element

BC

Number of elements

Outputs

A

Error code (on failure)

IX

First byte of allocated and zeroed memory (on success)

Z

Set on success, reset on failure

contextSwitch View Source

Triggers a context switch early. This will transfer control from your thread to another and eventaully return to yours with interrupts enabled.

free View Source

Frees a previously allocated section of memory

Inputs

IX

Pointer to first byte of section

loadLibrary View Source

Loads a library into memory, or references one that may already be loaded.

Inputs

Z

Set on success, reset on failure

DE

Pointer to full path of library

malloc View Source

Allocates the specified amount of memory.

Inputs

BC

Length of requested section, in bytes

Outputs

A

Error code (on failure)

IX

First byte of allocated memory (on success)

Z

Set on success, reset on failure

memSeekToEnd View Source

Move IX to the end of the memory section it points to.

Inputs

IX

Pointer to anywhere in a section of allocated memory

Outputs

IX

Pointer to last byte of section

memSeekToStart View Source

Move IX to the beginning of the memory section it points to.

Inputs

IX

Pointer to anywhere in a section of allocated memory

Outputs

IX

Pointer to first byte of section

memcheck View Source

Walks over memory and makes sure nothing has corrupted the allocation list.

Outputs

Z

Set if OK, reset if broken

Notes

A reboot is probably required if this returns NZ.

memoryAvailable View Source

Finds the amount of memory available for use.

Outputs

DE

Largest allocatable sum

BC

Total memory available

memset View Source

Sets the value of an entire allocated section of memory.

Inputs

A

Value to set

IX

Pointer to anywhere in allocated section

realloc View Source

Reallocates a block of memory at a different size and returns a new pointer.

Inputs

IX

Block to resize

BC

New size

Outputs

A

Preserved if success, error code if failure

IX

New memory

Z

Reset on failure, set on success

Notes

This function may have to move the memory that you've allocated. Consider the old pointer invalid and use the one returned from realloc instead.

reassignMemory View Source

Reassigns a given block of memory to the specified thread ID.

Inputs

A

Thread ID for new owner

IX

Pointer to any location within the target block.

reboot View Source

Restarts the device.

shutdown View Source

Shuts off the device.

suspendDevice View Source

Turns off the screen, enters low power mode, and halts system operation until the ON key is pressed.