OSCR
Open Source Cartridge Reader
Loading...
Searching...
No Matches
GameBoyAdvance.h
1#pragma once
2#if !defined(OSCR_CORE_GAMEBOYADVANCE_H_)
3# define OSCR_CORE_GAMEBOYADVANCE_H_
4
5# include "config.h"
6
7# if HAS_GBX
8# include "syslibinc.h"
9# include "common/Types.h"
10# include "common/crc32.h"
11
12# define gbaCRDB ((OSCR::Databases::GBA *)cartCRDB)
13
18{
20 {
21 crc32_t crc32;
22 char serial[5];
23 uint16_t size;
24 uint16_t saveType;
25 char name[101];
26 };
27
28 extern crdbGBARecord * romDetail;
29
30 void menu();
31 void reproMenu();
32
33 void openCRDB();
34 void closeCRDB();
35
36 void cartOn();
37 void cartOff();
38
39 void printHeader();
40
41 void readROM();
42
43 void rtcTest();
44
45 void readSRAM(uint32_t sramSize, uint32_t pos);
46 void writeSRAM(uint32_t sramSize, uint32_t pos);
47
48 void readFRAM(uint32_t framSize);
49 void writeFRAM(uint32_t framSize);
50
51 void writeEeprom(uint16_t eepSize);
52 void readEeprom(uint16_t eepSize);
53 void send(uint16_t currAddr, uint16_t numBits);
54 void writeBlock(uint16_t startAddr, uint16_t eepSize);
55 void readBlock(uint16_t startAddress, uint16_t eepSize);
56 uint32_t verifyEEP(uint16_t eepSize);
57
58 void initOutputFlash();
59 void idFlash();
60 void resetFlash();
61 uint8_t readByteFlash(uint16_t myAddress);
62 void writeByteFlash(uint16_t myAddress, uint8_t myData);
63 void eraseFlash();
64 bool blankcheckFlash(uint32_t flashSize);
65 void switchBank(uint8_t bankNum);
66
67 void readFlash(bool browseFile, uint32_t flashSize, uint32_t pos);
68 void writeFlash(bool browseFile, uint32_t flashSize, uint32_t pos, bool isAtmel);
69 uint32_t verifyFlash(uint32_t flashSize, uint32_t pos);
70 void busyCheck(uint16_t currByte);
71
72 void setROM();
73
74 bool compare_checksum();
75
76 uint16_t readWord(uint32_t myAddress);
77 void writeWord(uint32_t myAddress, uint16_t myWord);
78
79 uint16_t readWord_GAB(uint32_t myAddress);
80 void writeWord_GAB(uint32_t myAddress, uint16_t myWord);
81
82 uint8_t readByte(uint16_t myAddress);
83 void writeByte(uint16_t myAddress, uint8_t myData);
84
85 uint8_t checksumHeader(uint8_t const * header);
86 void getCartInfo();
87
88 uint8_t getSaveType();
89 void printFlashTypeAndWait(__FlashStringHelper const * caption);
90
91# if HAS_FLASH
92 void setupRepro();
93 void reproMenu();
94 void repro369in1Menu();
95
96 void resetIntel(uint32_t partitionSize);
97 void resetMX29GL128E();
98 bool sectorCheckMX29GL128E();
99 void idFlashrom();
100 bool blankcheckFlashrom();
101 void eraseIntel4000();
102 void eraseIntel4400();
103 void sectorEraseMSP55LV128();
104 void sectorEraseMX29GL128E();
105 void writeIntel4000();
106 void writeMSP55LV128();
107 void writeMX29GL128E();
108 bool verifyFlashrom();
109
110 void reset369in1();
111 void mapBlock369in1(uint32_t offset);
112 void printblockNumber(int index);
113 void printFileSize(int index);
114 uint8_t selectBlockNumber(bool option);
115 void read369in1(uint8_t blockNumber, uint8_t fileSizeByte);
116 void erase369in1(uint8_t blockNumber);
117 void write369in1(uint8_t blockNumber);
118
119 void flashRepro(bool option);
120# endif /* HAS_FLASH */
121} /* namespace OSCR::Cores::GameBoyAdvance */
122
123# endif /* HAS_GBX */
124#endif /* OSCR_CORE_GAMEBOYADVANCE_H_ */
System core for the Game Boy Advance.
Definition GameBoyAdvance.h:18
Definition GameBoyAdvance.h:20
Interface for handling CRC32 values.
Definition crc32_t.h:14