Skip to content

Commit 083182b

Browse files
authored
Merge pull request #923 from smesgr9000/master
reduce memory footprint for 7800.ino
2 parents 8afd2a5 + cf1d018 commit 083182b

File tree

1 file changed

+46
-122
lines changed

1 file changed

+46
-122
lines changed

Cart_Reader/7800.ino

+46-122
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,27 @@ void checkMapperSize_7800() {
485485
}
486486
}
487487

488+
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
489+
void println_Mapper7800(byte mapper) {
490+
if (mapper == 0)
491+
println_Msg(F("STANDARD"));
492+
else if (mapper == 1)
493+
println_Msg(F("SUPERGAME 128K[78SG]"));
494+
else if (mapper == 2)
495+
println_Msg(F("SUPERGAME 144K[78S9]"));
496+
else if (mapper == 3)
497+
println_Msg(F("F-18 HORNET [78AB]"));
498+
else if (mapper == 4)
499+
println_Msg(F("DBLDRGN/RMPG [78AC]"));
500+
else if (mapper == 5)
501+
println_Msg(F("BASEBALL/ETC [78S4]"));
502+
else if (mapper == 6)
503+
println_Msg(F("KARATEKA(PAL) [78S4]"));
504+
else if (mapper == 7)
505+
println_Msg(F("BANKSET"));
506+
}
507+
#endif
508+
488509
void setROMSize_7800() {
489510
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
490511
display_Clear();
@@ -610,22 +631,7 @@ void checkStatus_7800() {
610631
println_Msg(FS(FSTRING_EMPTY));
611632
print_Msg(F("MAPPER: "));
612633
println_Msg(a7800mapper);
613-
if (a7800mapper == 0)
614-
println_Msg(F("STANDARD"));
615-
else if (a7800mapper == 1)
616-
println_Msg(F("SUPERGAME [78SG]"));
617-
else if (a7800mapper == 2)
618-
println_Msg(F("SUPERGAME [78S9]"));
619-
else if (a7800mapper == 3)
620-
println_Msg(F("F-18 HORNET [78AB]"));
621-
else if (a7800mapper == 4)
622-
println_Msg(F("DBLDRGN/RMPG [78AC]"));
623-
else if (a7800mapper == 5)
624-
println_Msg(F("BASEBALL/ETC [78S4]"));
625-
else if (a7800mapper == 6)
626-
println_Msg(F("KARATEKA(PAL)[78S4]"));
627-
else if (a7800mapper == 7)
628-
println_Msg(F("BANKSET"));
634+
println_Mapper7800(a7800mapper);
629635
print_Msg(F("ROM SIZE: "));
630636
print_Msg(a7800[a7800size]);
631637
println_Msg(F("K"));
@@ -661,6 +667,26 @@ void checkStatus_7800() {
661667
// SET MAPPER
662668
//******************************************
663669

670+
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
671+
void displayMapperSelect_7800(int index) {
672+
display_Clear();
673+
print_Msg(F("Mapper: "));
674+
a7800index = index * 3;
675+
a7800mapselect = pgm_read_byte(a7800mapsize + a7800index);
676+
println_Msg(a7800mapselect);
677+
println_Mapper7800(a7800mapselect);
678+
println_Msg(FS(FSTRING_EMPTY));
679+
#if defined(ENABLE_OLED)
680+
print_STR(press_to_change_STR, 1);
681+
print_STR(right_to_select_STR, 1);
682+
#elif defined(ENABLE_LCD)
683+
print_STR(rotate_to_change_STR, 1);
684+
print_STR(press_to_select_STR, 1);
685+
#endif
686+
display_Update();
687+
}
688+
#endif
689+
664690
void setMapper_7800() {
665691
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
666692
uint8_t b = 0;
@@ -691,22 +717,7 @@ void setMapper_7800() {
691717
a7800index = i * 3;
692718
a7800mapselect = pgm_read_byte(a7800mapsize + a7800index);
693719
println_Msg(a7800mapselect);
694-
if (a7800mapselect == 0)
695-
println_Msg(F("STANDARD"));
696-
else if (a7800mapselect == 1)
697-
println_Msg(F("SUPERGAME 128K[78SG]"));
698-
else if (a7800mapselect == 2)
699-
println_Msg(F("SUPERGAME 144K[78S9]"));
700-
else if (a7800mapselect == 3)
701-
println_Msg(F("F-18 HORNET [78AB]"));
702-
else if (a7800mapselect == 4)
703-
println_Msg(F("DBLDRGN/RAMPG [78AC]"));
704-
else if (a7800mapselect == 5)
705-
println_Msg(F("BASEBALL/ETC [78S4]"));
706-
else if (a7800mapselect == 6)
707-
println_Msg(F("KARATEKA(PAL) [78S4]"));
708-
else if (a7800mapselect == 7)
709-
println_Msg(F("BANKSET"));
720+
println_Mapper7800(a7800mapselect);
710721
display_Update();
711722
if (i == (a7800mapcount - 1))
712723
i = 0;
@@ -716,36 +727,7 @@ void setMapper_7800() {
716727
}
717728
}
718729

719-
display_Clear();
720-
print_Msg(F("Mapper: "));
721-
a7800index = i * 3;
722-
a7800mapselect = pgm_read_byte(a7800mapsize + a7800index);
723-
println_Msg(a7800mapselect);
724-
if (a7800mapselect == 0)
725-
println_Msg(F("STANDARD"));
726-
else if (a7800mapselect == 1)
727-
println_Msg(F("SUPERGAME 128K[78SG]"));
728-
else if (a7800mapselect == 2)
729-
println_Msg(F("SUPERGAME 144K[78S9]"));
730-
else if (a7800mapselect == 3)
731-
println_Msg(F("F-18 HORNET [78AB]"));
732-
else if (a7800mapselect == 4)
733-
println_Msg(F("DBLDRGN/RAMPG [78AC]"));
734-
else if (a7800mapselect == 5)
735-
println_Msg(F("BASEBALL/ETC [78S4]"));
736-
else if (a7800mapselect == 6)
737-
println_Msg(F("KARATEKA(PAL) [78S4]"));
738-
else if (a7800mapselect == 7)
739-
println_Msg(F("BANKSET"));
740-
println_Msg(FS(FSTRING_EMPTY));
741-
#if defined(ENABLE_OLED)
742-
print_STR(press_to_change_STR, 1);
743-
print_STR(right_to_select_STR, 1);
744-
#elif defined(ENABLE_LCD)
745-
print_STR(rotate_to_change_STR, 1);
746-
print_STR(press_to_select_STR, 1);
747-
#endif
748-
display_Update();
730+
displayMapperSelect_7800(i);
749731

750732
while (1) {
751733
b = checkButton();
@@ -755,36 +737,7 @@ void setMapper_7800() {
755737
else
756738
i--;
757739

758-
display_Clear();
759-
print_Msg(F("Mapper: "));
760-
a7800index = i * 3;
761-
a7800mapselect = pgm_read_byte(a7800mapsize + a7800index);
762-
println_Msg(a7800mapselect);
763-
if (a7800mapselect == 0)
764-
println_Msg(F("STANDARD"));
765-
else if (a7800mapselect == 1)
766-
println_Msg(F("SUPERGAME 128K[78SG]"));
767-
else if (a7800mapselect == 2)
768-
println_Msg(F("SUPERGAME 144K[78S9]"));
769-
else if (a7800mapselect == 3)
770-
println_Msg(F("F-18 HORNET [78AB]"));
771-
else if (a7800mapselect == 4)
772-
println_Msg(F("DBLDRGN/RAMPG [78AC]"));
773-
else if (a7800mapselect == 5)
774-
println_Msg(F("BASEBALL/ETC [78S4]"));
775-
else if (a7800mapselect == 6)
776-
println_Msg(F("KARATEKA(PAL) [78S4]"));
777-
else if (a7800mapselect == 7)
778-
println_Msg(F("BANKSET"));
779-
println_Msg(FS(FSTRING_EMPTY));
780-
#if defined(ENABLE_OLED)
781-
print_STR(press_to_change_STR, 1);
782-
print_STR(right_to_select_STR, 1);
783-
#elif defined(ENABLE_LCD)
784-
print_STR(rotate_to_change_STR, 1);
785-
print_STR(press_to_select_STR, 1);
786-
#endif
787-
display_Update();
740+
displayMapperSelect_7800(i);
788741

789742
}
790743
if (b == 1) { // Next Mapper (press)
@@ -793,36 +746,7 @@ void setMapper_7800() {
793746
else
794747
i++;
795748

796-
display_Clear();
797-
print_Msg(F("Mapper: "));
798-
a7800index = i * 3;
799-
a7800mapselect = pgm_read_byte(a7800mapsize + a7800index);
800-
println_Msg(a7800mapselect);
801-
if (a7800mapselect == 0)
802-
println_Msg(F("STANDARD"));
803-
else if (a7800mapselect == 1)
804-
println_Msg(F("SUPERGAME 128K[78SG]"));
805-
else if (a7800mapselect == 2)
806-
println_Msg(F("SUPERGAME 144K[78S9]"));
807-
else if (a7800mapselect == 3)
808-
println_Msg(F("F-18 HORNET [78AB]"));
809-
else if (a7800mapselect == 4)
810-
println_Msg(F("DBLDRGN/RAMPG [78AC]"));
811-
else if (a7800mapselect == 5)
812-
println_Msg(F("BASEBALL/ETC [78S4]"));
813-
else if (a7800mapselect == 6)
814-
println_Msg(F("KARATEKA(PAL) [78S4]"));
815-
else if (a7800mapselect == 7)
816-
println_Msg(F("BANKSET"));
817-
println_Msg(FS(FSTRING_EMPTY));
818-
#if defined(ENABLE_OLED)
819-
print_STR(press_to_change_STR, 1);
820-
print_STR(right_to_select_STR, 1);
821-
#elif defined(ENABLE_LCD)
822-
print_STR(rotate_to_change_STR, 1);
823-
print_STR(press_to_select_STR, 1);
824-
#endif
825-
display_Update();
749+
displayMapperSelect_7800(i);
826750
}
827751
if (b == 3) { // Long Press - Execute (hold)
828752
new7800mapper = a7800mapselect;

0 commit comments

Comments
 (0)