mirror of
https://github.com/sanni/cartreader.git
synced 2024-11-26 22:44:15 +01:00
remove local variables which are only used in function context
This commit is contained in:
parent
73700e2886
commit
d1d83bbd10
@ -233,19 +233,10 @@ const uint8_t RAM[] PROGMEM = { 0, 8, 16, 32 };
|
|||||||
uint8_t ramlo = 0; // Lowest Entry
|
uint8_t ramlo = 0; // Lowest Entry
|
||||||
uint8_t ramhi = 3; // Highest Entry
|
uint8_t ramhi = 3; // Highest Entry
|
||||||
|
|
||||||
uint16_t banks;
|
|
||||||
uint16_t prg;
|
uint16_t prg;
|
||||||
uint16_t chr;
|
uint16_t chr;
|
||||||
uint8_t ram;
|
uint8_t ram;
|
||||||
bool vrc4e = false;
|
|
||||||
uint8_t prgchk0;
|
|
||||||
uint8_t prgchk1;
|
|
||||||
bool mmc6 = false;
|
bool mmc6 = false;
|
||||||
uint8_t prgchk2;
|
|
||||||
uint8_t prgchk3;
|
|
||||||
word eepsize;
|
|
||||||
uint8_t bytecheck;
|
|
||||||
uint8_t firstbyte;
|
|
||||||
bool flashfound = false; // NESmaker 39SF040 Flash Cart
|
bool flashfound = false; // NESmaker 39SF040 Flash Cart
|
||||||
|
|
||||||
// Cartridge Config
|
// Cartridge Config
|
||||||
@ -1557,10 +1548,10 @@ setram:
|
|||||||
void checkMMC6() { // Detect MMC6 Carts - read PRG 0x3E00A ("STARTROPICS")
|
void checkMMC6() { // Detect MMC6 Carts - read PRG 0x3E00A ("STARTROPICS")
|
||||||
write_prg_byte(0x8000, 6); // PRG Bank 0 ($8000-$9FFF)
|
write_prg_byte(0x8000, 6); // PRG Bank 0 ($8000-$9FFF)
|
||||||
write_prg_byte(0x8001, 0x1F); // 0x3E000
|
write_prg_byte(0x8001, 0x1F); // 0x3E000
|
||||||
prgchk0 = read_prg_byte(0x800A);
|
uint8_t prgchk0 = read_prg_byte(0x800A);
|
||||||
prgchk1 = read_prg_byte(0x800B);
|
uint8_t prgchk1 = read_prg_byte(0x800B);
|
||||||
prgchk2 = read_prg_byte(0x800C);
|
uint8_t prgchk2 = read_prg_byte(0x800C);
|
||||||
prgchk3 = read_prg_byte(0x800D);
|
uint8_t prgchk3 = read_prg_byte(0x800D);
|
||||||
if ((prgchk0 == 0x53) && (prgchk1 == 0x54) && (prgchk2 == 0x41) && (prgchk3 == 0x52))
|
if ((prgchk0 == 0x53) && (prgchk1 == 0x54) && (prgchk2 == 0x41) && (prgchk3 == 0x52))
|
||||||
mmc6 = true; // MMC6 Cart
|
mmc6 = true; // MMC6 Cart
|
||||||
}
|
}
|
||||||
@ -1670,6 +1661,7 @@ void dumpMMC5RAM(word base, word address) { // MMC5 SRAM DUMP - PULSE M2 LO/HI
|
|||||||
}
|
}
|
||||||
|
|
||||||
void writeMMC5RAM(word base, word address) { // MMC5 SRAM WRITE
|
void writeMMC5RAM(word base, word address) { // MMC5 SRAM WRITE
|
||||||
|
uint8_t bytecheck;
|
||||||
myFile.read(sdBuffer, 512);
|
myFile.read(sdBuffer, 512);
|
||||||
for (size_t x = 0; x < 512; x++) {
|
for (size_t x = 0; x < 512; x++) {
|
||||||
do {
|
do {
|
||||||
@ -1711,6 +1703,7 @@ void readPRG(bool readrom) {
|
|||||||
|
|
||||||
word base = 0x8000;
|
word base = 0x8000;
|
||||||
bool busConflict = false;
|
bool busConflict = false;
|
||||||
|
uint16_t banks;
|
||||||
|
|
||||||
if (myFile) {
|
if (myFile) {
|
||||||
switch (mapper) {
|
switch (mapper) {
|
||||||
@ -2724,6 +2717,8 @@ void readCHR(bool readrom) {
|
|||||||
display_Update();
|
display_Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint16_t banks;
|
||||||
|
|
||||||
LED_GREEN_ON;
|
LED_GREEN_ON;
|
||||||
set_address(0);
|
set_address(0);
|
||||||
_delay_us(1);
|
_delay_us(1);
|
||||||
@ -2885,12 +2880,13 @@ void readCHR(bool readrom) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 23: // 128K
|
case 23: { // 128K
|
||||||
// Detect VRC4e Carts - read PRG 0x1FFF6 (DATE)
|
// Detect VRC4e Carts - read PRG 0x1FFF6 (DATE)
|
||||||
// Boku Dracula-kun = 890810, Tiny Toon = 910809
|
// Boku Dracula-kun = 890810, Tiny Toon = 910809
|
||||||
// Crisis Force = 910701, Parodius Da! = 900916
|
// Crisis Force = 910701, Parodius Da! = 900916
|
||||||
write_prg_byte(0x8000, 15);
|
write_prg_byte(0x8000, 15);
|
||||||
prgchk0 = read_prg_byte(0x9FF6);
|
bool vrc4e;
|
||||||
|
uint8_t prgchk0 = read_prg_byte(0x9FF6);
|
||||||
if (prgchk0 == 0x30) { // Check for "0" in middle of date
|
if (prgchk0 == 0x30) { // Check for "0" in middle of date
|
||||||
vrc4e = true; // VRC4e Cart
|
vrc4e = true; // VRC4e Cart
|
||||||
}
|
}
|
||||||
@ -2904,7 +2900,7 @@ void readCHR(bool readrom) {
|
|||||||
dumpBankCHR(0x0, 0x400);
|
dumpBankCHR(0x0, 0x400);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case 24: // 128K
|
case 24: // 128K
|
||||||
banks = int_pow(2, chrsize) * 4;
|
banks = int_pow(2, chrsize) * 4;
|
||||||
write_prg_byte(0xB003, 0); // PPU Banking Mode 0
|
write_prg_byte(0xB003, 0); // PPU Banking Mode 0
|
||||||
@ -3563,6 +3559,8 @@ void readRAM() {
|
|||||||
display_Clear();
|
display_Clear();
|
||||||
display_Update();
|
display_Update();
|
||||||
|
|
||||||
|
uint16_t banks;
|
||||||
|
|
||||||
LED_BLUE_ON;
|
LED_BLUE_ON;
|
||||||
LED_GREEN_ON;
|
LED_GREEN_ON;
|
||||||
set_address(0);
|
set_address(0);
|
||||||
@ -3641,7 +3639,8 @@ void readRAM() {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 16: // 256-byte EEPROM 24C02
|
case 16: // 256-byte EEPROM 24C02
|
||||||
case 159: // 128-byte EEPROM 24C01 [Little Endian]
|
case 159: {// 128-byte EEPROM 24C01 [Little Endian]
|
||||||
|
size_t eepsize;
|
||||||
if (mapper == 159)
|
if (mapper == 159)
|
||||||
eepsize = 128;
|
eepsize = 128;
|
||||||
else
|
else
|
||||||
@ -3652,7 +3651,7 @@ void readRAM() {
|
|||||||
myFile.write(sdBuffer, eepsize);
|
myFile.write(sdBuffer, eepsize);
|
||||||
// display_Clear(); // TEST PURPOSES - DISPLAY EEPROM DATA
|
// display_Clear(); // TEST PURPOSES - DISPLAY EEPROM DATA
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case 19:
|
case 19:
|
||||||
if (ramsize == 2) { // PRG RAM 128B
|
if (ramsize == 2) { // PRG RAM 128B
|
||||||
for (size_t x = 0; x < 128; x++) {
|
for (size_t x = 0; x < 128; x++) {
|
||||||
@ -3762,6 +3761,7 @@ void writeRAM() {
|
|||||||
} else {
|
} else {
|
||||||
fileBrowser(F("Select RAM File"));
|
fileBrowser(F("Select RAM File"));
|
||||||
word base = 0x6000;
|
word base = 0x6000;
|
||||||
|
uint16_t banks;
|
||||||
|
|
||||||
sd.chdir();
|
sd.chdir();
|
||||||
sprintf(filePath, "%s/%s", filePath, fileName);
|
sprintf(filePath, "%s/%s", filePath, fileName);
|
||||||
@ -3839,7 +3839,8 @@ void writeRAM() {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 16: // 256-byte EEPROM 24C02
|
case 16: // 256-byte EEPROM 24C02
|
||||||
case 159: // 128-byte EEPROM 24C01 [Little Endian]
|
case 159: {// 128-byte EEPROM 24C01 [Little Endian]
|
||||||
|
size_t eepsize;
|
||||||
if (mapper == 159)
|
if (mapper == 159)
|
||||||
eepsize = 128;
|
eepsize = 128;
|
||||||
else
|
else
|
||||||
@ -3853,7 +3854,7 @@ void writeRAM() {
|
|||||||
display_Update();
|
display_Update();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case 19:
|
case 19:
|
||||||
if (ramsize == 2) { // PRG RAM 128B
|
if (ramsize == 2) { // PRG RAM 128B
|
||||||
myFile.read(sdBuffer, 128);
|
myFile.read(sdBuffer, 128);
|
||||||
@ -3890,7 +3891,7 @@ void writeRAM() {
|
|||||||
write_prg_byte(0x7EF9, 0x84); // PRG RAM ENABLE 2 ($7000-$73FF)
|
write_prg_byte(0x7EF9, 0x84); // PRG RAM ENABLE 2 ($7000-$73FF)
|
||||||
for (size_t address = 0x0; address < 0x1400; address += 1024) { // PRG RAM 5K ($6000-$73FF)
|
for (size_t address = 0x0; address < 0x1400; address += 1024) { // PRG RAM 5K ($6000-$73FF)
|
||||||
myFile.read(sdBuffer, 512);
|
myFile.read(sdBuffer, 512);
|
||||||
firstbyte = sdBuffer[0];
|
uint8_t firstbyte = sdBuffer[0];
|
||||||
for (size_t x = 0; x < 512; x++)
|
for (size_t x = 0; x < 512; x++)
|
||||||
write_prg_byte(base + address + x, sdBuffer[x]);
|
write_prg_byte(base + address + x, sdBuffer[x]);
|
||||||
myFile.read(sdBuffer, 512);
|
myFile.read(sdBuffer, 512);
|
||||||
@ -4243,6 +4244,9 @@ void writeFLASH() {
|
|||||||
println_Msg(fileName);
|
println_Msg(fileName);
|
||||||
display_Update();
|
display_Update();
|
||||||
|
|
||||||
|
uint8_t bytecheck;
|
||||||
|
uint16_t banks;
|
||||||
|
|
||||||
//open file on sd card
|
//open file on sd card
|
||||||
if (myFile.open(filePath, O_READ)) {
|
if (myFile.open(filePath, O_READ)) {
|
||||||
banks = int_pow(2, prgsize); // 256K/512K
|
banks = int_pow(2, prgsize); // 256K/512K
|
||||||
|
Loading…
Reference in New Issue
Block a user