Skip to content

XMALLOC (malloc)

Description

Allocate memory. Use orix-sdk with macro to handle XMALLOC

Input

A and Y : number of bytes

Output

A&Y = $0000 : OOM or others errors else A&Y : ptr

Example

    .include "telestrat.inc"

    lda #<4000
    ldy #>4000

    BRK_TELEMON XMALLOC
    ; A & Y contains a ptr
    rts

See malloc macro from orix-sdk to use it easily

Number of malloc are limited in kernel side for all running programs

Since kernel 2026.1, malloc tried to use 'free slot' when the requested size is equal or less than a available free slot