libmsx
C library for MSX
Loading...
Searching...
No Matches
bios.h
Go to the documentation of this file.
1// -*- coding: utf-8-unix -*-
2/*
3 * Copyright (c) 2021-2025 Daishi Mori (mori0091)
4 *
5 * This software is released under the MIT License.\n
6 * See https://github.com/mori0091/libmsx/blob/main/LICENSE
7 *
8 * GitHub libmsx project\n
9 * https://github.com/mori0091/libmsx
10 */
22#pragma once
23
24#ifndef BIOS_H
25#define BIOS_H
26
27#include <stdint.h>
28#include "bios_const.h"
29#include "bios_entry.h"
30
31#ifndef __SDCCCALL
32#define __sdcccall(x)
33#endif
34
45#define PAGE_SIZE (uint16_t)(0x4000)
46
53#define PAGE_ADDR(p) ((void *)(PAGE_SIZE * (p)))
54
58extern const uint8_t libmsx_initial_slots[4];
59
63#define CARTRIDGE_SLOT (libmsx_initial_slots[1])
64
70inline uint8_t msx_get_version(void) {
72}
73
79inline uint8_t msx_get_vsync_frequency(void) {
80 return ((INTERNATIONAL_ID_1 & 0x80) ? 50 : 60);
81}
82
104uint8_t msx_RDSLT(uint8_t slot, void * addr);
105
117void msx_WRSLT(uint8_t slot, void * addr, uint8_t value) __sdcccall(0);
118
129void msx_ENASLT(uint8_t slot, void * addr);
130
138uint8_t msx_get_slot(void * addr);
139
147uint8_t msx_RSLREG(void);
148
156void msx_WSLREG(uint8_t value);
157
191uint8_t msx_GTSTCK(const uint8_t a);
192
212uint8_t msx_GTTRIG(const uint8_t a);
213
249void msx_CHGCPU(const uint8_t mode);
250
275void msx_set_cpu_mode(const uint8_t mode);
276
297uint8_t msx_GETCPU(void);
298
317uint8_t msx_get_cpu_mode(void);
318
321#ifndef __SDCCCALL
322#undef __sdcccall
323#endif
324
325#endif
Constant variables in the MSX BIOS ROM.
static const uint8_t MSX_SYSTEM_VERSION_CODE
MSX System version code of MSX BIOS (002DH / MAIN).
Definition bios_const.h:70
static const uint8_t INTERNATIONAL_ID_1
MSX International identifier code #1 of MSX BIOS (002BH / MAIN).
Definition bios_const.h:46
Assembler entry points for MSX BIOS functions.
uint8_t msx_get_version(void)
MSX Returns MSX system version code.
Definition bios.h:70
uint8_t msx_get_vsync_frequency(void)
MSX Returns VSYNC frequency in Hz.
Definition bios.h:79
const uint8_t libmsx_initial_slots[4]
MSX Initial slot addresses for each page.
void msx_set_cpu_mode(const uint8_t mode)
MSX Change the CPU mode.
uint8_t msx_get_cpu_mode(void)
MSX Get the CPU mode.
uint8_t msx_GETCPU(void)
MSXturboR BIOS : GETCPU (0183H/MAIN)
void msx_CHGCPU(const uint8_t mode)
MSXturboR BIOS : CHGCPU (0180H/MAIN)
uint8_t msx_GTSTCK(const uint8_t a)
MSX BIOS : GTSTCK (00D5H / MAIN)
uint8_t msx_GTTRIG(const uint8_t a)
MSX BIOS : GTTRIG (00D8H / MAIN)
void msx_ENASLT(uint8_t slot, void *addr)
MSX BIOS : ENASLT (0024H / MAIN).
void msx_WRSLT(uint8_t slot, void *addr, uint8_t value) __sdcccall(0)
MSX BIOS : WRSLT (0014H / MAIN).
void msx_WSLREG(uint8_t value)
MSX BIOS : WSLREG (013BH / MAIN).
uint8_t msx_get_slot(void *addr)
MSX Get the current slot of a 16KiB page that including the given address.
uint8_t msx_RDSLT(uint8_t slot, void *addr)
MSX BIOS : RDSLT (000CH / MAIN).
uint8_t msx_RSLREG(void)
MSX BIOS : RSLREG (0138H / MAIN).