Helper
BIOS_Exit
void BIOS_Exit(
u8 ret
)

Handle clean exit form Basic or MSX-DOS environment

Parameters
ret
u8

Return value (for MSX-DOS environment)

BIOS_SetKeyClick
inline void BIOS_SetKeyClick(
bool enable
)

Enable or disable key click

Parameters
enable
bool

TRUE to enable and FALSE to disable

BIOS_GetMSXVersion
inline u8 BIOS_GetMSXVersion()

Get MSX generation version

Return
Main-ROM - Core
BIOS_Reboot
inline void BIOS_Reboot()

Tests RAM and sets RAM slot for the system.  Wrapper for CHKRAM routine.

BIOS_InterSlotRead
u8 BIOS_InterSlotRead(
u8 slot,
u16 addr
)

Reads the value of an address in another slot.  Wrapper for RDSLT routine.

BIOS_InterSlotWrite
void BIOS_InterSlotWrite(
u8 slot,
u16 addr,
u8 value
)

Writes a value to an address in another slot.  Wrapper for WRSLT routine.

BIOS_InterSlotCall
void BIOS_InterSlotCall(
u8 slot,
u16 addr
)

Executes inter-slot call.  Wrapper for CALSLT routine.

BIOS_SwitchSlot
void BIOS_SwitchSlot(
u8 page,
u8 slot
)

Switches to specified slot and page definitively.  Wrapper for ENASLT routine.

BIOS_CALLF

Executes an interslot call.  Wrapper for CALLF routine.

Main-ROM - Init
Main-ROM - VDP
BIOS_DisableScreen
inline void BIOS_DisableScreen()

Inhibits the screen display. Wrapper for DISSCR routine.

BIOS_EnableScreen
inline void BIOS_EnableScreen()

Displays the screen. Wrapper for ENASCR routine.

BIOS_EnableScreen

Display or disable the screen.

BIOS_WriteVDP
void BIOS_WriteVDP(
u8 reg,
u8 value
)

Writes data in the VDP-register. Wrapper for WRTVDP routine.

BIOS_ReadVDP
inline u8 BIOS_ReadVDP(
u8 reg
)

Reads data from the VDP-register.

BIOS_ReadVRAM
inline u8 BIOS_ReadVRAM(
u16 addr
)

Reads the content of VRAM. Wrapper for RDVRM routine.

BIOS_WriteVRAM
void BIOS_WriteVRAM(
u8 value,
u16 addr
)

Writes data in VRAM. Wrapper for WRTVRM routine.

BIOS_SetAddressForRead
inline void BIOS_SetAddressForRead(
u16 addr
)

Enables VDP to read. Wrapper for SETRD routine.

BIOS_SetAddressForWrite
inline void BIOS_SetAddressForWrite(
u16 addr
)

Enables VDP to write. Wrapper for SETWRT routine.

BIOS_FillVRAM
void BIOS_FillVRAM(
u16 addr,
u16 length,
u8 value
)

Fills VRAM with value. Wrapper for FILVRM routine.

BIOS_CopyVRAMtoRAM
void BIOS_CopyVRAMtoRAM(
u16 vram,
voidram,
u16 length
)

Block transfer to memory from VRAM. Wrapper for LDIRMV routine.

BIOS_CopyRAMtoVRAM
void BIOS_CopyRAMtoVRAM(
const voidram,
u16 vram,
u16 length
)

Block transfer to VRAM from memory. Wrapper for LDIRVM routine.

BIOS_SetScreenMode
inline void BIOS_SetScreenMode(
u8 screen
)

Switches to given screen mode. Wrapper for CHGMOD routine.

BIOS_SetColor
inline void BIOS_SetColor(
u8 text,
u8 back,
u8 border
)

Set screen colors.

BIOS_ApplyColor
inline void BIOS_ApplyColor(
u8 text,
u8 back,
u8 border
)

Changes the screen colors. Wrapper for CHGCLR routine.

BIOS_ApplyBorder
inline void BIOS_ApplyBorder(
u8 border
)

Changes the screen colors. Wrapper for CHGCLR routine.

BIOS_SetWidth40
inline void BIOS_SetWidth40(
u8 width
)
BIOS_InitScreen0
inline void BIOS_InitScreen0()

Switches to SCREEN 0 (text screen with 40*24 characters). Wrapper for INITXT routine.

BIOS_InitScreen0Color
inline void BIOS_InitScreen0Color(
u8 width,
u8 text,
u8 back,
u8 border
)

Switches to SCREEN 0 (text screen with 40*24 characters). Wrapper for INITXT routine.

