Core
DOSMapper_Init
bool DOSMapper_Init()

Initializes DOS extended BIOS

DOSMapper_GetVarTable
inline DOS_VarTable* DOSMapper_GetVarTable()

Gets Memory Mappers variable table

Return

Pointer to DOS_VarTable structure with information about all available Memory mappers

Allocation
DOSMapper_Alloc
bool DOSMapper_Alloc(
u8 type,
u8 slot,
DOS_Segment* seg
)

Allocates a segment.  Implementation of extenpended BIOS's ALL_SEG routine.

Parameters
type
u8

Type of segment to allocate. Can be DOS_ALLOC_USER or DOS_ALLOC_SYS

slot
u8

Slot to allocate (FxxxSSPP format). You have to or your segment number with those flags:

DOS_SEGSLOT_THIS           Allocate a segment to the specified slot
DOS_SEGSLOT_OTHER Allocate a segment in another slot than the one specified
DOS_SEGSLOT_THISFIRST Allocate a segment to the specified slot if free, otherwise in another slot
DOS_SEGSLOT_OTHERFIRST Allocate a segment in another slot than the one specified if free otherwise try in specified slot

seg - Information about allocated segment

Return

TRUE the segment have been allocated

DOSMapper_Free
bool DOSMapper_Free(
u8 seg,
u8 slot
)

Frees a segment.  Implementation of extenpended BIOS's FRE_SEG routine.

Parameters
seg
u8

Segment number to free

slot
u8

Slot of the Memory mapper

Return

TRUE the segment have been freed

DOSMapper_FreeStruct
inline bool DOSMapper_FreeStruct(
DOS_Segment* seg
)

Frees a segment through a structure.

Parameters
seg
DOS_Segment*

Segment structure (contain segment number and Memory mapper slot)

Return

TRUE the segment have been freed

Page I/O
DOSMapper_ReadByte
u8 DOSMapper_ReadByte(
u8 seg,
u16 addr
)

Reads byte from given address.  Implementation of extenpended BIOS's RD_SEG routine.  /!\ Warning: The mapper RAM slot must be selected in page-2 when this routine is called.

Parameters
seg
u8

Segment number to read from

addr
u16

Address within the segment (0000h~3FFFh)

Return

Value at the given address

DOSMapper_WriteByte
void DOSMapper_WriteByte(
u8 seg,
u16 addr,
u8 val
)

Writes byte to given address.  Implementation of extenpended BIOS's WR_SEG routine.  /!\ Warning: The mapper RAM slot must be selected in page-2 when this routine is called.

Parameters
seg
u8

Segment number to write at

addr
u16

Address within the segment (0000h~3FFFh)

val
u8

Value to write

Page handling
DOSMapper_SetPage
void DOSMapper_SetPage(
u8 page,
u8 seg
)

Selects a segment on the corresponding memory page at the specified address.  Implementation of extenpended BIOS's PUT_PH routine.

Parameters
page
u8

Page to set the segment

seg
u8

Segment number to set

DOSMapper_SetPage0
void DOSMapper_SetPage0(
u8 seg
)

Selects a segment on page 0 (0000h~3FFFh).  Implementation of extenpended BIOS's PUT_P0 routine.

Parameters
seg
u8

Segment number to set

DOSMapper_SetPage1
void DOSMapper_SetPage1(
u8 seg
)

Selects a segment on page 1 (4000h~7FFFh).  Implementation of extenpended BIOS's PUT_P1 routine.

Parameters
seg
u8

Segment number to set

DOSMapper_SetPage2
void DOSMapper_SetPage2(
u8 seg
)

Selects a segment on page 2 (8000h~BFFFh).  Implementation of extenpended BIOS's PUT_P2 routine.

Parameters
seg
u8

Segment number to set

DOSMapper_GetPage
u8 DOSMapper_GetPage(
u8 page
)

Gets the selected segment number on the corresponding memory page at the specified address.  Implementation of extenpended BIOS's GET_PH routine.

Parameters
page
u8

Page to get the current selected segment

Return

Segment number selected on the given page

DOSMapper_GetPage0
u8 DOSMapper_GetPage0()

Gets the segment number on page 0 (0000h~3FFFh).  Implementation of extenpended BIOS's GET_P0 routine.

Return

Segment number

DOSMapper_GetPage1
u8 DOSMapper_GetPage1()

Gets the segment number on page 1 (4000h~7FFFh).  Implementation of extenpended BIOS's GET_P1 routine.

Return

Segment number

DOSMapper_GetPage2
u8 DOSMapper_GetPage2()

Gets the segment number on page 2 (8000h~BFFFh).  Implementation of extenpended BIOS's GET_P2 routine.

Return

Segment number

DOSMapper_GetPage3
u8 DOSMapper_GetPage3()

Gets the segment number on page 3 (C000h~FFFFh).  Implementation of extenpended BIOS's GET_P3 routine.

Return

Segment number