SET_BANK_SEGMENT

Set the current segment of the given bank

Parameters
b

Bank number to set (0-5, depending of the mapper). Must be an inline number (not a variable)

s

Segment to select in this bank

GET_BANK_SEGMENT

Get the current segment of the given bank

Parameters
b

Bank number to get (0-5, depending of the mapper). Must be an inline number (not a variable)

Return

Segment selected in this bank

Helper

Helper inline functions

EnableInterrupt
inline void EnableInterrupt()

Enable interruption

DisableInterrupt
inline void DisableInterrupt()

Disable interruption

Halt
inline void Halt()

Pause the CPU until a new interruption occured

Call
inline void Call(
u16 addr
)

Direct call a routine at a given address (generate ASM code: "call XXXX") No extra cost due to calling a C function.

Parameters
addr
u16

Address to call

Return

Value stored in register A

CallA
inline void CallA(
u16 addr,
u8 a
)

Direct call a routine at a given address with a 8-bits parameter in register A (generate ASM code: "call XXXX") No extra cost due to calling a C function.

Parameters
addr
u16

Address to call

a
u8

Function parameter to put in register A

CallL
inline void CallL(
u16 addr,
u8 l
)

Direct call a routine at a given address with a 8-bits parameter in register L (generate ASM code: "call XXXX") No extra cost due to calling a C function.

Parameters
addr
u16

Address to call

l
u8

Function parameter to put in register L

CallHL
inline void CallHL(
u16 addr,
u16 hl
)

Direct call a routine at a given address with a 16-bits parameter in register HL (generate ASM code: "call XXXX") No extra cost due to calling a C function.

Parameters
addr
u16

Address to call

val

Function parameter to put in register HL

CallDriver
inline u8 CallDriver(
u16 addr,
u8 a
)

Direct call a routine at a given address with a 8-bits parameter in register A (generate ASM code: "call XXXX") No extra cost due to calling a C function.

Parameters
addr
u16

Address of the driver

a
u8

Value to transfer to driver's main function

Slot

Slot handling functions

Sys_GetPageSlot
u8 Sys_GetPageSlot(
u8 page
)

Get the slot ID of a given page

Parameters
page
u8

The page to ckeck

Sys_SetPageSlot
void Sys_SetPageSlot(
u8 page,
u8 slotId
)

Select a slot in a given page

Parameters
page
u8

The page to change

slotId
u8

The slot ID to select

Sys_IsSlotExpanded
inline bool Sys_IsSlotExpanded(
u8 slot
)

Check if slot is expanded

Parameters
slot
u8

The slot to check

Sys_SetPage0Slot
void Sys_SetPage0Slot(
u8 slotId
)

Select a given slot in page 0

Parameters
slotId
u8

The slot to select

Sys_SlotIsExpended
inline bool Sys_SlotIsExpended(
u8 slotId
)

Check expended flag from slot ID

Parameters
slotId
u8

The slot ID

Sys_SlotGetPrimary
inline u8 Sys_SlotGetPrimary(
u8 slotId
)

Get primary slot from slot ID

Parameters
slotId
u8

The slot ID

Sys_SlotGetSecondary
inline u8 Sys_SlotGetSecondary(
u8 slotId
)

Get secondary slot from slot ID

Parameters
slotId
u8

The slot ID

Sys_CheckSlot
u8 Sys_CheckSlot(
CheckSlotCallback cb
)

Check all slots with a given callback function

Address

Binary address functions

Sys_GetFirstAddr
inline u16 Sys_GetFirstAddr()

Get first address of program binary

Sys_GetHeaderAddr
inline u16 Sys_GetHeaderAddr()

Get address of program header (if any)

Sys_GetLastAddr
inline u16 Sys_GetLastAddr()

Get last address of program binary

Misc

Miscellaneous helper functions

Sys_PlayClickSound
inline void Sys_PlayClickSound()

Play the click sound

Sys_StopClickSound
inline void Sys_StopClickSound()

Stop the click sound