geniestage=2;
}
+static uint8 *real_pages[16];
+
+void GenieSetPages(int restore)
+{
+ int page;
+ if (restore)
+ {
+ for (page=16; page<32; page++)
+ Page[page] = real_pages[page-16];
+ }
+ else
+ {
+ for (page=16; page<32; page++) {
+ real_pages[page-16] = Page[page];
+ Page[page]=GENIEROM - (page<<11) + ((page&1)<<11);
+ }
+ }
+}
void FCEU_SaveGameSave(CartInfo *LocalHWInfo)
{
ARead[x+0x8000]=AReadG[x];
BWrite[x+0x8000]=BWriteG[x];
}
+#ifdef ASM_6502
+ GenieSetPages(1);
+#endif
free(AReadG);
free(BWriteG);
AReadG=0;
X6502_Reset();
}
+static void FCEU_MemoryRand(uint8 *ptr, uint32 size)
+{
+ int x=0;
+ while(size)
+ {
+ *ptr=(x&4)?0xFF:0x00;
+ x++;
+ size--;
+ ptr++;
+ }
+}
+
void PowerNES(void)
{
if(!GameLoaded) return;
GeniePower();
+#ifndef DEBUG_ASM_6502
+ FCEU_MemoryRand(RAM,0x800);
+#else
memset(RAM,0x00,0x800);
+#endif
ResetMapping();
GameInterface(GI_POWER);
PowerSound();
PowerPPU();
timestampbase=0;
+#ifdef ASM_6502
+ if (geniestage)
+ GenieSetPages(0);
+#endif
X6502_Power();
}
@@@ Read byte
@@@
-.macro READ rom_optimize=1
- adr lr, 1f
-.if \rom_optimize
- tst REG_ADDR, #0x8000
- bne read_rom_byte
-.endif
+.macro READ unused_param
tst REG_ADDR, #0xe000
- bne read_byte
@ RAM
- bic r0, REG_ADDR, #0x1800
- add r0, r0, #OTOFFS_NES_RAM
- ldrb r0, [r0, REG_OP_TABLE]
- @@ ¤È¤¤¤¦¤ï¤±¤Ç¥¸¥ã¥ó¥×¤¹¤ëɬÍפϤʤ¤
-1:
+ biceq r0, REG_ADDR, #0x1800
+ addeq r0, r0, #OTOFFS_NES_RAM
+ ldreqb r0, [r0, REG_OP_TABLE]
+ blne read_byte
.endm
@@@
@@@ OP¤Ç¤Ïr3¤òÊݸ¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤
.macro READ_WRITE_1
- adr lr, 9999f
- tst REG_ADDR, #0x8000
- bne read_rom_byte
tst REG_ADDR, #0xe000
+ adrne lr, 9999f
bne read_byte
@ RAM
bic REG_ADDR, REG_ADDR, #0x1800
@@@ REG_ADDR¤òÊѹ¹¤¹¤ë¤¬µ¤¤Ë¤¹¤ë¤Ê
@@@
.macro READ_WORD
- @ don't do ROM check, because we might be fetching important stuff like vectors
READ 0
mov REG_PC, r0
add REG_ADDR, REG_ADDR, #1
@@@ low-level memhandlers
@@@
+/*
+@ disabled because no improvements noticed, only causes trouble (with gg for example)
read_rom_byte:
@ try to avoid lookup of every address at least for ROM and RAM areas
@ I've verified that if ARead[0xfff0] points to CartBR, it is always normal ROM read.
-#ifndef DEBUG_ASM_6502
ldr r0, =CartBR
ldr r2, =ARead
mov r1, #0xff00
ldr r2, [r2, r1, lsl #2]
ldrb r0, [r2, REG_ADDR]
bx lr
-#endif
+*/
read_byte: