Better?
This commit is contained in:
parent
e8399af9da
commit
745358d37b
2
Makefile
2
Makefile
|
@ -68,5 +68,3 @@ clean:
|
||||||
copy: bin/GWRAM.po
|
copy: bin/GWRAM.po
|
||||||
cp bin/GWRAM.po /Volumes/FLOPPYEMU/GWRAM.po
|
cp bin/GWRAM.po /Volumes/FLOPPYEMU/GWRAM.po
|
||||||
diskutil unmount /Volumes/FLOPPYEMU/
|
diskutil unmount /Volumes/FLOPPYEMU/
|
||||||
|
|
||||||
|
|
||||||
|
|
BIN
bin/GWRAM.dbg.po
BIN
bin/GWRAM.dbg.po
Binary file not shown.
BIN
bin/GWRAM.po
BIN
bin/GWRAM.po
Binary file not shown.
1
ram2e.c
1
ram2e.c
|
@ -8,6 +8,7 @@
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "gwconio.h"
|
#include "gwconio.h"
|
||||||
#include "ram2e_hal.h"
|
#include "ram2e_hal.h"
|
||||||
|
#include "ram2e_save.h"
|
||||||
|
|
||||||
static void menu()
|
static void menu()
|
||||||
{
|
{
|
||||||
|
|
58
ram2e_hal.h
58
ram2e_hal.h
|
@ -1,5 +1,5 @@
|
||||||
#ifndef RAM2GS_HAL_H
|
#ifndef RAM2E_HAL_H
|
||||||
#define RAM2GS_HAL_H
|
#define RAM2E_HAL_H
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
@ -15,58 +15,4 @@ void ram2e_erase();
|
||||||
void ram2e_save_start(char mask, char enled);
|
void ram2e_save_start(char mask, char enled);
|
||||||
void ram2e_save_end(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
|
#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
|
3
ram2gs.c
3
ram2gs.c
|
@ -49,7 +49,7 @@ static void loading_screen()
|
||||||
int ram2gs_main(void)
|
int ram2gs_main(void)
|
||||||
{
|
{
|
||||||
char type;
|
char type;
|
||||||
uint16_t bankcount;
|
uint8_t bankcount;
|
||||||
char en8meg = true;
|
char en8meg = true;
|
||||||
char hasled = true;
|
char hasled = true;
|
||||||
char enled = false;
|
char enled = false;
|
||||||
|
@ -89,6 +89,7 @@ int ram2gs_main(void)
|
||||||
|
|
||||||
// Detect and print current capacity
|
// Detect and print current capacity
|
||||||
bankcount = ram2gs_getsize();
|
bankcount = ram2gs_getsize();
|
||||||
|
en8meg = bankcount >= 128;
|
||||||
menu_size(bankcount);
|
menu_size(bankcount);
|
||||||
|
|
||||||
// Detect and print LED menu
|
// Detect and print LED menu
|
||||||
|
|
Loading…
Reference in New Issue