4 * This is a deprecated module that is not yet completely extricated from the
7 * Copyright (c) 2005 Nathan Keynes.
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
20 #define MODULE sh4_module
27 #include "dreamcast.h"
28 #include "sh4/sh4core.h"
29 #include "sh4/sh4mmio.h"
30 #include "sh4/xltcache.h"
31 #include "pvr2/pvr2.h"
33 /************** Obsolete methods ***************/
35 int32_t FASTCALL sh4_read_long( sh4addr_t addr )
37 return sh4_address_space[addr>>12]->read_long(addr);
40 int32_t FASTCALL sh4_read_word( sh4addr_t addr )
42 return sh4_address_space[addr>>12]->read_word(addr);
45 int32_t FASTCALL sh4_read_byte( sh4addr_t addr )
47 return sh4_address_space[addr>>12]->read_byte(addr);
50 void FASTCALL sh4_write_long( sh4addr_t addr, uint32_t val )
52 sh4_address_space[addr>>12]->write_long(addr, val);
55 void FASTCALL sh4_write_word( sh4addr_t addr, uint32_t val )
57 sh4_address_space[addr>>12]->write_word(addr,val);
60 void FASTCALL sh4_write_byte( sh4addr_t addr, uint32_t val )
62 sh4_address_space[addr>>12]->write_byte(addr, val);
65 /* FIXME: Handle all the many special cases when the range doesn't fall cleanly
66 * into the same memory block
68 void mem_copy_from_sh4( sh4ptr_t dest, sh4addr_t srcaddr, size_t count ) {
69 if( srcaddr >= 0x04000000 && srcaddr < 0x05000000 ) {
70 pvr2_vram64_read( dest, srcaddr, count );
72 sh4ptr_t src = mem_get_region(srcaddr);
74 WARN( "Attempted block read from unknown address %08X", srcaddr );
76 memcpy( dest, src, count );
81 void mem_copy_to_sh4( sh4addr_t destaddr, sh4ptr_t src, size_t count ) {
82 if( destaddr >= 0x10000000 && destaddr < 0x14000000 ) {
83 pvr2_dma_write( destaddr, src, count );
85 } else if( (destaddr & 0x1F800000) == 0x05000000 ) {
86 pvr2_render_buffer_invalidate( destaddr, TRUE );
87 } else if( (destaddr & 0x1F800000) == 0x04000000 ) {
88 pvr2_vram64_write( destaddr, src, count );
91 sh4ptr_t dest = mem_get_region(destaddr);
93 WARN( "Attempted block write to unknown address %08X", destaddr );
95 xlat_invalidate_block( destaddr, count );
96 memcpy( dest, src, count );
.