mirror of
https://github.com/garrettsworkshop/GWRAM.SYSTEM.git
synced 2026-04-20 04:16:43 +00:00
Better?
This commit is contained in:
@@ -68,5 +68,3 @@ clean:
|
||||
copy: bin/GWRAM.po
|
||||
cp bin/GWRAM.po /Volumes/FLOPPYEMU/GWRAM.po
|
||||
diskutil unmount /Volumes/FLOPPYEMU/
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -8,6 +8,7 @@
|
||||
#include "util.h"
|
||||
#include "gwconio.h"
|
||||
#include "ram2e_hal.h"
|
||||
#include "ram2e_save.h"
|
||||
|
||||
static void menu()
|
||||
{
|
||||
|
||||
+2
-56
@@ -1,5 +1,5 @@
|
||||
#ifndef RAM2GS_HAL_H
|
||||
#define RAM2GS_HAL_H
|
||||
#ifndef RAM2E_HAL_H
|
||||
#define RAM2E_HAL_H
|
||||
#include <ctype.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -15,58 +15,4 @@ void ram2e_erase();
|
||||
void ram2e_save_start(char mask, char enled);
|
||||
void ram2e_save_end(char mask, char enled);
|
||||
|
||||
static char _rwsave[256];
|
||||
static char _rwsave0_1;
|
||||
static char _rwsave0_2;
|
||||
static char _rwsave0_3;
|
||||
static void ramworks_save() {
|
||||
__asm__("sta $C009"); // Store in ALTZP
|
||||
|
||||
// Save address 0x0000 in every bank
|
||||
__asm__("ldx #0");
|
||||
saveloop:
|
||||
__asm__("stx $C073");
|
||||
__asm__("lda $00,X");
|
||||
__asm__("sta %v,X", _rwsave);
|
||||
__asm__("inx");
|
||||
__asm__("bne %g", saveloop);
|
||||
|
||||
// Save addresses 0x0001-3 in bank 0
|
||||
__asm__("ldx #0");
|
||||
__asm__("stx $C073");
|
||||
__asm__("lda $01");
|
||||
__asm__("sta %v", _rwsave0_1);
|
||||
__asm__("lda $02");
|
||||
__asm__("sta %v", _rwsave0_2);
|
||||
__asm__("lda $03");
|
||||
__asm__("sta %v", _rwsave0_3);
|
||||
|
||||
__asm__("sta $C008"); // Don't store in ALTZP
|
||||
}
|
||||
|
||||
static void ramworks_restore() {
|
||||
__asm__("sta $C009"); // Store in ALTZP
|
||||
|
||||
// Restore address 0x0000 in every bank
|
||||
__asm__("ldx #0");
|
||||
restoreloop:
|
||||
__asm__("stx $C073");
|
||||
__asm__("lda %v,X", _rwsave);
|
||||
__asm__("sta $00,X");
|
||||
__asm__("inx");
|
||||
__asm__("bne %g", restoreloop);
|
||||
|
||||
// Restore addresses 0x0001-3 in bank 0
|
||||
__asm__("ldx #0");
|
||||
__asm__("stx $C073");
|
||||
__asm__("lda %v", _rwsave0_1);
|
||||
__asm__("sta $01");
|
||||
__asm__("lda %v", _rwsave0_2);
|
||||
__asm__("sta $02");
|
||||
__asm__("lda %v", _rwsave0_3);
|
||||
__asm__("sta $03");
|
||||
|
||||
__asm__("sta $C008"); // Don't store in ALTZP
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,58 @@
|
||||
#ifndef RAM2E_SAVE_H
|
||||
#define RAM2E_SAVE_H
|
||||
|
||||
static char _rwsave[256];
|
||||
static char _rwsave0_1;
|
||||
static char _rwsave0_2;
|
||||
static char _rwsave0_3;
|
||||
static void ramworks_save() {
|
||||
__asm__("sta $C009"); // Store in ALTZP
|
||||
|
||||
// Save address 0x0000 in every bank
|
||||
__asm__("ldx #0");
|
||||
saveloop:
|
||||
__asm__("stx $C073");
|
||||
__asm__("lda $00,X");
|
||||
__asm__("sta %v,X", _rwsave);
|
||||
__asm__("inx");
|
||||
__asm__("bne %g", saveloop);
|
||||
|
||||
// Save addresses 0x0001-3 in bank 0
|
||||
__asm__("ldx #0");
|
||||
__asm__("stx $C073");
|
||||
__asm__("lda $01");
|
||||
__asm__("sta %v", _rwsave0_1);
|
||||
__asm__("lda $02");
|
||||
__asm__("sta %v", _rwsave0_2);
|
||||
__asm__("lda $03");
|
||||
__asm__("sta %v", _rwsave0_3);
|
||||
|
||||
__asm__("sta $C008"); // Don't store in ALTZP
|
||||
}
|
||||
|
||||
static void ramworks_restore() {
|
||||
__asm__("sta $C009"); // Store in ALTZP
|
||||
|
||||
// Restore address 0x0000 in every bank
|
||||
__asm__("ldx #0");
|
||||
restoreloop:
|
||||
__asm__("stx $C073");
|
||||
__asm__("lda %v,X", _rwsave);
|
||||
__asm__("sta $00,X");
|
||||
__asm__("inx");
|
||||
__asm__("bne %g", restoreloop);
|
||||
|
||||
// Restore addresses 0x0001-3 in bank 0
|
||||
__asm__("ldx #0");
|
||||
__asm__("stx $C073");
|
||||
__asm__("lda %v", _rwsave0_1);
|
||||
__asm__("sta $01");
|
||||
__asm__("lda %v", _rwsave0_2);
|
||||
__asm__("sta $02");
|
||||
__asm__("lda %v", _rwsave0_3);
|
||||
__asm__("sta $03");
|
||||
|
||||
__asm__("sta $C008"); // Don't store in ALTZP
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -49,7 +49,7 @@ static void loading_screen()
|
||||
int ram2gs_main(void)
|
||||
{
|
||||
char type;
|
||||
uint16_t bankcount;
|
||||
uint8_t bankcount;
|
||||
char en8meg = true;
|
||||
char hasled = true;
|
||||
char enled = false;
|
||||
@@ -89,6 +89,7 @@ int ram2gs_main(void)
|
||||
|
||||
// Detect and print current capacity
|
||||
bankcount = ram2gs_getsize();
|
||||
en8meg = bankcount >= 128;
|
||||
menu_size(bankcount);
|
||||
|
||||
// Detect and print LED menu
|
||||
|
||||
Reference in New Issue
Block a user