Search
lxdream.org :: lxdream/src/sh4/sh4mem.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/sh4/sh4mem.c
changeset 103:9b9cfc5855e0
prev100:995e42e96cc9
next130:279acbacc298
author nkeynes
date Mon Mar 13 12:39:07 2006 +0000 (14 years ago)
permissions -rw-r--r--
last change More rendering work in progress. Almost there now...
file annotate diff log raw
1.1 --- a/src/sh4/sh4mem.c Wed Feb 15 13:11:50 2006 +0000
1.2 +++ b/src/sh4/sh4mem.c Mon Mar 13 12:39:07 2006 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: sh4mem.c,v 1.7 2006-02-15 13:11:50 nkeynes Exp $
1.6 + * $Id: sh4mem.c,v 1.8 2006-03-13 12:39:07 nkeynes Exp $
1.7 * sh4mem.c is responsible for the SH4's access to memory (including memory
1.8 * mapped I/O), using the page maps created in mem.c
1.9 *
1.10 @@ -315,40 +315,29 @@
1.11 * into the same memory black
1.12 */
1.13 void mem_copy_from_sh4( char *dest, uint32_t srcaddr, size_t count ) {
1.14 - char *src = mem_get_region(srcaddr);
1.15 - memcpy( dest, src, count );
1.16 + if( srcaddr >= 0x04000000 && srcaddr < 0x05000000 ) {
1.17 + pvr2_vram64_read( dest, srcaddr, count );
1.18 + } else {
1.19 + char *src = mem_get_region(srcaddr);
1.20 + if( src == NULL ) {
1.21 + ERROR( "Attempted block read from unknown address %08X", srcaddr );
1.22 + } else {
1.23 + memcpy( dest, src, count );
1.24 + }
1.25 + }
1.26 }
1.27
1.28 void mem_copy_to_sh4( uint32_t destaddr, char *src, size_t count ) {
1.29 if( destaddr >= 0x10000000 && destaddr < 0x20000000 ) {
1.30 pvr2_ta_write( src, count );
1.31 - } else if( destaddr >= 04000000 && destaddr < 0x5000000 ) {
1.32 - /* 64-bit video write. Oh. Yuck */
1.33 - uint32_t *dest32[2];
1.34 - uint32_t *src32 = (uint32_t *)src;
1.35 - int flag = 0;
1.36 - if( destaddr & 0x03 != 0 ) {
1.37 - }
1.38 - dest32[0] = (uint32_t *)mem_get_region(TRANSLATE_VIDEO_64BIT_ADDRESS(destaddr));
1.39 - dest32[1] = (uint32_t *)mem_get_region(TRANSLATE_VIDEO_64BIT_ADDRESS(destaddr+4));
1.40 - while( count >= 4 ) {
1.41 - *dest32[flag]++ = *src32++;
1.42 - flag = !flag;
1.43 - count -=4;
1.44 - }
1.45 - if( count != 0 ) {
1.46 - src = (char *)src32;
1.47 - char *dest = dest32[flag];
1.48 - do {
1.49 - *dest++ = *src++;
1.50 - count--;
1.51 - } while( count > 0 );
1.52 - }
1.53 + } else if( destaddr >= 0x04000000 && destaddr < 0x05000000 ) {
1.54 + pvr2_vram64_write( destaddr, src, count );
1.55 } else {
1.56 char *dest = mem_get_region(destaddr);
1.57 if( dest == NULL )
1.58 - ERROR( "Attempted block write to undefined region %08X", destaddr );
1.59 - else
1.60 + ERROR( "Attempted block write to unknown address %08X", destaddr );
1.61 + else {
1.62 memcpy( dest, src, count );
1.63 + }
1.64 }
1.65 }
.