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-2024 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 */
21#pragma once
22
23#ifndef BIOS_H
24#define BIOS_H
25
26#include <stdint.h>
27#include "bios_const.h"
28#include "bios_entry.h"
29
30#ifndef __SDCCCALL
31#define __sdcccall(x)
32#endif
33
44#define PAGE_SIZE (uint16_t)(0x4000)
45
52#define PAGE_ADDR(p) ((void *)(PAGE_SIZE * (p)))
53
57extern const uint8_t libmsx_initial_slots[4];
58
62#define CARTRIDGE_SLOT (libmsx_initial_slots[1])
63
69inline uint8_t msx_get_version(void) {
71}
72
78inline uint8_t msx_get_vsync_frequency(void) {
79 return ((INTERNATIONAL_ID_1 & 0x80) ? 50 : 60);
80}
81
103uint8_t msx_RDSLT(uint8_t slot, void * addr);
104
116void msx_WRSLT(uint8_t slot, void * addr, uint8_t value) __sdcccall(0);
117
128void msx_ENASLT(uint8_t slot, void * addr);
129
137uint8_t msx_get_slot(void * addr);
138
146uint8_t msx_RSLREG(void);
147
155void msx_WSLREG(uint8_t value);
156
190uint8_t msx_GTSTCK(const uint8_t a);
191
211uint8_t msx_GTTRIG(const uint8_t a);
212
248void msx_CHGCPU(const uint8_t mode);
249
274void msx_set_cpu_mode(const uint8_t mode);
275
296uint8_t msx_GETCPU(void);
297
316uint8_t msx_get_cpu_mode(void);
317
320#ifndef __SDCCCALL
321#undef __sdcccall
322#endif
323
324#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:69
uint8_t msx_get_vsync_frequency(void)
MSX Returns VSYNC frequency in Hz.
Definition bios.h:78
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).