diff options
author | 2011-01-16 00:35:56 +0000 | |
---|---|---|
committer | 2011-01-16 00:35:56 +0000 | |
commit | b85af379a8d81f07b207a1f7eb2bb3b0e2f0108a (patch) | |
tree | e30d4958c66965590dae23bef1db112dec441431 /src/emu/cpu/sh4/sh4comn.c | |
parent | 74bbf1d033d67b5aedd8f1bf8b9caf1ea4fdba59 (diff) |
SH4: cleanup and better common/interpreter separation [R. Belmont]
Diffstat (limited to 'src/emu/cpu/sh4/sh4comn.c')
-rw-r--r-- | src/emu/cpu/sh4/sh4comn.c | 64 |
1 files changed, 57 insertions, 7 deletions
diff --git a/src/emu/cpu/sh4/sh4comn.c b/src/emu/cpu/sh4/sh4comn.c index 438378c5a68..0180bfca84c 100644 --- a/src/emu/cpu/sh4/sh4comn.c +++ b/src/emu/cpu/sh4/sh4comn.c @@ -30,13 +30,6 @@ static const UINT16 tcnt[] = { TCNT0, TCNT1, TCNT2 }; static const UINT16 tcor[] = { TCOR0, TCOR1, TCOR2 }; static const UINT16 tcr[] = { TCR0, TCR1, TCR2 }; -INLINE sh4_state *get_safe_token(device_t *device) -{ - assert(device != NULL); - assert(device->type() == SH4); - return (sh4_state *)downcast<legacy_cpu_device *>(device)->token(); -} - void sh4_change_register_bank(sh4_state *sh4, int to) { int s; @@ -1314,3 +1307,60 @@ void sh4_dma_ddt(device_t *device, struct sh4_ddt_dma *s) } } +UINT32 sh4_getsqremap(sh4_state *sh4, UINT32 address) +{ + if (!sh4->sh4_mmu_enabled) + return address; + else + { + int i; + UINT32 topaddr = address&0xfff00000; + + for (i=0;i<64;i++) + { + UINT32 topcmp = sh4->sh4_tlb_address[i]&0xfff00000; + if (topcmp==topaddr) + return (address&0x000fffff) | ((sh4->sh4_tlb_data[i])&0xfff00000); + } + + } + + return address; +} + +READ64_HANDLER( sh4_tlb_r ) +{ + sh4_state *sh4 = get_safe_token(space->cpu); + + int offs = offset*8; + + if (offs >= 0x01000000) + { + UINT8 i = (offs>>8)&63; + return sh4->sh4_tlb_data[i]; + } + else + { + UINT8 i = (offs>>8)&63; + return sh4->sh4_tlb_address[i]; + } +} + +WRITE64_HANDLER( sh4_tlb_w ) +{ + sh4_state *sh4 = get_safe_token(space->cpu); + + int offs = offset*8; + + if (offs >= 0x01000000) + { + UINT8 i = (offs>>8)&63; + sh4->sh4_tlb_data[i] = data&0xffffffff; + } + else + { + UINT8 i = (offs>>8)&63; + sh4->sh4_tlb_address[i] = data&0xffffffff; + } +} + |