Skip to content

XVALUES ROUTINE

Get vars from kernel

Get Free malloc table

X = KERNEL_XVALUES_FREE_MALLOC_TABLE

KERNEL_XVALUES_FREE_MALLOC_TABLE = $02

Returns in A and Y a copy of free malloc table. This ptr must be free when the buffer is useless

Example

    .include "telestrat.inc"

    KERNEL_XVALUES_FREE_MALLOC_TABLE = $02

    ldx     #KERNEL_XVALUES_FREE_MALLOC_TABLE

    BRK_TELEMON  $2D ; XVALUES

    ; A and Y contains a ptr of free malloc table

    rts

Get Busy malloc table

X = KERNEL_XVALUES_BUSY_MALLOC_TABLE

KERNEL_XVALUES_FREE_MALLOC_TABLE = $07

Returns in A and Y a copy of busy malloc table. This ptr must be free when the buffer is useless

    .include "telestrat.inc"

    KERNEL_XVALUES_FREE_MALLOC_TABLE = $07

    ldx     #KERNEL_XVALUES_BUSY_MALLOC_TABLE

    BRK_TELEMON  $2D ; XVALUES

    rts

Get processName of the current chunk

Y contains the id of the malloc busy table

Y = the pid X = 08

It returns in A & Y the ptr of the process name.

KERNEL_XVALUES_GET_CURRENT_PROCESSNAME_FROM_PID = $08

    .include "telestrat.inc"

    KERNEL_XVALUES_GET_CURRENT_PROCESSNAME_FROM_PID = $07

    ldx     #KERNEL_XVALUES_GET_CURRENT_PROCESSNAME_FROM_PID
    ldy     #03 ; Get the name of pid = 3

    BRK_TELEMON  $2D ; XVALUES

    rts

Get the path of an opened file and mode of the opened file

KERNEL_XVALUES_PATH_FROM_FD = $09

Y must contains the fd.

    .include "telestrat.inc"

    KERNEL_XVALUES_PATH_FROM_FD = $09

    ldx     #KERNEL_XVALUES_PATH_FROM_FD
    ldy     #$03 ; Get the name of pid = 3

    BRK_TELEMON  $2D ; XVALUES
    ; A and Y contains the ptr of path
    ; X contains the mode of the file
    rts

Get the position in the opened file (ftell)

KERNEL_XVALUES_GET_FTELL_FROM_FD = $0A

Params : * X = KERNEL_XVALUES_GET_FTELL_FROM_FD * A = FD

It returns in A, X, Y and RES, the position in the file

    .include "telestrat.inc"

    KERNEL_XVALUES_PATH_FROM_FD = $0A

    ldx     #KERNEL_XVALUES_GET_FTELL_FROM_FD
    lda     myfd ; fd

    BRK_TELEMON  $2D ; XVALUES
    ; A, X, Y and RES contains the size
    ; X contains the mode of the file
    rts

Get the ptr of the pid list

KERNEL_XVALUES_GET_PROCESS_ID_LIST=$0C

; A and Y contains the ptr

Get the processname with the PID

A = contains the POD

X = KERNEL_XVALUES_GET_PROCESS_NAME_WITH_PID

A & Y = contains the ptr of processname

Get the number of malloc available in the kernel

X = 5

Returns in A the number of the malloc

Get the magic number of the kernel

X = 6

Returns in A the magic number

Get the max process configured in the kernel

X = 8

Output :

A contains the max process

Get Os string (Orix)

    .include "telestrat.inc"

    XVARS_KERNEL_OSNAME = 9

    ldx     #XVARS_KERNEL_OSNAME
    BRK_TELEMON XVARS
    ; A and X contains the ptr to osname
    rts

It will be available in Kernel v2023.2

Get an empty bank

    .include "telestrat.inc"

    KERNEL_XVALUES_GET_FREE_BANK = $10

    ldx     #KERNEL_XVALUES_GET_FREE_BANK
    ldy     #$00 ; RAM type
    BRK_TELEMON  $2D ; XVALUES
    ; Y contains the id of the bank
    ; X contains set ($343 register)
    ; A the bank ($321 register)
    ; If there is no available bank, Y=0
    rts

It will be available in Kernel v2023.2

It can only allocate the first 8 banks

It does not verify the content of any bank

The content is reset every reboot


Last update: 2024-02-15