X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=Pico%2FMemory_amips.s;h=5a6b7681fc4bb3db4b7e4329d9913557d60fd83f;hb=43e6eaad0b73b37907be3342e0fd4cf65919e9f6;hp=0c18f4b72338f766b704de016302c859f0feb9e8;hpb=9dc09829192f73f5d0502c8b312a39863bca60d3;p=picodrive.git diff --git a/Pico/Memory_amips.s b/Pico/Memory_amips.s index 0c18f4b..5a6b768 100644 --- a/Pico/Memory_amips.s +++ b/Pico/Memory_amips.s @@ -421,12 +421,8 @@ m_read8_z80_misc: lui $t0, %hi(PicoOpt) lw $t0, %lo(PicoOpt)($t0) andi $t0, 1 - beqz $t0, m_read8_fake_ym2612 - lui $t0, %hi(Pico+0x22208) - lui $t0, %hi(ym2612_st) - lw $t0, %lo(ym2612_st)($t0) - jr $ra - lb $v0, 0x11($t0) + bnez $t0, ym2612_read_local_68k + nop m_read8_fake_ym2612: lb $v0, %lo(Pico+0x22208)($t0) # Pico.m.rotate @@ -435,16 +431,28 @@ m_read8_fake_ym2612: sb $t1, %lo(Pico+0x22208)($t0) # delay slot friendly -.macro m_read8_call16 funcname +.macro m_read8_call16 funcname is_func_ptr=0 +.if \is_func_ptr + lui $t1, %hi(\funcname) + lw $t1, %lo(\funcname)($t1) +.endif andi $t0, $a0, 1 beqz $t0, 1f li $a1, 8 # not always needed, but shouln't cause problems +.if \is_func_ptr + jr $t1 +.else j \funcname # odd address +.endif nop 1: addiu $sp, -4 sw $ra, 0($sp) +.if \is_func_ptr + jalr $t1 +.else jal \funcname +.endif xori $a0, 1 lw $ra, 0($sp) addiu $sp, 4 @@ -473,7 +481,7 @@ m_read8_ram: m_read8_above_rom: # might still be SRam (Micro Machines, HardBall '95) m_read_rom_try_sram 0 8 - m_read8_call16 OtherRead16End + m_read8_call16 PicoRead16Hook 1 # ############################################################################# @@ -584,7 +592,9 @@ m_read16_ram: m_read16_above_rom: # might still be SRam m_read_rom_try_sram 0 16 - j OtherRead16End + lui $t1, %hi(PicoRead16Hook) + lw $t1, %lo(PicoRead16Hook)($t1) + jr $t1 ins $a0, $0, 0, 1 # ############################################################################# @@ -725,7 +735,25 @@ m_read32_above_rom: # might still be SRam m_read_rom_try_sram 0 32 ins $a0, $0, 0, 1 - m_read32_call16 OtherRead16End + lui $t1, %hi(PicoRead16Hook) + lw $t1, %lo(PicoRead16Hook)($t1) + addiu $sp, -4*3 + sw $ra, 0($sp) + sw $s0, 4($sp) + sw $t1, 8($sp) + jalr $t1 + move $s0, $a0 + + lw $t1, 8($sp) + addu $a0, $s0, 2 + jalr $t1 + move $s0, $v0 + + ins $v0, $s0, 16, 16 + lw $ra, 0($sp) + lw $s0, 4($sp) + jr $ra + addiu $sp, 4*3 # #############################################################################