Update NES.ino

This commit is contained in:
sanni 2022-07-07 00:51:44 +02:00
parent 0195f78a11
commit 7d1f6d2136

View File

@ -230,9 +230,9 @@ void nesMenu() {
case 1: case 1:
#ifndef no-intro #ifndef no-intro
CartStart(); CartStart();
readPRG(); readPRG(false);
delay(2000); delay(2000);
readCHR(); readCHR(false);
delay(2000); delay(2000);
outputNES(); outputNES();
delay(2000); delay(2000);
@ -315,7 +315,7 @@ void nesChipMenu() {
// Read PRG // Read PRG
case 0: case 0:
CreateROMFolderInSD(); CreateROMFolderInSD();
readPRG(); readPRG(false);
resetROM(); resetROM();
println_Msg(F("")); println_Msg(F(""));
println_Msg(F("Press Button...")); println_Msg(F("Press Button..."));
@ -326,7 +326,7 @@ void nesChipMenu() {
// Read CHR // Read CHR
case 1: case 1:
CreateROMFolderInSD(); CreateROMFolderInSD();
readCHR(); readCHR(false);
resetROM(); resetROM();
println_Msg(F("")); println_Msg(F(""));
println_Msg(F("Press Button...")); println_Msg(F("Press Button..."));
@ -609,14 +609,14 @@ void readRom_NES() {
draw_progressbar(processedProgressBar, totalProgressBar); draw_progressbar(processedProgressBar, totalProgressBar);
//Write PRG //Write PRG
readPRG(); readPRG(true);
// update progress bar // update progress bar
processedProgressBar += prgsize * 16 * 1024; processedProgressBar += prgsize * 16 * 1024;
draw_progressbar(processedProgressBar, totalProgressBar); draw_progressbar(processedProgressBar, totalProgressBar);
//Write CHR //Write CHR
readCHR(); readCHR(true);
// update progress bar // update progress bar
processedProgressBar += chrsize * 4 * 1024; processedProgressBar += chrsize * 4 * 1024;
@ -2307,21 +2307,22 @@ void writeMMC5RAM(word base, word address) { // MMC5 SRAM WRITE
write_prg_byte(0x5103, 0); // PRG RAM PROTECT2 write_prg_byte(0x5103, 0); // PRG RAM PROTECT2
} }
void readPRG() { void readPRG(boolean readrom) {
#ifndef no-intro if (!readrom) {
display_Clear(); display_Clear();
display_Update(); display_Update();
LED_BLUE_ON;
set_address(0);
_delay_us(1);
CreatePRGFileInSD();
}
else {
set_address(0);
_delay_us(1);
}
LED_BLUE_ON;
set_address(0);
_delay_us(1);
CreatePRGFileInSD();
word base = 0x8000; word base = 0x8000;
#else
set_address(0);
_delay_us(1);
word base = 0x8000;
#endif
if (myFile) { if (myFile) {
switch (mapper) { switch (mapper) {
@ -2801,15 +2802,17 @@ void readPRG() {
} }
break; break;
} }
#ifndef no-intro if (!readrom) {
myFile.flush(); myFile.flush();
myFile.close(); myFile.close();
println_Msg(F("PRG FILE DUMPED!")); println_Msg(F("PRG FILE DUMPED!"));
println_Msg(F("")); println_Msg(F(""));
display_Update(); display_Update();
calcCRC(fileName, prg * 1024, &prg_crc32, 0); #ifndef no-intro
calcCRC(fileName, prg * 1024, &prg_crc32, 0);
#endif #endif
}
} }
set_address(0); set_address(0);
PHI2_HI; PHI2_HI;
@ -2817,11 +2820,11 @@ void readPRG() {
LED_BLUE_OFF; LED_BLUE_OFF;
} }
void readCHR() { void readCHR(boolean readrom) {
#ifndef no-intro if (!readrom) {
display_Clear(); display_Clear();
display_Update(); display_Update();
#endif }
LED_GREEN_ON; LED_GREEN_ON;
set_address(0); set_address(0);
@ -2831,9 +2834,9 @@ void readCHR() {
display_Update(); display_Update();
} }
else { else {
#ifndef no-intro if (!readrom) {
CreateCHRFileInSD(); CreateCHRFileInSD();
#endif }
if (myFile) { if (myFile) {
switch (mapper) { switch (mapper) {
case 0: // 8K case 0: // 8K
@ -3360,15 +3363,17 @@ void readCHR() {
} }
break; break;
} }
#ifndef no-intro if (!readrom) {
myFile.flush(); myFile.flush();
myFile.close(); myFile.close();
println_Msg(F("CHR FILE DUMPED!")); println_Msg(F("CHR FILE DUMPED!"));
println_Msg(F("")); println_Msg(F(""));
display_Update(); display_Update();
calcCRC(fileName, chr * 1024, &chr_crc32, 0); #ifndef no-intro
calcCRC(fileName, chr * 1024, &chr_crc32, 0);
#endif #endif
}
} }
} }
set_address(0); set_address(0);