diff --git a/Firmware/AppleIISd.vcxproj b/Firmware/AppleIISd.vcxproj
index 3e11239..d0bd28e 100644
--- a/Firmware/AppleIISd.vcxproj
+++ b/Firmware/AppleIISd.vcxproj
@@ -11,6 +11,7 @@
+
diff --git a/Firmware/AppleIISd.vcxproj.filters b/Firmware/AppleIISd.vcxproj.filters
index b7b8674..8986c9d 100644
--- a/Firmware/AppleIISd.vcxproj.filters
+++ b/Firmware/AppleIISd.vcxproj.filters
@@ -23,6 +23,7 @@
+
diff --git a/Software/AppleCommander-1.3.5.jar b/Software/AppleCommander-1.3.5.jar
new file mode 100644
index 0000000..f74e7cb
Binary files /dev/null and b/Software/AppleCommander-1.3.5.jar differ
diff --git a/Software/make_image.bat b/Software/make_image.bat
new file mode 100644
index 0000000..6a4903a
--- /dev/null
+++ b/Software/make_image.bat
@@ -0,0 +1,3 @@
+make
+java -jar AppleCommander-1.3.5.jar -d cc65.dsk %~n1
+java -jar AppleCommander-1.3.5.jar -cc65 cc65.dsk %~n1 bin < %1
diff --git a/Software/src/AppleIISd.h b/Software/src/AppleIISd.h
index 06c6c02..dfa5976 100644
--- a/Software/src/AppleIISd.h
+++ b/Software/src/AppleIISd.h
@@ -1,19 +1,21 @@
#ifndef APPLE_II_SD_H
#define APPLE_II_SD_H
-typedef unsigned char byte;
+typedef unsigned char uint8;
+typedef unsigned short uint16;
+typedef unsigned int uint32;
-#define SLOT_IO_START (byte*)0xC080
-#define SLOT_ROM_START (byte*)0xC000
-#define EXT_ROM_START (byte*)0xC800
+#define SLOT_IO_START (uint8*)0xC080
+#define SLOT_ROM_START (uint8*)0xC000
+#define EXT_ROM_START (uint8*)0xC800
-#define CFFF (byte*)0xCFFF
+#define CFFF (uint8*)0xCFFF
typedef struct
{
// data register
// +0
- byte data;
+ uint8 data;
// status register
// +1
@@ -31,7 +33,7 @@ typedef struct
const unsigned tc : 1;
};
- byte status;
+ uint8 status;
} status;
// clock divisor register
@@ -55,7 +57,7 @@ typedef struct
unsigned inited : 1;
};
- byte ss_card;
+ uint8 ss_card;
} ss_card;
} APPLE_II_SD_T;
diff --git a/Software/src/Flasher.c b/Software/src/Flasher.c
index 68085ac..a0beb87 100644
--- a/Software/src/Flasher.c
+++ b/Software/src/Flasher.c
@@ -16,11 +16,12 @@ typedef enum
} STATE_CURSOR_T;
-void writeChip(const byte* pSource, byte* pDest, unsigned length);
-void printStatus(byte percentage);
+
+void writeChip(const uint8* pSource, uint8* pDest, uint16 length);
+void printStatus(uint8 percentage);
// Binary can't be larger than 2k
-byte buffer[2048] = { 0 };
+uint8 buffer[2048] = { 0 };
int main()
{
@@ -28,8 +29,8 @@ int main()
char slotNum;
APPLE_II_SD_T* pAIISD = (APPLE_II_SD_T*)SLOT_IO_START;
- byte* pSlotRom = SLOT_ROM_START;
- byte* pExtRom = EXT_ROM_START;
+ uint8* pSlotRom = SLOT_ROM_START;
+ uint8* pExtRom = EXT_ROM_START;
videomode(VIDEOMODE_80COL);
clrscr();
@@ -49,7 +50,7 @@ int main()
return 1; // failure
}
- ((byte*)pAIISD) += slotNum << 4;
+ ((uint8*)pAIISD) += slotNum << 4;
pSlotRom += slotNum << 8;
// open file
@@ -57,8 +58,12 @@ int main()
if(pFile)
{
// read buffer
- unsigned fileSize = fread(buffer, sizeof(buffer), 1, pFile);
+ uint16 fileSize = fread(buffer, 1, sizeof(buffer), pFile);
+ fclose(pFile);
+ pFile = NULL;
+ if(fileSize == 2048)
+ {
// enable write
pAIISD->status.pgmen = 1;
@@ -75,14 +80,12 @@ int main()
// zero rest of chip
if(fileSize < 2048)
- {
- cprintf("\r\rErase rest of chip: ");
- writeChip(NULL, pExtRom + fileSize, 2048 - fileSize);
}
-
- // disable write
- pAIISD->status.pgmen = 0;
- cprintf("\r\r Flashing finished!\r");
+ else
+ {
+ cprintf("\r\nWrong file size: %d\r\n", fileSize);
+ return 1;
+ }
}
else
{
@@ -93,9 +96,9 @@ int main()
return 0; // success
}
-void writeChip(const byte* pSource, byte* pDest, unsigned length)
+void writeChip(const uint8* pSource, uint8* pDest, uint16 length)
{
- unsigned i;
+ uint32 i;
for(i=0; i