OSCR
Open Source Cartridge Reader
Loading...
Searching...
No Matches
GameBoy.h
1#pragma once
2#if !defined(OSCR_CORE_GAMEBOY_H_)
3# define OSCR_CORE_GAMEBOY_H_
4
5# include "config.h"
6
7# if HAS_GBX
8# include "syslibinc.h"
9# include "common/Types.h"
10
11namespace OSCR::Cores
12{
16 namespace GameBoyX
17 {
18 extern char const PROGMEM GBFlashItem6[];
19
20 void menu();
21 void menuPelican();
22 void menuDatel();
23 void menuFlash();
24 void menu29F();
25
26# if HAS_FLASH
27 bool flashCFI();
28# endif /* HAS_FLASH */
29 } /* namespace OSCR::Cores::GameBoyX */
30
34 namespace GameBoy
35 {
36 enum class MenuOption : uint8_t
37 {
38 ReadROM,
39 ReadSave,
40 WriteSave,
41 RefreshCart,
42 Back,
43 };
44
45 constexpr uint8_t const kMenuOptionMax = 5;
46
47 extern bool audioWE;
48 extern uint16_t lastByteAddress;
49
50 void menu();
51
52 void openCRDB();
53 void closeCRDB();
54
55 void cartOn();
56 void cartOff();
57
58 void setupPort();
59
60 bool checkCart();
61 void printCartInfo();
62 uint8_t refreshCart(__FlashStringHelper const * menuOptions[], MenuOption * const menuOptionMap);
63
64 bool readROM();
65 bool readSave();
66 bool writeSave();
67
68 bool readSRAM();
69 bool writeSRAM();
70
71 bool readSRAMFLASH_MBC6();
72 bool writeSRAMFLASH_MBC6();
73
74 bool readEEPROM_MBC7();
75 bool writeEEPROM_MBC7();
76 void sendMBC7EEPROM_Inst(uint8_t op, uint8_t addr, uint16_t data);
77
78 void disableFlashSaveMemory();
79
80 uint8_t readByte(uint16_t myAddress);
81 void writeByte(int myAddress, uint8_t myData);
82 void writeByte(int myAddress, uint8_t myData, bool audio_as_WE);
83
84 uint8_t readByteSRAM(uint16_t myAddress);
85 void writeByteSRAM(int myAddress, uint8_t myData);
86
87 void sendW29C020Command(uint8_t cmd);
88 void sendW29C020CommandSufix(uint8_t cmd);
89 void send28LF040Potection(bool enable);
90 void readPelican();
91 void writePelican();
92 bool isToggle(uint8_t byte1, uint8_t byte2);
93
94 void readMegaMem();
95 void writeMegaMem();
96
97 void sendGamesharkCommand(uint8_t cmd);
98 void readGameshark();
99 void writeGameshark();
100
101 void sendFlashCommand(uint8_t cmd, bool commandSet);
102 void busyCheck(uint32_t address, uint8_t data);
103 void writeFlash(uint8_t MBC, bool commandSet, bool flashErase);
104 void sendCFICommand(uint8_t cmd);
105 uint8_t readByteCompensated(int address);
106 void writeByteCompensated(int address, uint8_t data);
107 bool identifyCFI();
108 bool writeCFI();
109 } /* namespace OSCR::Cores::GameBoy */
110} /* namespace OSCR::Cores */
111
112# endif /* HAS_GBX */
113#endif /* OSCR_CORE_GAMEBOY_H_ */
System core for the Game Boy.
Definition GameBoy.h:35
System core for Game Boy X devices.
Definition GameBoy.h:17
Cores for supported systems
Definition crc32.h:40