Skip to content
This repository was archived by the owner on Mar 16, 2026. It is now read-only.

Commit fde402a

Browse files
authored
Update VBOY.ino
Add manual Rom size selection menu for unknown carts. Add 64KB Rom support. Add new serials to supported titles list.
1 parent 7307359 commit fde402a

File tree

1 file changed

+69
-11
lines changed

1 file changed

+69
-11
lines changed

Cart_Reader/VBOY.ino

Lines changed: 69 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
//******************************************
5555
// SETUP
5656
//******************************************
57-
5857
void setup_VBOY() {
5958
// Request 5V
6059
setVoltage(VOLTS_SET_5V);
@@ -87,6 +86,10 @@ void setup_VBOY() {
8786
// Set Unused Pins HIGH
8887
PORTJ |= (1 << 0); // TIME(PJ0)
8988

89+
// Reset Rom/Sram values
90+
cartSize = 0;
91+
sramSize = 0;
92+
9093
getCartInfo_VB();
9194

9295
mode = CORE_VBOY;
@@ -95,13 +98,20 @@ void setup_VBOY() {
9598
//******************************************
9699
// MENU
97100
//******************************************
98-
99101
// Base Menu
100-
static const char* const menuOptionsVBOY[] PROGMEM = { FSTRING_READ_ROM, FSTRING_READ_SAVE, FSTRING_WRITE_SAVE, FSTRING_RESET };
102+
static const char* const menuOptionsVBOY[] PROGMEM = { FSTRING_READ_ROM, FSTRING_READ_SAVE, FSTRING_WRITE_SAVE, FSTRING_SET_SIZE, FSTRING_RESET };
103+
104+
// Manual Rom size selection Menu
105+
static const char VBRomSizeItem1[] PROGMEM = "64 KB";
106+
static const char VBRomSizeItem2[] PROGMEM = "512 KB";
107+
static const char VBRomSizeItem3[] PROGMEM = "1 MB";
108+
static const char VBRomSizeItem4[] PROGMEM = "2 MB";
109+
static const char VBRomSizeItem5[] PROGMEM = "4 MB";
110+
static const char* const VBRomSizeMenu[] PROGMEM = { VBRomSizeItem1, VBRomSizeItem2, VBRomSizeItem3, VBRomSizeItem4, VBRomSizeItem5 };
101111

102112
void vboyMenu() {
103-
convertPgm(menuOptionsVBOY, 4);
104-
uint8_t mainMenu = question_box(F("VIRTUALBOY MENU"), menuOptions, 4, 0);
113+
convertPgm(menuOptionsVBOY, 5);
114+
uint8_t mainMenu = question_box(F("VIRTUALBOY MENU"), menuOptions, 5, 0);
105115

106116
switch (mainMenu) {
107117
case 0:
@@ -163,6 +173,11 @@ void vboyMenu() {
163173
break;
164174

165175
case 3:
176+
// Set Rom size manually
177+
setRomSize();
178+
break;
179+
180+
case 4:
166181
// reset
167182
resetArduino();
168183
break;
@@ -303,13 +318,17 @@ void dataIn_VB() {
303318
void getCartInfo_VB() {
304319
// Set control
305320
dataIn_VB();
306-
307-
cartSize = 0;
308-
for (unsigned long address = 0x80000; address <= 0x400000; address *= 2) {
321+
322+
for (unsigned long address = 0x10000; address <= 0x400000; address *= 2) {
309323
// Get Serial
310324
word vbSerial = readWord_VB((address - 0x204) / 2); // Cart Serial
311325

326+
// Get Rom/Sram sizes for known serials
312327
switch (vbSerial) {
328+
case 0x3431: // 41 = Robonaut
329+
cartSize = 0x10000; // 64KB
330+
break;
331+
313332
case 0x4D54: // MT = Mario's Tennis
314333
case 0x4832: // H2 = Panic Bomber/Tobidase! Panibomb
315334
case 0x5350: // SP = Space Invaders
@@ -350,6 +369,7 @@ void getCartInfo_VB() {
350369
break;
351370

352371
case 0x4644: // FD = Hyper Fighting
372+
case 0x575A: // WZ = Virtual WarZone
353373
cartSize = 0x400000; // 4MB
354374
sramSize = 0x2000; // 8KB
355375
break;
@@ -383,9 +403,19 @@ void getCartInfo_VB() {
383403
println_Msg(FS(FSTRING_SPACE));
384404
print_Msg(FS(FSTRING_NAME));
385405
println_Msg(romName);
406+
386407
print_Msg(FS(FSTRING_SIZE));
387-
print_Msg(cartSize * 8 / 1024 / 1024);
388-
println_Msg(F(" MBit"));
408+
if (cartSize == 0) {
409+
println_Msg(F("Unknown (set manually)"));
410+
}
411+
else if(cartSize < 0x100000) {
412+
print_Msg(cartSize / 1024);
413+
println_Msg(F(" KBit"));
414+
} else {
415+
print_Msg(cartSize * 8 / 1024 / 1024);
416+
println_Msg(F(" MBit"));
417+
}
418+
389419
print_Msg(F("Sram: "));
390420
if (sramSize > 0) {
391421
print_Msg(sramSize * 8 / 1024);
@@ -539,7 +569,35 @@ unsigned long verifySRAM_VB() {
539569

540570
return writeErrors;
541571
}
572+
573+
//******************************************
574+
// SET ROM SIZE MANUALLY
575+
//******************************************
576+
577+
void setRomSize() {
578+
unsigned char VBRomSize;
579+
convertPgm(VBRomSizeMenu, 5);
580+
VBRomSize = question_box(F("Select ROM size"), menuOptions, 5, 0);
581+
switch (VBRomSize) {
582+
case 0:
583+
cartSize = 0x10000; // 64KB
584+
break;
585+
case 1:
586+
cartSize = 0x80000; // 512KB
587+
break;
588+
case 2:
589+
cartSize = 0x100000; // 1MB
590+
break;
591+
case 3:
592+
cartSize = 0x200000; // 2MB
593+
break;
594+
case 4:
595+
cartSize = 0x400000; // 4MB
596+
break;
597+
}
598+
getCartInfo_VB();
599+
}
542600
#endif
543601
//******************************************
544602
// End of File
545-
//******************************************
603+
//******************************************

0 commit comments

Comments
 (0)