diff --git a/Software/src/Flasher.c b/Software/src/Flasher.c index 09d352b..64bf773 100644 --- a/Software/src/Flasher.c +++ b/Software/src/Flasher.c @@ -1,8 +1,10 @@ #include "AppleIISd.h" +#include #include #include #include +#include #include // Binary can't be larger than 2k @@ -20,14 +22,12 @@ typedef enum } STATE_CURSOR_T; const char state_char[STATE_LAST] = { '|', '/', '-', '\\' }; -uint8 buffer[BUFFER_SIZE] = { 0 }; - +static uint8 buffer[BUFFER_SIZE]; static void writeChip(const uint8* pSource, volatile uint8* pDest, uint16 length); static boolean verifyChip(const uint8* pSource, volatile uint8* pDest, uint16 length); static void printStatus(uint8 percentage); - int main() { int retval = 1; @@ -41,9 +41,9 @@ int main() videomode(VIDEOMODE_40COL); clrscr(); - cprintf("AppleIISd firmware flasher\r\n"); + cprintf("AppleIISd firmware flasher V1.2\r\n"); cprintf("(c) 2019-2020 Florian Reitz\r\n\r\n"); - + // ask for slot cursor(1); // enable blinking cursor cprintf("Slot number (1-7): "); @@ -76,8 +76,8 @@ int main() if(erase) { - // buffer is already filled with 0 fileSize = BUFFER_SIZE; + memset(buffer, 0, sizeof(buffer)); } else { @@ -113,11 +113,11 @@ int main() // write to SLOTROM cprintf("\r\n\r\nFlashing SLOTROM: "); writeChip(buffer, pSlotRom, 256); - cprintf("\r\n\r\nVerifying SLOTROM: "); + cprintf("\r\nVerifying SLOTROM: "); if(verifyChip(buffer, pSlotRom, 256)) { // write to EXTROM - cprintf("\r\nFlashing EXTROM: "); + cprintf("\r\n\r\nFlashing EXTROM: "); writeChip(buffer + 256, EXT_ROM_START, fileSize - 256); cprintf("\r\nVerifying EXTROM: "); if(verifyChip(buffer + 256, EXT_ROM_START, fileSize - 256)) @@ -138,55 +138,37 @@ int main() static void writeChip(const uint8* pSource, volatile uint8* pDest, uint16 length) { uint32 i; - volatile uint8 data = 0; volatile uint8 readData; for(i=0; i