mirror of
https://github.com/sanni/cartreader.git
synced 2024-11-30 16:34:14 +01:00
V1.0: Change versioning to the more common #.# format
This commit is contained in:
parent
bec6426901
commit
40d2361855
@ -2,8 +2,8 @@
|
||||
Cartridge Reader for Arduino Mega2560
|
||||
|
||||
Author: sanni
|
||||
Date: 04-21-2018
|
||||
Version: V33C
|
||||
Date: 05-05-2018
|
||||
Version: 1.0
|
||||
|
||||
SD lib: https://github.com/greiman/SdFat
|
||||
LCD lib: https://github.com/adafruit/Adafruit_SSD1306
|
||||
@ -35,7 +35,7 @@
|
||||
infinest - help with GB Memory cart
|
||||
|
||||
**********************************************************************************/
|
||||
char ver[5] = "V33C";
|
||||
char ver[5] = "1.0";
|
||||
|
||||
/******************************************
|
||||
Define Starting Point
|
||||
@ -351,7 +351,7 @@ void aboutScreen() {
|
||||
display.drawBitmap(0, 0, sig, 128, 64, 1);
|
||||
println_Msg(F("Cartridge Reader"));
|
||||
println_Msg(F("github.com/sanni"));
|
||||
print_Msg(F("2018 "));
|
||||
print_Msg(F("2018 Version "));
|
||||
println_Msg(ver);
|
||||
println_Msg(F(""));
|
||||
println_Msg(F(""));
|
||||
|
@ -1,5 +1,5 @@
|
||||
//******************************************
|
||||
// FLASHROM
|
||||
// FLASHROM MODULE
|
||||
//******************************************
|
||||
|
||||
/******************************************
|
||||
@ -52,8 +52,8 @@ void flashMenu() {
|
||||
// create menu with title and 3 options to choose from
|
||||
unsigned char flashSlot;
|
||||
// Copy menuOptions out of progmem
|
||||
convertPgm(menuOptionsFlash, 3);
|
||||
flashSlot = question_box("Select flashrom slot", menuOptions, 3, 0);
|
||||
convertPgm(menuOptionsFlash, 2);
|
||||
flashSlot = question_box("Select flashrom slot", menuOptions, 2, 0);
|
||||
|
||||
// wait for user choice to come back from the question box menu
|
||||
switch (flashSlot)
|
||||
|
@ -1,5 +1,5 @@
|
||||
//******************************************
|
||||
// GAME BOY
|
||||
// GAME BOY MODULE
|
||||
//******************************************
|
||||
|
||||
/******************************************
|
||||
|
@ -1,5 +1,5 @@
|
||||
//******************************************
|
||||
// GAME BOY ADVANCE
|
||||
// GAME BOY ADVANCE MODULE
|
||||
//******************************************
|
||||
|
||||
/******************************************
|
||||
|
@ -1,5 +1,5 @@
|
||||
//******************************************
|
||||
// SEGA MEGA DRIVE
|
||||
// SEGA MEGA DRIVE MODULE
|
||||
//******************************************
|
||||
|
||||
/******************************************
|
||||
|
@ -1,5 +1,5 @@
|
||||
//******************************************
|
||||
// NINTENDO 64
|
||||
// NINTENDO 64 MODULE
|
||||
//******************************************
|
||||
|
||||
/******************************************
|
||||
|
@ -1,5 +1,5 @@
|
||||
//******************************************
|
||||
// NINTENDO POWER Cartridges for SFC and GB
|
||||
// NINTENDO POWER MODULE
|
||||
// (GB Memory starts at around line 1460)
|
||||
//******************************************
|
||||
|
||||
|
@ -63,7 +63,7 @@ void draw_progressbar(uint32_t processedsize, uint32_t totalsize)
|
||||
static uint8_t previousstatus;
|
||||
|
||||
//Find progressbar length and draw if processed size is not 0
|
||||
if(processedsize != 0)
|
||||
if (processedsize != 0)
|
||||
{
|
||||
|
||||
// Progress bar
|
||||
@ -250,7 +250,7 @@ uint8_t read_byte_PCE(uint32_t address)
|
||||
ret = PINC;
|
||||
|
||||
//Swap bit order for PC Engine HuCARD
|
||||
if(pce_internal_mode == HUCARD)
|
||||
if (pce_internal_mode == HUCARD)
|
||||
{
|
||||
ret = ((ret & 0x01) << 7) | ((ret & 0x02) << 5) | ((ret & 0x04) << 3) | ((ret & 0x08) << 1) | ((ret & 0x10) >> 1) | ((ret & 0x20) >> 3) | ((ret & 0x40) >> 5) | ((ret & 0x80) >> 7);
|
||||
}
|
||||
@ -275,7 +275,7 @@ uint8_t write_byte_PCE(uint32_t address, uint8_t data)
|
||||
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||
|
||||
//Swap bit order for PC Engine HuCARD
|
||||
if(pce_internal_mode == HUCARD)
|
||||
if (pce_internal_mode == HUCARD)
|
||||
{
|
||||
data = ((data & 0x01) << 7) | ((data & 0x02) << 5) | ((data & 0x04) << 3) | ((data & 0x08) << 1) | ((data & 0x10) >> 1) | ((data & 0x20) >> 3) | ((data & 0x40) >> 5) | ((data & 0x80) >> 7);
|
||||
}
|
||||
@ -327,7 +327,7 @@ uint32_t detect_rom_size_PCE(void)
|
||||
|
||||
//Confirm where mirror address start from(128KB, 256KB, 512KB, 768, or 1024KB)
|
||||
for (current_byte = 0; current_byte < DETECTION_SIZE; current_byte++) {
|
||||
if((current_byte != detect_128) && (current_byte != detect_256) && (current_byte != detect_512) && (current_byte != detect_768))
|
||||
if ((current_byte != detect_128) && (current_byte != detect_256) && (current_byte != detect_512) && (current_byte != detect_768))
|
||||
{
|
||||
//If none matched, it is 1024KB
|
||||
break;
|
||||
@ -337,27 +337,27 @@ uint32_t detect_rom_size_PCE(void)
|
||||
read_byte = read_byte_PCE(current_byte);
|
||||
|
||||
//128KB detection
|
||||
if(current_byte == detect_128)
|
||||
if (current_byte == detect_128)
|
||||
{
|
||||
if(read_byte_PCE(current_byte + 128UL * 1024UL) == read_byte)
|
||||
if (read_byte_PCE(current_byte + 128UL * 1024UL) == read_byte)
|
||||
{
|
||||
detect_128++;
|
||||
}
|
||||
}
|
||||
|
||||
//256KB detection
|
||||
if(current_byte == detect_256)
|
||||
if (current_byte == detect_256)
|
||||
{
|
||||
if(read_byte_PCE(current_byte + 256UL * 1024UL) == read_byte)
|
||||
if (read_byte_PCE(current_byte + 256UL * 1024UL) == read_byte)
|
||||
{
|
||||
detect_256++;
|
||||
}
|
||||
}
|
||||
|
||||
//512KB detection
|
||||
if(current_byte == detect_512)
|
||||
if (current_byte == detect_512)
|
||||
{
|
||||
if(read_byte_PCE(current_byte + 512UL * 1024UL) == read_byte)
|
||||
if (read_byte_PCE(current_byte + 512UL * 1024UL) == read_byte)
|
||||
{
|
||||
detect_512++;
|
||||
}
|
||||
@ -365,9 +365,9 @@ uint32_t detect_rom_size_PCE(void)
|
||||
|
||||
//768KB detection
|
||||
read_byte = read_byte_PCE(current_byte + 512UL * 1024UL);
|
||||
if(current_byte == detect_768)
|
||||
if (current_byte == detect_768)
|
||||
{
|
||||
if(read_byte_PCE(current_byte + 768UL * 1024UL) == read_byte)
|
||||
if (read_byte_PCE(current_byte + 768UL * 1024UL) == read_byte)
|
||||
{
|
||||
detect_768++;
|
||||
}
|
||||
@ -379,13 +379,13 @@ uint32_t detect_rom_size_PCE(void)
|
||||
//println_Msg(fileName);
|
||||
|
||||
//ROM size detection by result
|
||||
if(detect_128 == DETECTION_SIZE)
|
||||
if (detect_128 == DETECTION_SIZE)
|
||||
{
|
||||
rom_size = 128;
|
||||
}
|
||||
else if(detect_256 == DETECTION_SIZE)
|
||||
else if (detect_256 == DETECTION_SIZE)
|
||||
{
|
||||
if(detect_512 == DETECTION_SIZE)
|
||||
if (detect_512 == DETECTION_SIZE)
|
||||
{
|
||||
rom_size = 256;
|
||||
}
|
||||
@ -395,11 +395,11 @@ uint32_t detect_rom_size_PCE(void)
|
||||
rom_size = 384;
|
||||
}
|
||||
}
|
||||
else if(detect_512 == DETECTION_SIZE)
|
||||
else if (detect_512 == DETECTION_SIZE)
|
||||
{
|
||||
rom_size = 512;
|
||||
}
|
||||
else if(detect_768 == DETECTION_SIZE)
|
||||
else if (detect_768 == DETECTION_SIZE)
|
||||
{
|
||||
rom_size = 768;
|
||||
}
|
||||
@ -409,10 +409,10 @@ uint32_t detect_rom_size_PCE(void)
|
||||
}
|
||||
|
||||
//If rom size is more than or equal to 512KB, detect Street fighter II'
|
||||
if(rom_size >= 512)
|
||||
if (rom_size >= 512)
|
||||
{
|
||||
//Look for "NEC HE "
|
||||
if(read_byte_PCE(0x7FFF9) == 'N' && read_byte_PCE(0x7FFFA) == 'E' && read_byte_PCE(0x7FFFB) == 'C'
|
||||
if (read_byte_PCE(0x7FFF9) == 'N' && read_byte_PCE(0x7FFFA) == 'E' && read_byte_PCE(0x7FFFB) == 'C'
|
||||
&& read_byte_PCE(0x7FFFC) == ' ' && read_byte_PCE(0x7FFFD) == 'H' && read_byte_PCE(0x7FFFE) == 'E')
|
||||
{
|
||||
rom_size = 2560;
|
||||
@ -467,7 +467,7 @@ void get_line(char* str_buf, SdFile* readfile, uint8_t maxi)
|
||||
while (readfile->available())
|
||||
{
|
||||
//If line size is more than maximum array, limit it.
|
||||
if(i >= maxi)
|
||||
if (i >= maxi)
|
||||
{
|
||||
i = maxi - 1;
|
||||
}
|
||||
@ -546,7 +546,7 @@ void crc_search(char *file_p, char *folder_p, uint32_t rom_size)
|
||||
skip_line(&script); //Skip every 3rd line
|
||||
|
||||
//if checksum search successful, rename the file and end search
|
||||
if(strcmp(crc_search, crc_file) == 0)
|
||||
if (strcmp(crc_search, crc_file) == 0)
|
||||
{
|
||||
print_Msg("Chksum OK ");
|
||||
println_Msg(crc_file);
|
||||
@ -566,14 +566,14 @@ void crc_search(char *file_p, char *folder_p, uint32_t rom_size)
|
||||
}
|
||||
|
||||
|
||||
if(flag == CHKSUM_SKIP)
|
||||
if (flag == CHKSUM_SKIP)
|
||||
{
|
||||
print_Msg(F("Saved to "));
|
||||
print_Msg(folder_p);
|
||||
print_Msg(F("/"));
|
||||
print_Msg(file_p);
|
||||
}
|
||||
else if(flag == CHKSUM_ERROR)
|
||||
else if (flag == CHKSUM_ERROR)
|
||||
{
|
||||
print_Msg("Chksum Error ");
|
||||
println_Msg(crc_file);
|
||||
@ -629,13 +629,13 @@ void read_rom_PCE(void)
|
||||
//Initialize progress bar by setting processed size as 0
|
||||
draw_progressbar(0, rom_size * 1024UL);
|
||||
|
||||
if(rom_size == 384)
|
||||
if (rom_size == 384)
|
||||
{
|
||||
//Read two sections. 0x000000--0x040000 and 0x080000--0x0A0000 for 384KB
|
||||
read_bank_PCE(0, 0x40000, &processed_size, rom_size * 1024UL);
|
||||
read_bank_PCE(0x80000, 0xA0000, &processed_size, rom_size * 1024UL);
|
||||
}
|
||||
else if(rom_size == 2560)
|
||||
else if (rom_size == 2560)
|
||||
{
|
||||
//Dump Street fighter II' Champion Edition
|
||||
read_bank_PCE(0, 0x80000, &processed_size, rom_size * 1024UL); //Read first bank
|
||||
@ -674,7 +674,7 @@ void pceMenu() {
|
||||
// Copy menuOptions out of progmem
|
||||
convertPgm(menuOptionspceCart, 2);
|
||||
|
||||
if(pce_internal_mode == HUCARD)
|
||||
if (pce_internal_mode == HUCARD)
|
||||
{
|
||||
mainMenu = question_box("PCE HuCARD menu", menuOptions, 2, 0);
|
||||
}
|
||||
@ -707,4 +707,3 @@ void pceMenu() {
|
||||
//******************************************
|
||||
// End of File
|
||||
//******************************************
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
//******************************************
|
||||
// SUPER NINTENDO
|
||||
// SUPER NINTENDO MODULE
|
||||
//******************************************
|
||||
|
||||
/******************************************
|
||||
|
Loading…
Reference in New Issue
Block a user