aboutsummaryrefslogtreecommitdiffhomepage
path: root/Cart_Reader/FAIRCHILD.ino
diff options
context:
space:
mode:
authorsmesgr9000 <smesgr9000>2024-05-01 21:27:45 +0200
committersmesgr9000 <smesgr9000>2024-05-01 21:27:45 +0200
commit330e615b8c0f64c565742cdea1302aef651eecef (patch)
tree12a421fae78ca660b0d40a9d8cd5e828c50acd0b /Cart_Reader/FAIRCHILD.ino
parent2826ded431a186837b387f9d544d733145373973 (diff)
downloadcartreader-330e615b8c0f64c565742cdea1302aef651eecef.tar.gz
cartreader-330e615b8c0f64c565742cdea1302aef651eecef.zip
remove duplicate code to select mapper, rom and ram configurations
Diffstat (limited to 'Cart_Reader/FAIRCHILD.ino')
-rw-r--r--Cart_Reader/FAIRCHILD.ino70
1 files changed, 10 insertions, 60 deletions
diff --git a/Cart_Reader/FAIRCHILD.ino b/Cart_Reader/FAIRCHILD.ino
index c51c19d..5d372be 100644
--- a/Cart_Reader/FAIRCHILD.ino
+++ b/Cart_Reader/FAIRCHILD.ino
@@ -538,6 +538,14 @@ void read16K_FAIRCHILD() // Read 16K Bytes
// ROM SIZE
//******************************************
+#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
+void printRomSize_FAIRCHILD(int index) {
+ display_Clear();
+ print_Msg(F("ROM Size: "));
+ println_Msg(FAIRCHILD[index]);
+}
+#endif
+
void setROMSize_FAIRCHILD() {
byte newfairchildsize;
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
@@ -545,66 +553,8 @@ void setROMSize_FAIRCHILD() {
if (fairchildlo == fairchildhi)
newfairchildsize = fairchildlo;
else {
- uint8_t b = 0;
- int i = fairchildlo;
- display_Clear();
- print_Msg(F("ROM Size: "));
- println_Msg(FAIRCHILD[i]);
- println_Msg(FS(FSTRING_EMPTY));
-#if defined(ENABLE_OLED)
- print_STR(press_to_change_STR, 1);
- print_STR(right_to_select_STR, 1);
-#elif defined(ENABLE_LCD)
- print_STR(rotate_to_change_STR, 1);
- print_STR(press_to_select_STR, 1);
-#endif
- display_Update();
- while (1) {
- b = checkButton();
- if (b == 2) { // Previous (doubleclick)
- if (i == fairchildlo)
- i = fairchildhi;
- else
- i--;
-
- // Only update display after input because of slow LCD library
- display_Clear();
- print_Msg(F("ROM Size: "));
- println_Msg(FAIRCHILD[i]);
- println_Msg(FS(FSTRING_EMPTY));
-#if defined(ENABLE_OLED)
- print_STR(press_to_change_STR, 1);
- print_STR(right_to_select_STR, 1);
-#elif defined(ENABLE_LCD)
- print_STR(rotate_to_change_STR, 1);
- print_STR(press_to_select_STR, 1);
-#endif
- display_Update();
- }
- if (b == 1) { // Next (press)
- if (i == fairchildhi)
- i = fairchildlo;
- else
- i++;
- // Only update display after input because of slow LCD library
- display_Clear();
- print_Msg(F("ROM Size: "));
- println_Msg(FAIRCHILD[i]);
- println_Msg(FS(FSTRING_EMPTY));
-#if defined(ENABLE_OLED)
- print_STR(press_to_change_STR, 1);
- print_STR(right_to_select_STR, 1);
-#elif defined(ENABLE_LCD)
- print_STR(rotate_to_change_STR, 1);
- print_STR(press_to_select_STR, 1);
-#endif
- display_Update();
- }
- if (b == 3) { // Long Press - Execute (hold)
- newfairchildsize = i;
- break;
- }
- }
+ newfairchildsize = navigateMenu(fairchildlo, fairchildhi, &printRomSize_FAIRCHILD);
+
display.setCursor(0, 56); // Display selection at bottom
}
print_Msg(F("ROM SIZE "));