BIOS_InitScreen0Ex
inline void BIOS_InitScreen0Ex(
u16 pnt,
u16 pgt,
u8 width,
u8 text,
u8 back,
u8 border
)

Switches to SCREEN 0 (text screen with 40*24 characters). Wrapper for INITXT routine.

BIOS_SetScreen0
inline void BIOS_SetScreen0()

Switches VDP in SCREEN 0 mode. Wrapper for SETTXT routine.

BIOS_SetWidth32
inline void BIOS_SetWidth32(
u8 width
)
BIOS_InitScreen1
inline void BIOS_InitScreen1()

Switches to SCREEN 1 (text screen with 32*24 characters). Wrapper for INIT32 routine.

BIOS_InitScreen1Color
inline void BIOS_InitScreen1Color(
u8 width,
u8 text,
u8 back,
u8 border
)

Switches to SCREEN 1 (text screen with 32*24 characters). Wrapper for INIT32 routine.

BIOS_InitScreen1Ex
inline void BIOS_InitScreen1Ex(
u16 pnt,
u16 ct,
u16 pgt,
u16 sat,
u16 sgt,
u8 width,
u8 text,
u8 back,
u8 border
)

Switches to SCREEN 1 (text screen with 32*24 characters). Wrapper for INIT32 routine.

BIOS_SetScreen1
inline void BIOS_SetScreen1()

Switches VDP in SCREEN 1 mode. Wrapper for SETT32 routine.

BIOS_InitScreen2
inline void BIOS_InitScreen2()

Switches to SCREEN 2 (high resolution screen with 256*192 pixels). Wrapper for INIGRP routine.

BIOS_InitScreen2Color
inline void BIOS_InitScreen2Color(
u8 width,
u8 text,
u8 back,
u8 border
)

Switches to SCREEN 2 (high resolution screen with 256*192 pixels). Wrapper for INIGRP routine.

BIOS_InitScreen2Ex
inline void BIOS_InitScreen2Ex(
u16 pnt,
u16 ct,
u16 pgt,
u16 sat,
u16 sgt,
u8 width,
u8 text,
u8 back,
u8 border
)

Switches to SCREEN 2 (high resolution screen with 256*192 pixels). Wrapper for INIGRP routine.

BIOS_SetScreen2
inline void BIOS_SetScreen2()

Switches VDP to SCREEN 2 mode. Wrapper for SETGRP routine.

BIOS_InitScreen3
inline void BIOS_InitScreen3()

Switches to SCREEN 3 (multi-color screen 64*48 pixels). Wrapper for INIMLT routine.

BIOS_InitScreen3Ex
void BIOS_InitScreen3Ex(
u16 pnt,
u16 ct,
u16 pgt,
u16 sat,
u16 sgt,
u8 text,
u8 bg,
u8 border
)

Switches to SCREEN 3 (multi-color screen 64*48 pixels). Wrapper for INIMLT routine.

BIOS_SetScreen3
inline void BIOS_SetScreen3()

Switches VDP to SCREEN 3 mode. Wrapper for SETMLT routine.

BIOS_ClearSprites
inline void BIOS_ClearSprites()

Initialises all sprites.

BIOS_SetSpriteMode
inline void BIOS_SetSpriteMode(
u8 size,
u8 mag
)

Set sprite size (8x8 or 16x16) and magnification mode (x1 or x2).

Parameters
size
u8

Sprite size (BIOS_SPRITE_SIZE_8 or BIOS_SPRITE_SIZE_16)

mag
u8

Sprite magnification (BIOS_SPRITE_MAG_1 or BIOS_SPRITE_MAG_2)

BIOS_GetSpritePatternAddress
u16 BIOS_GetSpritePatternAddress(
u8 id
)

Returns the address of the sprite pattern table. Wrapper for CALPAT routine.

Parameters
id
u8

Sprite pattern number [0:255] of 8x8 size and [0:63] of 16x16 size)

Return

VRAM address of the sprite pattern table for the given sprite number

BIOS_GetSpriteAttributeAddress
u16 BIOS_GetSpriteAttributeAddress(
u8 id
)

Returns the address of the sprite attribute table. Wrapper for CALATR routine.

Parameters
id
u8

Sprite attribute number [0:31]

Return

VRAM address of the sprite attribute table for the given sprite number

BIOS_SetSpritePosition
inline void BIOS_SetSpritePosition(
u8 id,
u8 x,
u8 y
)

Set the position of a sprite on the screen.

Parameters
id
u8

Sprite attribute number [0:31]

