Fix Led and missing word wrap

This commit is contained in:
sanni 2021-10-26 17:13:42 +02:00
parent d64ce10391
commit 5a3b311feb
12 changed files with 124 additions and 98 deletions

View File

@ -717,15 +717,33 @@ void print_Msg(const __FlashStringHelper *string) {
#endif
}
void print_Msg(const char string[]) {
void print_Msg(const char myString[]) {
#ifdef enable_LCD
display.print(string);
// test for word wrap
if ((display.tx + strlen(myString) * 6) > 128) {
int strPos = 0;
// Print until end of display
while (display.tx < 122) {
display.print(myString[strPos]);
strPos++;
}
// Newline
display.setCursor(0, display.ty + 8);
// Print remaining characters
while (strPos < strlen(myString)) {
display.print(myString[strPos]);
strPos++;
}
}
else {
display.print(myString);
}
#endif
#ifdef enable_OLED
display.print(string);
display.print(myString);
#endif
#ifdef enable_serial
Serial.print(string);
Serial.print(myString);
#endif
}
@ -784,7 +802,7 @@ void print_Msg_PaddedHex32(unsigned long message) {
void println_Msg(String string) {
#ifdef enable_LCD
display.println(string);
print_Msg(string);
display.setCursor(0, display.ty + 8);
#endif
#ifdef enable_OLED
@ -797,7 +815,7 @@ void println_Msg(String string) {
void println_Msg(byte message, int outputFormat) {
#ifdef enable_LCD
display.println(message, outputFormat);
print_Msg(message, outputFormat);
display.setCursor(0, display.ty + 8);
#endif
#ifdef enable_OLED
@ -810,7 +828,7 @@ void println_Msg(byte message, int outputFormat) {
void println_Msg(const char message[]) {
#ifdef enable_LCD
display.println(message);
print_Msg(message);
display.setCursor(0, display.ty + 8);
#endif
#ifdef enable_OLED
@ -823,7 +841,7 @@ void println_Msg(const char message[]) {
void println_Msg(const __FlashStringHelper *string) {
#ifdef enable_LCD
display.println(string);
print_Msg(string);
display.setCursor(0, display.ty + 8);
#endif
#ifdef enable_OLED
@ -836,7 +854,7 @@ void println_Msg(const __FlashStringHelper *string) {
void println_Msg(long unsigned int message) {
#ifdef enable_LCD
display.print(message);
print_Msg(message);
display.setCursor(0, display.ty + 8);
#endif
#ifdef enable_OLED
@ -910,7 +928,7 @@ void wait_serial() {
for (unsigned long currByte = 0; currByte < fileSize; currByte++) {
// Blink led
if (currByte % 1024 == 0)
PORTB ^= (1 << 4);
blinkLED();
Serial.write(myFile.read());
}
// Close the file:
@ -959,7 +977,7 @@ byte questionBox_Serial(const __FlashStringHelper* question, char answers[7][20]
myFile.write(Serial.read());
fileSize++;
// Blink led
PORTB ^= (1 << 4);
blinkLED();
}
// Close the file:
@ -1034,6 +1052,14 @@ void rgbLed(byte Color) {
}
}
void blinkLED() {
#if defined(enable_OLED) || defined(enable_serial)
PORTB ^= (1 << 4);
#elif defined(enable_LCD)
PORTB ^= (1 << 7);
#endif
}
/******************************************
LCD Menu Module
*****************************************/

View File

@ -985,7 +985,7 @@ void eraseFlash29F032() {
// After a completed erase D7 will output 1
while ((statusReg & 0x80) != 0x80) {
// Blink led
PORTB ^= (1 << 4);
blinkLED();
delay(100);
// Update Status
statusReg = readByte_Flash(0);
@ -1026,7 +1026,7 @@ void writeFlash29F032() {
}
// Blink led
if (currByte % 2048 == 0)
PORTB ^= (1 << 4);
blinkLED();
noInterrupts();
int blockfailcnt = 0;
@ -1157,7 +1157,7 @@ void writeFlash29F1610() {
// Blink led
if (currByte % 3072 == 0)
PORTB ^= (1 << 4);
blinkLED();
// Check if write is complete
delayMicroseconds(100);
@ -1212,7 +1212,7 @@ void writeFlash29F1601() {
// Blink led
if (currByte % 3072 == 0)
PORTB ^= (1 << 4);
blinkLED();
// Check if write is complete
delayMicroseconds(100);
@ -1355,7 +1355,7 @@ void writeFlash29LV640() {
myFile.read(sdBuffer, 512);
// Blink led
if (currByte % 4096 == 0)
PORTB ^= (1 << 4);
blinkLED();
for (int c = 0; c < 512; c++) {
// Write command sequence
writeByte_Flash(0x555 << 1, 0xaa);
@ -1400,7 +1400,7 @@ void writeFlash29GL(unsigned long sectorSize, byte bufferSize) {
for (unsigned long currSector = 0; currSector < fileSize; currSector += sectorSize) {
// Blink led
PORTB ^= (1 << 4);
blinkLED();
// Write to flashrom
for (unsigned long currSdBuffer = 0; currSdBuffer < sectorSize; currSdBuffer += 512) {
@ -1471,7 +1471,7 @@ void writeFlash29F800() {
myFile.read(sdBuffer, 512);
// Blink led
if (currByte % 2048 == 0)
PORTB ^= (1 << 4);
blinkLED();
for (int c = 0; c < 512; c++) {
// Write command sequence
@ -1537,7 +1537,7 @@ void eraseFlash28FXXX() {
while ((readByte_Flash(ba) & 0x80) == 0x00);
// blink LED
PORTB ^= (1 << 4);
blinkLED();
}
}
@ -1581,7 +1581,7 @@ void writeFlashE28FXXXJ3A() {
// Blink led
if (currByte % 2048 == 0)
PORTB ^= (1 << 4);
blinkLED();
block_addr = currByte & block_addr_mask;
@ -1626,7 +1626,7 @@ void writeFlashLH28F0XX() {
myFile.read(sdBuffer, 512);
// Blink led
if (currByte % 2048 == 0)
PORTB ^= (1 << 4);
blinkLED();
for (uint32_t c = 0; c < 512; c += bufferSize) {
// sequence load to page
@ -1820,7 +1820,7 @@ void writeFlash16() {
// Blink led
if (currByte % 2048 == 0)
PORTB ^= (1 << 4);
blinkLED();
// Check if write is complete
delayMicroseconds(100);
@ -1879,7 +1879,7 @@ void writeFlash16_29F1601() {
// Blink led
if (currByte % 2048 == 0)
PORTB ^= (1 << 4);
blinkLED();
// Check if write is complete
delayMicroseconds(100);
@ -2180,7 +2180,7 @@ void writeFlash16_29LV640() {
// Blink led
if (currWord % 4096 == 0)
PORTB ^= (1 << 4);
blinkLED();
for (int c = 0; c < 256; c++) {
// Write command sequence
@ -2396,7 +2396,7 @@ void write_Eprom() {
// Blink led
if (currWord % 2048 == 0)
PORTB ^= (1 << 4);
blinkLED();
// Work through SD buffer
for (int c = 0; c < 256; c++) {

View File

@ -1022,7 +1022,7 @@ void writeFlash29F_GB(byte MBC) {
// After a completed erase D7 will output 1
while ((statusReg & 0x80) != 0x80) {
// Blink led
PORTB ^= (1 << 4);
blinkLED();
delay(100);
// Update Status
statusReg = readByte_GB(0);
@ -1035,7 +1035,7 @@ void writeFlash29F_GB(byte MBC) {
// Read x number of banks
for (int currBank = 0; currBank < romBanks; currBank++) {
// Blink led
PORTB ^= (1 << 4);
blinkLED();
dataOut();
@ -1069,7 +1069,7 @@ void writeFlash29F_GB(byte MBC) {
for (int currBank = 0; currBank < romBanks; currBank++) {
// Blink led
PORTB ^= (1 << 4);
blinkLED();
// Set ROM bank
writeByte_GB(0x2100, currBank);
@ -1120,7 +1120,7 @@ void writeFlash29F_GB(byte MBC) {
for (int currBank = 0; currBank < romBanks; currBank++) {
// Blink led
PORTB ^= (1 << 4);
blinkLED();
// Set ROM bank
writeByte_GB(0x2000, currBank);
@ -1193,7 +1193,7 @@ void writeFlash29F_GB(byte MBC) {
romAddress = 0x4000;
}
// Blink led
PORTB ^= (1 << 4);
blinkLED();
// Read up to 7FFF per bank
while (romAddress <= 0x7FFF) {
@ -1423,7 +1423,7 @@ bool writeCFI_GB() {
// After a completed erase D7 will output 1
while ((statusReg & 0x80) != 0x80) {
// Blink led
PORTB ^= (1 << 4);
blinkLED();
delay(100);
// Update Status
statusReg = readByte_GB(0);
@ -1436,7 +1436,7 @@ bool writeCFI_GB() {
// Read x number of banks
for (int currBank = 0; currBank < romBanks; currBank++) {
// Blink led
PORTB ^= (1 << 4);
blinkLED();
dataOut();
@ -1469,7 +1469,7 @@ bool writeCFI_GB() {
for (int currBank = 0; currBank < romBanks; currBank++) {
// Blink led
PORTB ^= (1 << 4);
blinkLED();
// Set ROM bank
writeByte_GB(0x2100, currBank);
@ -1562,7 +1562,7 @@ bool writeCFI_GB() {
romAddress = 0x4000;
}
// Blink led
PORTB ^= (1 << 4);
blinkLED();
// Read up to 7FFF per bank
while (romAddress <= 0x7FFF) {

View File

@ -896,7 +896,7 @@ void readROM_GBA() {
for (int myAddress = 0; myAddress < cartSize; myAddress += 512) {
// Blink led
if (myAddress % 16384 == 0)
PORTB ^= (1 << 4);
blinkLED();
for (int currWord = 0; currWord < 512; currWord += 2) {
word tempWord = readWord_GBA(myAddress + currWord);
@ -2074,7 +2074,7 @@ void idFlashrom_GBA() {
boolean blankcheckFlashrom_GBA() {
for (unsigned long currSector = 0; currSector < fileSize; currSector += 0x20000) {
// Blink led
PORTB ^= (1 << 4);
blinkLED();
for (unsigned long currByte = 0; currByte < 0x20000; currByte += 2) {
if (readWord_GBA(currSector + currByte) != 0xFFFF) {
@ -2124,7 +2124,7 @@ void eraseIntel4000_GBA() {
statusReg = readWord_GBA(currBlock);
}
// Blink led
PORTB ^= (1 << 4);
blinkLED();
}
// Erase the second chip
@ -2145,7 +2145,7 @@ void eraseIntel4000_GBA() {
statusReg = readWord_GBA(currBlock);
}
// Blink led
PORTB ^= (1 << 4);
blinkLED();
}
// 4 blocks with 16kword each
@ -2164,7 +2164,7 @@ void eraseIntel4000_GBA() {
statusReg = readWord_GBA(currBlock);
}
// Blink led
PORTB ^= (1 << 4);
blinkLED();
}
}
}
@ -2208,7 +2208,7 @@ void eraseIntel4400_GBA() {
statusReg = readWord_GBA(currBlock);
}
// Blink led
PORTB ^= (1 << 4);
blinkLED();
}
/* No need to erase the second chip as max rom size is 32MB
@ -2229,7 +2229,7 @@ void eraseIntel4400_GBA() {
statusReg = readWord_GBA(currBlock);
}
// Blink led
PORTB ^= (1 << 4);
blinkLED();
}
// 4 blocks with 16kword each
@ -2248,7 +2248,7 @@ void eraseIntel4400_GBA() {
statusReg = readWord_GBA(currBlock);
}
// Blink led
PORTB ^= (1 << 4);
blinkLED();
}
}*/
}
@ -2272,7 +2272,7 @@ void sectorEraseMSP55LV128_GBA() {
statusReg = readWord_GAB(currSector);
}
// Blink LED
PORTB ^= (1 << 4);
blinkLED();
}
}
@ -2295,14 +2295,14 @@ void sectorEraseMX29GL128E_GBA() {
statusReg = readWord_GAB(currSector);
}
// Blink LED
PORTB ^= (1 << 4);
blinkLED();
}
}
void writeIntel4000_GBA() {
for (unsigned long currBlock = 0; currBlock < fileSize; currBlock += 0x20000) {
// Blink led
PORTB ^= (1 << 4);
blinkLED();
// Write to flashrom
for (unsigned long currSdBuffer = 0; currSdBuffer < 0x20000; currSdBuffer += 512) {
@ -2350,7 +2350,7 @@ void writeIntel4000_GBA() {
void writeMSP55LV128_GBA() {
for (unsigned long currSector = 0; currSector < fileSize; currSector += 0x10000) {
// Blink led
PORTB ^= (1 << 4);
blinkLED();
// Write to flashrom
for (unsigned long currSdBuffer = 0; currSdBuffer < 0x10000; currSdBuffer += 512) {
@ -2392,7 +2392,7 @@ void writeMSP55LV128_GBA() {
void writeMX29GL128E_GBA() {
for (unsigned long currSector = 0; currSector < fileSize; currSector += 0x20000) {
// Blink led
PORTB ^= (1 << 4);
blinkLED();
// Write to flashrom
for (unsigned long currSdBuffer = 0; currSdBuffer < 0x20000; currSdBuffer += 512) {
@ -2438,7 +2438,7 @@ boolean verifyFlashrom_GBA() {
for (unsigned long currSector = 0; currSector < fileSize; currSector += 131072) {
// Blink led
PORTB ^= (1 << 4);
blinkLED();
for (unsigned long currSdBuffer = 0; currSdBuffer < 131072; currSdBuffer += 512) {
// Fill SD buffer
myFile.read(sdBuffer, 512);

View File

@ -601,7 +601,7 @@ void writeFlash_GBM() {
// Write 63 banks
for (byte currBank = 0x1; currBank < (fileSize / 0x4000); currBank++) {
// Blink led
PORTB ^= (1 << 4);
blinkLED();
// all following banks: 0x4000-0x7FFF
if (currBank > 1) {
@ -863,7 +863,7 @@ void writeMapping_GBM() {
// Fill flash buffer
for (word currByte = 0; currByte < 128; currByte++) {
// Blink led
PORTB ^= (1 << 4);
blinkLED();
writeByte_GBM(currByte, sdBuffer[currByte]);
}

View File

@ -563,7 +563,7 @@ void gbSmartWriteFlashFromMyFile(uint32_t addr)
}
// blink LED
PORTB ^= (1 << 4);
blinkLED();
}
uint32_t gbSmartVerifyFlash()
@ -671,7 +671,7 @@ void gbSmartEraseFlash(uint8_t flash_start_bank)
while ((readByte_GBS(0x0000) & 0x80) == 0x00);
// blink LED
PORTB ^= (1 << 4);
blinkLED();
// rest of flash block
for (uint32_t ba = gbSmartBanksPerFlashBlock; ba < gbSmartBanksPerFlashChip; ba += gbSmartBanksPerFlashBlock)
@ -686,7 +686,7 @@ void gbSmartEraseFlash(uint8_t flash_start_bank)
while ((readByte_GBS(0x4000) & 0x80) == 0x00);
// blink LED
PORTB ^= (1 << 4);
blinkLED();
}
}

View File

@ -1135,7 +1135,7 @@ void readROM_MD() {
for (unsigned long currBuffer = 0; currBuffer < cartSize / 2; currBuffer += 512) {
// Blink led
if (currBuffer % 16384 == 0)
PORTB ^= (1 << 4);
blinkLED();
if (currBuffer == 0x200000) {
writeSSF2Map(0x50987E, 8); // 0xA130FD
@ -1188,7 +1188,7 @@ void readROM_MD() {
for (unsigned long currBuffer = 0; currBuffer < cartSizeLockon / 2; currBuffer += 512) {
// Blink led
if (currBuffer % 16384 == 0)
PORTB ^= (1 << 4);
blinkLED();
d = 0;
@ -1233,7 +1233,7 @@ void readROM_MD() {
for (unsigned long currBuffer = 0; currBuffer < cartSizeSonic2 / 2; currBuffer += 512) {
// Blink led
if (currBuffer % 16384 == 0)
PORTB ^= (1 << 4);
blinkLED();
d = 0;
@ -1572,7 +1572,7 @@ void write29F1610_MD() {
// Blink led
if (currByte % 4096 == 0) {
PORTB ^= (1 << 4);
blinkLED();
}
// Write command sequence
@ -1664,7 +1664,7 @@ void blankcheck_MD() {
blank = 0;
}
if (currByte % 4096 == 0) {
PORTB ^= (1 << 4);
blinkLED();
}
}
if (!blank) {
@ -1685,7 +1685,7 @@ void verifyFlash_MD() {
word d = 0;
for (unsigned long currByte = 0; currByte < fileSize / 2; currByte += 256) {
if (currByte % 4096 == 0) {
PORTB ^= (1 << 4);
blinkLED();
}
//fill sdBuffer
myFile.read(sdBuffer, 512);
@ -2460,7 +2460,7 @@ void readRealtec_MD() {
for (unsigned long currBuffer = 0; currBuffer < cartSize / 2; currBuffer += 256) {
// Blink led
if (currBuffer % 16384 == 0)
PORTB ^= (1 << 4);
blinkLED();
for (int currWord = 0; currWord < 256; currWord++) {
word myWord = readWord_MD(currBuffer + currWord);

View File

@ -2508,7 +2508,7 @@ void writeEeprom_CLK() {
for (byte pageNumber = 0; pageNumber < 64; pageNumber++) {
// Blink led
PORTB ^= (1 << 4);
blinkLED();
// Wait ~50ms between page writes or eeprom will have write errors
pulseClock_N64(26000);
@ -2573,7 +2573,7 @@ void readEeprom_CLK() {
for (byte pageNumber = 0; pageNumber < 64; pageNumber++) {
// Blink led
PORTB ^= (1 << 4);
blinkLED();
// Send read command
sendData_CLK(0x04);
@ -2634,7 +2634,7 @@ unsigned long verifyEeprom_CLK() {
for (byte pageNumber = 0; pageNumber < 64; pageNumber++) {
// Blink led
PORTB ^= (1 << 4);
blinkLED();
// Send read command
sendData_CLK(0x04);
@ -2755,7 +2755,7 @@ void writeEeprom() {
for (byte pageNumber = 0; pageNumber < 64; pageNumber++) {
// Blink led
PORTB ^= (1 << 4);
blinkLED();
// Wait ~50ms between page writes or eeprom will have write errors, Arduino running at 16Mhz -> one nop = 62.5ns
for (long i = 0; i < 115000; i++) {
@ -2818,7 +2818,7 @@ void readEeprom() {
for (byte pageNumber = 0; pageNumber < 64; pageNumber++) {
// Blink led
PORTB ^= (1 << 4);
blinkLED();
// Send read command
sendData(0x04);
@ -2878,7 +2878,7 @@ unsigned long verifyEeprom() {
for (byte pageNumber = 0; pageNumber < 64; pageNumber++) {
// Blink led
PORTB ^= (1 << 4);
blinkLED();
// Send read command
sendData(0x04);
@ -3430,7 +3430,7 @@ redumpsamefolder:
for (unsigned long currByte = romBase; currByte < (romBase + (cartSize * 1024 * 1024)); currByte += 512) {
// Blink led
if (currByte % 16384 == 0)
PORTB ^= (1 << 4);
blinkLED();
// Set the address for the next 512 bytes
setAddress_N64(currByte);
@ -3483,7 +3483,7 @@ redumpsamefolder:
for (unsigned long currByte = romBase; currByte < (romBase + (cartSize * 1024 * 1024)); currByte += 1024) {
// Blink led
if (currByte % 16384 == 0)
PORTB ^= (1 << 4);
blinkLED();
// Set the address for the first 512 bytes to dump
setAddress_N64(currByte);
@ -4266,7 +4266,7 @@ void eraseIntel4400_N64() {
}
// Blink led
PORTB ^= (1 << 4);
blinkLED();
}
// Check if we should erase the second chip too
@ -4296,7 +4296,7 @@ void eraseIntel4400_N64() {
}
// Blink led
PORTB ^= (1 << 4);
blinkLED();
}
// 4 blocks with 16kword each
@ -4333,7 +4333,7 @@ void eraseMSP55LV100_N64() {
for (unsigned long currSector = 0; currSector < fileSize; currSector += sectorSize) {
// Blink led
PORTB ^= (1 << 4);
blinkLED();
// Send Erase Command to first chip
setAddress_N64(flashBase + (0x555 << 1));
@ -4393,7 +4393,7 @@ void eraseFlashrom_N64() {
setAddress_N64(romBase);
statusReg = readWord_N64();
// Blink led
PORTB ^= (1 << 4);
blinkLED();
delay(500);
}
}
@ -4407,7 +4407,7 @@ void eraseSector_N64(unsigned long sectorSize) {
for (unsigned long currSector = 0; currSector < fileSize; currSector += sectorSize) {
// Blink led
PORTB ^= (1 << 4);
blinkLED();
// Spansion S29GL256N(32MB/64MB) with two flashrom chips
if ((currSector == 0x2000000) && (strcmp(cartID, "2201") == 0) && (strcmp(flashid, "227E") == 0)) {
@ -4447,7 +4447,7 @@ boolean blankcheckFlashrom_N64() {
for (unsigned long currByte = romBase; currByte < romBase + fileSize; currByte += 512) {
// Blink led
if (currByte % 131072 == 0)
PORTB ^= (1 << 4);
blinkLED();
// Set the address
setAddress_N64(currByte);
@ -4465,7 +4465,7 @@ boolean blankcheckFlashrom_N64() {
void writeIntel4400_N64() {
for (unsigned long currSector = 0; currSector < fileSize; currSector += 131072) {
// Blink led
PORTB ^= (1 << 4);
blinkLED();
// Write to flashrom
for (unsigned long currSdBuffer = 0; currSdBuffer < 131072; currSdBuffer += 512) {
@ -4519,7 +4519,7 @@ void writeMSP55LV100_N64(unsigned long sectorSize) {
for (unsigned long currSector = 0; currSector < fileSize; currSector += sectorSize) {
// Blink led
PORTB ^= (1 << 4);
blinkLED();
// Write to flashrom
for (unsigned long currSdBuffer = 0; currSdBuffer < sectorSize; currSdBuffer += 512) {
@ -4576,7 +4576,7 @@ void writeFlashBuffer_N64(unsigned long sectorSize, byte bufferSize) {
for (unsigned long currSector = 0; currSector < fileSize; currSector += sectorSize) {
// Blink led
PORTB ^= (1 << 4);
blinkLED();
// Spansion S29GL256N(32MB/64MB) with two flashrom chips
if ((currSector == 0x2000000) && (strcmp(cartID, "2201") == 0)) {
@ -4638,7 +4638,7 @@ void writeFlashrom_N64(unsigned long sectorSize) {
for (unsigned long currSector = 0; currSector < fileSize; currSector += sectorSize) {
// Blink led
PORTB ^= (1 << 4);
blinkLED();
// Macronix MX29LV640(8MB/16MB) with two flashrom chips
if (currSector == 0x800000) {
@ -4683,7 +4683,7 @@ unsigned long verifyFlashrom_N64() {
for (unsigned long currSector = 0; currSector < fileSize; currSector += 131072) {
// Blink led
PORTB ^= (1 << 4);
blinkLED();
for (unsigned long currSdBuffer = 0; currSdBuffer < 131072; currSdBuffer += 512) {
// Fill SD buffer
myFile.read(sdBuffer, 512);
@ -4864,7 +4864,7 @@ void backupGameshark_N64() {
for (unsigned long currByte = romBase + 0xC00000; currByte < (romBase + 0xC00000 + 262144); currByte += 512) {
// Blink led
if (currByte % 16384 == 0)
PORTB ^= (1 << 4);
blinkLED();
// Set the address for the next 512 bytes
setAddress_N64(currByte);
@ -4914,7 +4914,7 @@ void writeGameshark_N64() {
// Fill SD buffer with twice the amount since we flash 2 chips
myFile.read(sdBuffer, 256);
// Blink led
PORTB ^= (1 << 4);
blinkLED();
//Send page write command to both flashroms
setAddress_N64(romBase + 0xAAAA);
@ -4944,7 +4944,7 @@ unsigned long verifyGameshark_N64() {
for (unsigned long currSector = 0; currSector < fileSize; currSector += 131072) {
// Blink led
PORTB ^= (1 << 4);
blinkLED();
for (unsigned long currSdBuffer = 0; currSdBuffer < 131072; currSdBuffer += 512) {
// Fill SD buffer
myFile.read(sdBuffer, 512);

View File

@ -231,7 +231,7 @@ void readROM_NGP(char *outPathBuf, size_t bufferSize) {
for (uint32_t addr = 0; addr < cartSize; addr += 512) {
// blink LED
if ((addr & ((1 << 14) - 1)) == 0)
PORTB ^= (1 << 4);
blinkLED();
// read block
for (uint32_t i = 0; i < 512; i++)

View File

@ -417,7 +417,7 @@ void readROM_SMS() {
writeByte_SMS(0xFFFF, currBank);
// Blink led
PORTB ^= (1 << 4);
blinkLED();
// Read 16KB from slot 2 which starts at 0x8000
for (word currBuffer = 0; currBuffer < bankSize; currBuffer += 512) {
// Fill SD buffer
@ -479,7 +479,7 @@ void readSRAM_SMS() {
writeByte_SMS(0xFFFC, 0x08 | (currBank << 2));
// Blink led
PORTB ^= (1 << 4);
blinkLED();
// Read 16KB from slot 2 which starts at 0x8000
for (word currBuffer = 0; currBuffer < bankSize; currBuffer += 512) {
// Fill SD buffer
@ -526,7 +526,7 @@ void writeSRAM_SMS() {
word page_address = address - (currBank * bankSize);
writeByte_SMS(0xFFFC, 0x08 | (currBank << 2));
// Blink led
PORTB ^= (1 << 4);
blinkLED();
myFile.read(sdBuffer, 512);
for (int x = 0; x < 512; x++) {
writeByte_SMS(0x8000 + page_address + x, sdBuffer[x]);
@ -535,7 +535,7 @@ void writeSRAM_SMS() {
myFile.close();
// Blink led
PORTB ^= (1 << 4);
blinkLED();
println_Msg(F(""));
println_Msg(F("DONE"));

View File

@ -556,7 +556,7 @@ void readLoRomBanks( unsigned int start, unsigned int total, FsFile *file)
PORTL = currBank;
// Blink led
PORTB ^= (1 << 4);
blinkLED();
currByte = 32768;
while (1) {
@ -603,7 +603,7 @@ void readHiRomBanks( unsigned int start, unsigned int total, FsFile *file)
PORTL = currBank;
// Blink led
PORTB ^= (1 << 4);
blinkLED();
currByte = 0;
while (1) {

View File

@ -496,7 +496,7 @@ void readROM_WS(char *outPathBuf, size_t bufferSize)
{
// blink LED
if ((addr & ((1 << 14) - 1)) == 0)
PORTB ^= (1 << 4);
blinkLED();
for (uint32_t w = 0; w < 512; w += 2)
* ((uint16_t*)(sdBuffer + w)) = readWord_WS(0x20000 + addr + w);
@ -556,7 +556,7 @@ void readSRAM_WS()
{
// blink LED
if ((addr & ((1 << 14) - 1)) == 0)
PORTB ^= (1 << 4);
blinkLED();
// SRAM data on D0-D7, with A-1 to select high/low byte
for (uint32_t w = 0; w < 512; w++)
@ -658,7 +658,7 @@ void writeSRAM_WS()
{
// blink LED
if ((addr & ((1 << 14) - 1)) == 0)
PORTB ^= (1 << 4);
blinkLED();
myFile.read(sdBuffer, 512);
@ -711,7 +711,7 @@ void readEEPROM_WS()
{
// blink LED
if ((j & 0x1f) == 0x00)
PORTB ^= (1 << 4);
blinkLED();
generateEepromInstruction_WS(wsEepromShiftReg, 0x2, ((i + j) >> 1));
@ -756,7 +756,7 @@ void verifyEEPROM_WS()
{
// blink LED
if ((j & 0x1f) == 0x00)
PORTB ^= (1 << 4);
blinkLED();
generateEepromInstruction_WS(wsEepromShiftReg, 0x2, ((i + j) >> 1));
@ -825,7 +825,7 @@ void writeEEPROM_WS()
{
// blink LED
if ((j & 0x1f) == 0x00)
PORTB ^= (1 << 4);
blinkLED();
generateEepromInstruction_WS(wsEepromShiftReg, 0x1, ((i + j) >> 1));
@ -915,7 +915,7 @@ void writeWitchOS_WS()
{
// blink LED
if ((i & 0x3ff) == 0)
PORTB ^= (1 << 4);
blinkLED();
// reset key
key = 0xff;
@ -973,7 +973,7 @@ void fastProgramWitchFlash_WS(uint32_t addr, uint16_t data)
void eraseWitchFlashSector_WS(uint32_t sector_addr)
{
// blink LED
PORTB ^= (1 << 4);
blinkLED();
dataOut_WS();
writeWord_WS(0x80aaa, 0xaaaa);
@ -1301,4 +1301,4 @@ void dataOut_WS()
DDRA = 0xff;
}
#endif
#endif