- .align 2
- .global write_nomemh_new
- .type write_nomemh_new, %function
-write_nomemh_new:
- str r3, [fp, #24]
- str lr, [fp, #28]
- bl do_invalidate
- ldr r2, [fp, #address-dynarec_local]
- add r12, fp, #memory_map-dynarec_local
- ldr lr, [fp, #28]
- lsr r0, r2, #12
- ldr r3, [fp, #24]
- ldr r12, [r12, r0, lsl #2]
- mov r1, #0xc
- lsls r12, #2
- bcs tlb_exception
- eor r2, r2, #2
- ldrh r0, [fp, #hword-dynarec_local]
- strh r0, [r2, r12]
+ari_read_bios8:
+ ari_read_bios_mirror 0, ldrb
+
+ari_read_bios16:
+ ari_read_bios_mirror 1, ldrh
+
+ari_read_bios32:
+ ari_read_bios_mirror 3, ldr
+
+
+@ for testing
+.macro ari_read_io_old tab_shift
+ str lr, [sp, #-8]! @ EABI alignment..
+.if \tab_shift == 0
+ bl psxHwRead32
+.endif
+.if \tab_shift == 1
+ bl psxHwRead16
+.endif
+.if \tab_shift == 2
+ bl psxHwRead8
+.endif
+ str r0, [fp, #readmem_dword-dynarec_local]
+ ldr pc, [sp], #8
+.endm
+
+.macro ari_read_io readop mem_tab tab_shift
+ ldr r0, [fp, #address-dynarec_local]
+ ldr r1, [fp, #psxH_ptr-dynarec_local]
+.if \tab_shift == 0
+ bic r0, r0, #3
+.endif
+.if \tab_shift == 1
+ bic r0, r0, #1
+.endif
+ bic r2, r0, #0x1f800000
+ ldr r12,[fp, #\mem_tab-dynarec_local]
+ subs r3, r2, #0x1000
+ blo 2f
+@ ari_read_io_old \tab_shift
+ cmp r3, #0x880
+ bhs 1f
+ ldr r12,[r12, r3, lsl #\tab_shift]
+ tst r12,r12
+ beq 2f
+0:
+ str lr, [sp, #-8]! @ EABI alignment..
+ blx r12
+ str r0, [fp, #readmem_dword-dynarec_local]
+ ldr pc, [sp], #8
+
+1:
+.if \tab_shift == 1 @ read16
+ cmp r2, #0x1c00
+ blo 2f
+ cmp r2, #0x1e00
+ bhs 2f
+ ldr r12,[fp, #spu_readf-dynarec_local]
+ b 0b
+.endif
+2:
+ @ no handler, just read psxH
+ \readop r0, [r1, r2]
+ str r0, [fp, #readmem_dword-dynarec_local]