x
u8

Horizontal position of the sprite [0:255]

y
u8

Vertical position of the sprite [0:255]

BIOS_SetSpritePattern
inline void BIOS_SetSpritePattern(
u8 id,
u8 pat
)

Set the pattern of a sprite.

Parameters
id
u8

Sprite attribute number [0:31]

pat
u8

Sprite pattern number [0:255]

BIOS_SetSpriteColor
inline void BIOS_SetSpriteColor(
u8 id,
u8 color
)

Set the color of a sprite.

Parameters
id
u8

Sprite attribute number [0:31]

color
u8

Sprite color [0:15]

BIOS_SetSprite
inline void BIOS_SetSprite(
u8 id,
u8 x,
u8 y,
u8 pat,
u8 color
)

Set sprite attributes.

Parameters
id
u8

Sprite attribute number [0:31]

x
u8

Horizontal position of the sprite [0:255]

y
u8

Vertical position of the sprite [0:255]

pat
u8

Sprite pattern number [0:255]

color
u8

Sprite color [0:15]

BIOS_SetSpriteData
inline void BIOS_SetSpriteData(
u8 id,
const BIOS_SpriteAttributes* attrs
)

Set a sprite attributes.

Parameters
id
u8

Sprite attribute number [0:31]

attrs
const BIOS_SpriteAttributes*

Pointer to a 4-bytes array containing the sprite attributes (y, x, pattern and color)

BIOS_GetSpriteSize
inline u8 BIOS_GetSpriteSize()

Returns current sprite size in bytes (8 or 32). Wrapper for GSPSIZ routine.

BIOS_IsSpriteCollision
inline bool BIOS_IsSpriteCollision()

Returns FALSE if no collision occured during the previous frame, otherwise returns S00_C.  This function use value of VDP status register S#0 that BIOS backup in RAM (STATFL).

BIOS_IsSpriteOverScan
inline bool BIOS_IsSpriteOverScan()

Returns FALSE if no over-scan occured during the previous frame (more than 4/8 sprites on the same line), otherwise returns S00_5S.  This function use value of VDP status register S#0 that BIOS backup in RAM (STATFL).

BIOS_GetSpriteOverScanId
inline u8 BIOS_GetSpriteOverScanId()

Returns index of the over-scaned sprite (5th/8th sprite on line). Value is in 0-31 range.  This function use value of VDP status register S#0 that BIOS backup in RAM (STATFL).

BIOS_GraphSetCursor
inline void BIOS_GraphSetCursor(
u16 x,
u16 y
)

Moves graphical cursor to the specified position.

BIOS_GraphPrintChar
inline void BIOS_GraphPrintChar(
u8 chr
)

Displays a character on the graphic screen. Wrapper for GRPPRT routine.

BIOS_GraphPrint
inline void BIOS_GraphPrint(
const c8* str
)

Displays a string on the graphic screen. Wrapper for GRPPRT routine.

BIOS_GraphPrintAt
inline void BIOS_GraphPrintAt(
u16 x,
u16 y,
const c8* str
)

Displays a string on the graphic screen. Wrapper for GRPPRT routine.

BIOS_GraphSetOperator
inline void BIOS_GraphSetOperator(
u8 op
)

Changes the operator used for graphical print.

Main-ROM - PSG
BIOS_InitPSG
inline void BIOS_InitPSG()

Initialises PSG and sets initial value for the PLAY statement. Wrapper for GICINI routine.

GICINI
Address : #0090
Function : Initialises PSG and sets initial value for the PLAY statement
Registers: All
Remarks : Interrupts must be disabled to call this routine
BIOS_WritePSG
void BIOS_WritePSG(
u8 reg,
u8 value
)

Writes data to PSG-register. Wrapper for WRTPSG routine.

WRTPSG
Address : #0093
Function : Writes data to PSG register
Input : A - PSG register number
E - Data write
Remarks : See https://www.msx.org/wiki/SOUND#Registers_Description
Parameters
reg
u8

PSG register number (0-15)

value
u8

Value to write in the PSG register

BIOS_ReadPSG
inline u8 BIOS_ReadPSG(
u8 reg
)

Reads value from PSG-register. Wrapper for RDPSG routine.

RDPSG
Address : #0096
Function : Reads value from PSG register
Input : A - PSG register read
Output : A - Value read
Parameters
reg
u8

PSG register number (0-15)

Return

Value read from the PSG register

BIOS_PlayPSG
inline void BIOS_PlayPSG()

Tests whether the PLAY statement is being executed as a background task. Wrapper for STRTMS routine.

STRTMS
Address : #0099
Function : Tests whether the PLAY statement is being executed as a background
task. If not, begins to execute the PLAY statement
Registers: All
Main-ROM - Console
BIOS_GetCharacter
inline c8 BIOS_GetCharacter()

One character input (waiting). Wrapper for CHGET routine.

BIOS_HasCharacter
u8 BIOS_HasCharacter()

Get a character input (if any) or return 0.

BIOS_TextSetCursor
void BIOS_TextSetCursor(
u8 x,
u8 y
)

Moves cursor to the specified position. Wrapper for POSIT routine.

BIOS_TextPrintChar
inline void BIOS_TextPrintChar(
c8 chr
)

Displays one character. Wrapper for CHPUT routine.

BIOS_TextPrint
inline void BIOS_TextPrint(
const c8* str
)

Displays a null-terminated string.

BIOS_TextPrintAt
inline void BIOS_TextPrintAt(
u8 x,
u8 y,
const c8* str
)

Print a text at the specified position

BIOS_Beep
inline void BIOS_Beep()

Generates beep. Wrapper for BEEP routine.

BIOS_ClearScreen
void BIOS_ClearScreen()

Clears the screen. Wrapper for CLS routine.

Main-ROM - Controller
BIOS_GetJoystickDirection
inline u8 BIOS_GetJoystickDirection(
u8 port
)

Returns the state of the joystick or the cursor keys.  Wrapper for GTSTCK routine.

Parameters
port
u8

Joystick number to be tested:

0 = Cursor keys
1 = Joystick on port 1
2 = Joystick on port 2
Return

Direction of the joystick or function keys (0-8):

 8  1  2
\ | /
7 - 0 - 3
/ |'\'
6 5 4
BIOS_GetJoystickTrigger
inline bool BIOS_GetJoystickTrigger(
u8 trigger
)

Returns the state of the mouse, joystick or keyboard space bar buttons.  Wrapper for GTTRIG routine.

Parameters
trigger
u8

Trigger button to test:

0 = space bar
1 = port 1, button A
2 = port 2, button A
3 = port 1, button B
4 = port 2, button B
Return

FALSE if trigger button is not pressed

BIOS_GetTouchPad
inline u8 BIOS_GetTouchPad(
u8 entry
)

Returns the touch pad status.  Wrapper for GTPAD routine.

Parameters
entry
u8

Function call number. Fetch device data first, then read:

MSX1:
0 = Fetch touch pad data from port 1 (#FF if available)
1 = Read X-position
2 = Read Y-position
3 = Read touchpad status from port 1 (#FF if pressed
4 = Fetch touch pad data from port 2 (#FF if available)
5 = Read X-position
6 = Read Y-position
7 = Read touchpad status from port 2 (#FF if pressed)
MSX2/2+/turbo R:
8 = Fetch light pen data (#FF if available)
9 = Read X-position
10 = Read Y-position
11 = Read light pen status (#FF if pressed)
12 = Fetch mouse data from port 1 (#FF if available)
13 = Read X-position
14 = Read Y-position
15 = Read mouse button status from port 1 (#FF if pressed)
16 = Fetch mouse data from port 2 (#FF if available)
17 = Read X-position
18 = Read Y-position
19 = Read mouse button status from port 2 (#FF if pressed)
Return

Value depending on entry parameter

BIOS_GetPaddle
inline u8 BIOS_GetPaddle(
u8 num
)

Returns the paddle position.  Wrapper for GTPDL routine.

Parameters
num
u8

Paddle number (1-12):

Paddle | Port1 | Port2
-------+-------+-------
A | 1 | 2
B | 3 | 4
C | 5 | 6
D | 7 | 8
E | 9 | 10
F | 11 | 12
Return

Paddle position [0:255]

Main-ROM - Misc
BIOS_GetKeyboardMatrix
inline u8 BIOS_GetKeyboardMatrix(
u8 line
)

Returns the value of the specified line from the keyboard matrix. Wrapper for SNSMAT routine.

BIOS_IsKeyPressed
inline bool BIOS_IsKeyPressed(
u8 key
)

Check if the given key is pressed

Main-ROM - MSX2
Main-ROM - MSX2+
Main-ROM - MSX turbo R
BIOS_SetCPUMode
inline void BIOS_SetCPUMode(
u8 mode
)

Changes CPU mode. Wrapper for CHGCPU routine.

BIOS_GetCPUMode
inline u8 BIOS_GetCPUMode()

Returns current CPU mode. Wrapper for GETCPU routine.