mirror of
https://github.com/sanni/cartreader.git
synced 2024-11-14 17:05:08 +01:00
Fix flashing N64 repro and add progress bar
This commit is contained in:
parent
34e2ef2bae
commit
edc2b2fa15
@ -545,7 +545,9 @@ void setAddress_N64(unsigned long myAddress) {
|
||||
|
||||
// Switch WR(PH5) RD(PH6) ale_L(PC0) ale_H(PC1) to high (since the pins are active low)
|
||||
PORTH |= (1 << 5) | (1 << 6);
|
||||
PORTC |= (1 << 0) | (1 << 1);
|
||||
PORTC |= (1 << 1);
|
||||
__asm__("nop\n\t"); // needed for repro
|
||||
PORTC |= (1 << 0);
|
||||
|
||||
// Output high part to address pins
|
||||
PORTF = myAdrHighOut & 0xFF;
|
||||
@ -3302,13 +3304,11 @@ void flashRepro_N64() {
|
||||
myFile.close();
|
||||
|
||||
// Verify
|
||||
print_STR(verifying_STR, 0);
|
||||
print_STR(verifying_STR, 1);
|
||||
display_Update();
|
||||
writeErrors = verifyFlashrom_N64();
|
||||
if (writeErrors == 0) {
|
||||
println_Msg(FS(FSTRING_OK));
|
||||
display_Update();
|
||||
} else {
|
||||
if (writeErrors != 0) {
|
||||
display_Clear();
|
||||
print_Msg(writeErrors);
|
||||
print_Msg(F(" bytes "));
|
||||
print_Error(did_not_verify_STR);
|
||||
@ -3753,6 +3753,11 @@ boolean blankcheckFlashrom_N64() {
|
||||
|
||||
// Write Intel flashrom
|
||||
void writeIntel4400_N64() {
|
||||
//Initialize progress bar
|
||||
uint32_t processedProgressBar = 0;
|
||||
uint32_t totalProgressBar = (uint32_t)(fileSize);
|
||||
draw_progressbar(0, totalProgressBar);
|
||||
|
||||
for (unsigned long currSector = 0; currSector < fileSize; currSector += 131072) {
|
||||
// Blink led
|
||||
blinkLED();
|
||||
@ -3800,6 +3805,8 @@ void writeIntel4400_N64() {
|
||||
statusReg = readWord_N64();
|
||||
}
|
||||
}
|
||||
processedProgressBar += 512;
|
||||
draw_progressbar(processedProgressBar, totalProgressBar);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3807,6 +3814,11 @@ void writeIntel4400_N64() {
|
||||
void writeMSP55LV100_N64(unsigned long sectorSize) {
|
||||
unsigned long flashBase = romBase;
|
||||
|
||||
//Initialize progress bar
|
||||
uint32_t processedProgressBar = 0;
|
||||
uint32_t totalProgressBar = (uint32_t)(fileSize);
|
||||
draw_progressbar(0, totalProgressBar);
|
||||
|
||||
for (unsigned long currSector = 0; currSector < fileSize; currSector += sectorSize) {
|
||||
// Blink led
|
||||
blinkLED();
|
||||
@ -3856,6 +3868,8 @@ void writeMSP55LV100_N64(unsigned long sectorSize) {
|
||||
statusReg = readWord_N64();
|
||||
}
|
||||
}
|
||||
processedProgressBar += 512;
|
||||
draw_progressbar(processedProgressBar, totalProgressBar);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3864,6 +3878,11 @@ void writeMSP55LV100_N64(unsigned long sectorSize) {
|
||||
void writeFlashBuffer_N64(unsigned long sectorSize, byte bufferSize) {
|
||||
unsigned long flashBase = romBase;
|
||||
|
||||
//Initialize progress bar
|
||||
uint32_t processedProgressBar = 0;
|
||||
uint32_t totalProgressBar = (uint32_t)(fileSize);
|
||||
draw_progressbar(0, totalProgressBar);
|
||||
|
||||
for (unsigned long currSector = 0; currSector < fileSize; currSector += sectorSize) {
|
||||
// Blink led
|
||||
blinkLED();
|
||||
@ -3918,6 +3937,8 @@ void writeFlashBuffer_N64(unsigned long sectorSize, byte bufferSize) {
|
||||
statusReg = readWord_N64();
|
||||
}
|
||||
}
|
||||
processedProgressBar += 512;
|
||||
draw_progressbar(processedProgressBar, totalProgressBar);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3926,6 +3947,11 @@ void writeFlashBuffer_N64(unsigned long sectorSize, byte bufferSize) {
|
||||
void writeFlashrom_N64(unsigned long sectorSize) {
|
||||
unsigned long flashBase = romBase;
|
||||
|
||||
//Initialize progress bar
|
||||
uint32_t processedProgressBar = 0;
|
||||
uint32_t totalProgressBar = (uint32_t)(fileSize);
|
||||
draw_progressbar(0, totalProgressBar);
|
||||
|
||||
for (unsigned long currSector = 0; currSector < fileSize; currSector += sectorSize) {
|
||||
// Blink led
|
||||
blinkLED();
|
||||
@ -3956,6 +3982,8 @@ void writeFlashrom_N64(unsigned long sectorSize) {
|
||||
statusReg = readWord_N64();
|
||||
}
|
||||
}
|
||||
processedProgressBar += 512;
|
||||
draw_progressbar(processedProgressBar, totalProgressBar);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3965,6 +3993,11 @@ unsigned long verifyFlashrom_N64() {
|
||||
if (myFile.open(filePath, O_READ)) {
|
||||
writeErrors = 0;
|
||||
|
||||
//Initialize progress bar
|
||||
uint32_t processedProgressBar = 0;
|
||||
uint32_t totalProgressBar = (uint32_t)(fileSize);
|
||||
draw_progressbar(0, totalProgressBar);
|
||||
|
||||
for (unsigned long currSector = 0; currSector < fileSize; currSector += 131072) {
|
||||
// Blink led
|
||||
blinkLED();
|
||||
@ -3988,6 +4021,8 @@ unsigned long verifyFlashrom_N64() {
|
||||
}
|
||||
}
|
||||
}
|
||||
processedProgressBar += 512;
|
||||
draw_progressbar(processedProgressBar, totalProgressBar);
|
||||
}
|
||||
}
|
||||
// Close the file:
|
||||
|
Loading…
Reference in New Issue
Block a user