Actually fix RW bank not kept at 0 during idle

This commit is contained in:
Zane Kaminski 2020-08-02 21:34:56 -04:00
parent 59b07fcf11
commit c605898366
4 changed files with 14 additions and 8 deletions

Binary file not shown.

Binary file not shown.

10
main.c
View File

@ -14,10 +14,13 @@ int main(void)
switch ((get_ostype() & 0xF0)) { switch ((get_ostype() & 0xF0)) {
case APPLE_IIE: case APPLE_IIE:
ram2e_main(); ram2e_main();
break; // Set RAMWorks bank to 0
__asm__("lda #0");
__asm__("sta $C073");
return EXIT_SUCCESS;
case APPLE_IIGS: case APPLE_IIGS:
ram2gs_main(); ram2gs_main();
break; return EXIT_SUCCESS;
default: default:
// If not on IIe or IIgs, show an error message and quit // If not on IIe or IIgs, show an error message and quit
gotoxy(0, 8); gotoxy(0, 8);
@ -27,6 +30,5 @@ int main(void)
cgetc(); // Wait for key cgetc(); // Wait for key
clrscr(); // Clear screen before quitting clrscr(); // Clear screen before quitting
return EXIT_SUCCESS; return EXIT_SUCCESS;
break;
} }
} }

12
ram2e.c
View File

@ -183,6 +183,7 @@ static char ram2e_detect() {
// Go back to bank 0 // Go back to bank 0
__asm__("lda #$00"); __asm__("lda #$00");
__asm__("sta $C073"); __asm__("sta $C073");
__asm__("sta $C073");
// Save result and return // Save result and return
__asm__("lda $00"); // Get beginning of bank 0 __asm__("lda $00"); // Get beginning of bank 0
@ -259,9 +260,8 @@ static void set_nvm(char mask) {
ufm_program(); ufm_program();
} }
static void menu(void) static void menu(uint16_t bankcount)
{ {
uint16_t bankcount = ramworks_getsize();
gotoxy(5, 1); gotoxy(5, 1);
cputs("-- RAM2E Capacity Settings --"); cputs("-- RAM2E Capacity Settings --");
if (bankcount < 2) { gotoxy(5, 3); } if (bankcount < 2) { gotoxy(5, 3); }
@ -299,10 +299,12 @@ int ram2e_main(void)
char mask; char mask;
char nvm; char nvm;
int reset_count; int reset_count;
uint16_t bankcount;
// Check for RAM2E // Check for RAM2E
ramworks_save(); // Save what will be clobbered ramworks_save(); // Save what will be clobbered
if(!auxram_detect() || !ram2e_detect()) { if(!auxram_detect() || !ram2e_detect()) {
ramworks_restore();
// If no RAM2E, show an error message and quit // If no RAM2E, show an error message and quit
gotoxy(0, 8); gotoxy(0, 8);
cputs(" No RAM2E II detected."); cputs(" No RAM2E II detected.");
@ -310,11 +312,13 @@ int ram2e_main(void)
cputs(" Press any key to quit."); cputs(" Press any key to quit.");
cgetc(); // Wait for key cgetc(); // Wait for key
clrscr(); // Clear screen before quitting clrscr(); // Clear screen before quitting
ramworks_restore();
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
menu(); // Print menu // Get size and print menu
bankcount = ramworks_getsize();
menu(bankcount); // Print menu
ramworks_restore(); // Restore RAMWorks contents
// Get user choice from menu // Get user choice from menu
mask = 0; mask = 0;