@@@ 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: