2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
23#include "../types/evmu_peripheral.h"
24#include "../types/evmu_imemory.h"
25#include <gimbal/utils/gimbal_date_time.h>
28
29
30
31#define EVMU_ROM_TYPE (GBL_TYPEID
(EvmuRom))
32#define EVMU_ROM(self) (GBL_CAST(EvmuRom, self))
37#define EVMU_ROM_NAME "rom"
40
41
42
43#define EVMU_ROM_SIZE 65536
44#define EVMU_BIOS_SYS_PROG_ADDRESS_BASE 0x0000
45#define EVMU_BIOS_SYS_PROG_SIZE 16384
46#define EVMU_BIOS_OS_PROG_ADDRESS_BASE 0xed00
47#define EVMU_BIOS_OS_PROG_SIZE 4096
50#define EVMU_BIOS_SKIP_DATE_TIME_PC 0x2e1
52#define GBL_SELF_TYPE EvmuRom
56GBL_FORWARD_DECLARE_STRUCT(EvmuRom);
88
89
90
91
92
93
94
95
96
97
98
99GBL_CLASS_DERIVE(EvmuRom, EvmuPeripheral, EvmuIMemory)
101 EVMU_RESULT (*pFnLoadBios)(GBL_SELF,
const char* pPath);
107
108
109
110
111
112
113
114
115
116GBL_INSTANCE_DERIVE_EMPTY(
EvmuRom, EvmuPeripheral)
120 (dataChanged, GBL_GENERIC, (READ, WRITE, OVERRIDE),
GBL_BOOL_TYPE),
132
133
134
135
145
146
147
148
160
161
162
163
166 GblDateTime* pDateTime) GBL_NOEXCEPT;
169 const GblDateTime* pDateTime) GBL_NOEXCEPT;
173
174
175
176
184 size_t* pSize) GBL_NOEXCEPT;
193 size_t* pSize) GBL_NOEXCEPT;
#define EVMU_EXPORT
Define used for adding attributes to export public symbols.
@ EVMU_BIOS_MODE_FILE
File Manager mode.
@ EVMU_BIOS_MODE_MAPLE
Connected to DC, Maple slave mode.
@ EVMU_BIOS_MODE_GAME
Game/Application mode.
@ EVMU_BIOS_MODE_UNKNOWN
Unknown mode (unknown BIOS)
@ EVMU_BIOS_MODE_COUNT
Number of BIOS modes.
@ EVMU_BIOS_MODE_TIME
Clock/time mode.
@ EVMU_BIOS_SUBROUTINE_FM_PRD_EX
Flash memory paged read data.
@ EVMU_BIOS_SUBROUTINE_FM_WRTA_EX
Flash memory write, return address variant 2.
@ EVMU_BIOS_SUBROUTINE_FM_VRF_EX
Flash memory page data verify.
@ EVMU_BIOS_SUBROUTINE_EXIT_EX
MODE button logic.
@ EVMU_BIOS_SUBROUTINE_RESET
Regular starting point.
@ EVMU_BIOS_SUBROUTINE_FM_WRT_EX
Flash memory write, return address variant 1.
@ EVMU_BIOS_SUBROUTINE_TIMER_EX
System time update, used as Base Timer ISR.
@ EVMU_BIOS_SUBROUTINE_SLEEP_EX
Enable sleep mode.
GblType EvmuRom_type(void)
Returns the GblType UUID associated with EvmuRom.
@ EVMU_BIOS_TYPE_UNKNOWN_IMAGE
Any other unknown image.
@ EVMU_BIOS_TYPE_EMULATED
Default, no BIOS, software emulation.
@ EVMU_BIOS_TYPE_AMERICAN_IMAGE_V1_05
CRC for American BIOS.
@ EVMU_BIOS_TYPE_JAPANESE_IMAGE_V1_04
CRC for Japanese BIOS.
uint8_t EvmuWord
Represents a single 8-bit CPU word.
uint32_t EvmuAddress
Represents a generic absolute address.
#define GBL_PROPERTIES(object,...)
Peripheral managing ROM, firmware calls, and BIOS images.
EVMU_RESULT EvmuRom_writeByte(EvmuRom *pSelf, EvmuAddress address, EvmuWord byte)
Writes the byte value to the ROM address.
EVMU_RESULT EvmuRom_writeBytes(EvmuRom *pSelf, EvmuAddress address, const void *pData, size_t *pSize)
Writes pSize bytes to ROM from pData, starting at address, writing back the number of bytes written.
EVMU_RESULT EvmuRom_loadBios(EvmuRom *pSelf, const char *pPath)
Loads a BIOS image from the path given by pPath.
GblBool EvmuRom_biosActive(const EvmuRom *pSelf)
Returns GBL_TRUE if the CPU is currently executing code from the BIOS.
EvmuWord EvmuRom_readByte(const EvmuRom *pSelf, EvmuAddress address)
Returns the byte value located at the given ROM address.
EVMU_RESULT EvmuRom_setDateTime(EvmuRom *pSelf, const GblDateTime *pDateTime)
Sets the current date and time as seen by the BIOS to the value given by pDateTime.
EvmuAddress EvmuRom_callBios(EvmuRom *pSelf, EvmuAddress entry)
Makes a firmware or BIOS subroutine call at the entry point given by entry.
EVMU_RESULT EvmuRom_skipBiosSetup(EvmuRom *pSelf, GblBool enableSkip)
Enables or disables skipping the BIOS date/time setup based on the value of enableSkip.
GblDateTime * EvmuRom_dateTime(const EvmuRom *pSelf, GblDateTime *pDateTime)
Returns the current date and time as seen by the BIOS.
EVMU_BIOS_TYPE EvmuRom_biosType(const EvmuRom *pSelf)
Returns the type of BIOS currently loaded into ROM.
EVMU_BIOS_MODE EvmuRom_biosMode(const EvmuRom *pSelf)
Returns the mode the BIOS is in (file manager, game, clock, etc)
EVMU_RESULT EvmuRom_readBytes(const EvmuRom *pSelf, EvmuAddress address, void *pData, size_t *pSize)
Reads pSize bytes from ROM into pData, starting at address, writing back the number of bytes read.
EVMU_RESULT EvmuRom_unloadBios(EvmuRom *pSelf)
Unloads any currently-loaded BIOS image, returning to software emulation.
#define GBL_CLASS_CAST(cType, klass)
#define GBL_CLASSOF(cType, self)
#define GBL_CAST(cType, self)