Search
lxdream.org :: lxdream/src/pvr2/pvr2mem.c
lxdream 0.9.1
released Jun 29
Download Now
filename src/pvr2/pvr2mem.c
changeset 310:00cd8897ad5e
prev309:e2750808d02c
next315:2d8ba198d62c
author nkeynes
date Mon Jan 22 11:45:37 2007 +0000 (13 years ago)
permissions -rw-r--r--
last change Add methods to detwiddle directly out of vram64
file annotate diff log raw
nkeynes@284
     1
/**
nkeynes@310
     2
 * $Id: pvr2mem.c,v 1.4 2007-01-22 11:45:37 nkeynes Exp $
nkeynes@284
     3
 *
nkeynes@284
     4
 * PVR2 (Video) VRAM handling routines (mainly for the 64-bit region)
nkeynes@284
     5
 *
nkeynes@284
     6
 * Copyright (c) 2005 Nathan Keynes.
nkeynes@284
     7
 *
nkeynes@284
     8
 * This program is free software; you can redistribute it and/or modify
nkeynes@284
     9
 * it under the terms of the GNU General Public License as published by
nkeynes@284
    10
 * the Free Software Foundation; either version 2 of the License, or
nkeynes@284
    11
 * (at your option) any later version.
nkeynes@284
    12
 *
nkeynes@284
    13
 * This program is distributed in the hope that it will be useful,
nkeynes@284
    14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
nkeynes@284
    15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
nkeynes@284
    16
 * GNU General Public License for more details.
nkeynes@284
    17
 */
nkeynes@284
    18
#include "pvr2.h"
nkeynes@309
    19
#include <stdio.h>
nkeynes@309
    20
#include <errno.h>
nkeynes@284
    21
nkeynes@284
    22
extern char *video_base;
nkeynes@284
    23
nkeynes@284
    24
void pvr2_vram64_write( sh4addr_t destaddr, char *src, uint32_t length )
nkeynes@284
    25
{
nkeynes@284
    26
    int bank_flag = (destaddr & 0x04) >> 2;
nkeynes@284
    27
    uint32_t *banks[2];
nkeynes@284
    28
    uint32_t *dwsrc;
nkeynes@284
    29
    int i;
nkeynes@284
    30
nkeynes@284
    31
    destaddr = destaddr & 0x7FFFFF;
nkeynes@284
    32
    if( destaddr + length > 0x800000 ) {
nkeynes@284
    33
	length = 0x800000 - destaddr;
nkeynes@284
    34
    }
nkeynes@284
    35
nkeynes@284
    36
    for( i=destaddr & 0xFFFFF000; i < destaddr + length; i+= PAGE_SIZE ) {
nkeynes@284
    37
	texcache_invalidate_page( i );
nkeynes@284
    38
    }
nkeynes@284
    39
nkeynes@284
    40
    banks[0] = ((uint32_t *)(video_base + ((destaddr & 0x007FFFF8) >>1)));
nkeynes@284
    41
    banks[1] = banks[0] + 0x100000;
nkeynes@284
    42
    if( bank_flag ) 
nkeynes@284
    43
	banks[0]++;
nkeynes@284
    44
    
nkeynes@284
    45
    /* Handle non-aligned start of source */
nkeynes@284
    46
    if( destaddr & 0x03 ) {
nkeynes@284
    47
	char *dest = ((char *)banks[bank_flag]) + (destaddr & 0x03);
nkeynes@284
    48
	for( i= destaddr & 0x03; i < 4 && length > 0; i++, length-- ) {
nkeynes@284
    49
	    *dest++ = *src++;
nkeynes@284
    50
	}
nkeynes@284
    51
	bank_flag = !bank_flag;
nkeynes@284
    52
    }
nkeynes@284
    53
nkeynes@284
    54
    dwsrc = (uint32_t *)src;
nkeynes@284
    55
    while( length >= 4 ) {
nkeynes@284
    56
	*banks[bank_flag]++ = *dwsrc++;
nkeynes@284
    57
	bank_flag = !bank_flag;
nkeynes@284
    58
	length -= 4;
nkeynes@284
    59
    }
nkeynes@284
    60
    
nkeynes@284
    61
    /* Handle non-aligned end of source */
nkeynes@284
    62
    if( length ) {
nkeynes@284
    63
	src = (char *)dwsrc;
nkeynes@284
    64
	char *dest = (char *)banks[bank_flag];
nkeynes@284
    65
	while( length-- > 0 ) {
nkeynes@284
    66
	    *dest++ = *src++;
nkeynes@284
    67
	}
nkeynes@284
    68
    }  
nkeynes@284
    69
}
nkeynes@284
    70
nkeynes@284
    71
/**
nkeynes@284
    72
 * Write an image to 64-bit vram, with a line-stride different from the line-size.
nkeynes@284
    73
 * The destaddr must be 32-bit aligned, and both line_bytes and line_stride_bytes
nkeynes@284
    74
 * must be multiples of 4.
nkeynes@284
    75
 */
nkeynes@284
    76
void pvr2_vram64_write_stride( sh4addr_t destaddr, char *src, uint32_t line_bytes, 
nkeynes@284
    77
			       uint32_t line_stride_bytes, uint32_t line_count )
nkeynes@284
    78
{
nkeynes@284
    79
    int bank_flag = (destaddr & 0x04) >> 2;
nkeynes@284
    80
    uint32_t *banks[2];
nkeynes@284
    81
    uint32_t *dwsrc;
nkeynes@284
    82
    uint32_t line_gap;
nkeynes@284
    83
    int line_gap_flag;
nkeynes@284
    84
    int i,j;
nkeynes@284
    85
nkeynes@284
    86
    destaddr = destaddr & 0x7FFFF8;
nkeynes@284
    87
    i = line_stride_bytes - line_bytes;
nkeynes@284
    88
    line_gap_flag = i & 0x04;
nkeynes@284
    89
    line_gap = i >> 3;
nkeynes@284
    90
    line_bytes >>= 2;
nkeynes@284
    91
nkeynes@284
    92
    for( i=destaddr & 0xFFFFF000; i < destaddr + line_stride_bytes*line_count; i+= PAGE_SIZE ) {
nkeynes@284
    93
	texcache_invalidate_page( i );
nkeynes@284
    94
    }
nkeynes@284
    95
nkeynes@284
    96
    banks[0] = (uint32_t *)(video_base + (destaddr >>1));
nkeynes@284
    97
    banks[1] = banks[0] + 0x100000;
nkeynes@284
    98
    if( bank_flag ) 
nkeynes@284
    99
	banks[0]++;
nkeynes@284
   100
    
nkeynes@284
   101
    dwsrc = (uint32_t *)src;
nkeynes@284
   102
    for( i=0; i<line_count; i++ ) {
nkeynes@284
   103
	for( j=0; j<line_bytes; j++ ) {
nkeynes@284
   104
	    *banks[bank_flag]++ = *dwsrc++;
nkeynes@284
   105
	    bank_flag = !bank_flag;
nkeynes@284
   106
	}
nkeynes@285
   107
	banks[0] += line_gap;
nkeynes@285
   108
	banks[1] += line_gap;
nkeynes@284
   109
	if( line_gap_flag ) {
nkeynes@285
   110
	    banks[bank_flag]++;
nkeynes@284
   111
	    bank_flag = !bank_flag;
nkeynes@284
   112
	}
nkeynes@284
   113
    }    
nkeynes@284
   114
}
nkeynes@284
   115
nkeynes@284
   116
/**
nkeynes@284
   117
 * Read an image from 64-bit vram, with a destination line-stride different from the line-size.
nkeynes@284
   118
 * The srcaddr must be 32-bit aligned, and both line_bytes and line_stride_bytes
nkeynes@284
   119
 * must be multiples of 4. line_stride_bytes must be >= line_bytes.
nkeynes@284
   120
 * This method is used to extract a "stride" texture from vram.
nkeynes@284
   121
 */
nkeynes@284
   122
void pvr2_vram64_read_stride( char *dest, uint32_t dest_line_bytes, sh4addr_t srcaddr,
nkeynes@284
   123
				   uint32_t src_line_bytes, uint32_t line_count )
nkeynes@284
   124
{
nkeynes@284
   125
    int bank_flag = (srcaddr & 0x04) >> 2;
nkeynes@284
   126
    uint32_t *banks[2];
nkeynes@284
   127
    uint32_t *dwdest;
nkeynes@284
   128
    uint32_t dest_line_gap;
nkeynes@284
   129
    uint32_t src_line_gap;
nkeynes@284
   130
    uint32_t line_bytes;
nkeynes@284
   131
    int src_line_gap_flag;
nkeynes@284
   132
    int i,j;
nkeynes@284
   133
nkeynes@284
   134
    srcaddr = srcaddr & 0x7FFFF8;
nkeynes@284
   135
    if( src_line_bytes <= dest_line_bytes ) {
nkeynes@284
   136
	dest_line_gap = (dest_line_bytes - src_line_bytes) >> 2;
nkeynes@284
   137
	src_line_gap = 0;
nkeynes@284
   138
	src_line_gap_flag = 0;
nkeynes@284
   139
	line_bytes = src_line_bytes >> 2;
nkeynes@284
   140
    } else {
nkeynes@284
   141
	i = (src_line_bytes - dest_line_bytes);
nkeynes@284
   142
	src_line_gap_flag = i & 0x04;
nkeynes@284
   143
	src_line_gap = i >> 3;
nkeynes@284
   144
	line_bytes = dest_line_bytes >> 2;
nkeynes@284
   145
    }
nkeynes@284
   146
	
nkeynes@284
   147
    banks[0] = (uint32_t *)(video_base + (srcaddr>>1));
nkeynes@284
   148
    banks[1] = banks[0] + 0x100000;
nkeynes@284
   149
    if( bank_flag )
nkeynes@284
   150
	banks[0]++;
nkeynes@284
   151
    
nkeynes@284
   152
    dwdest = (uint32_t *)dest;
nkeynes@284
   153
    for( i=0; i<line_count; i++ ) {
nkeynes@284
   154
	for( j=0; j<line_bytes; j++ ) {
nkeynes@284
   155
	    *dwdest++ = *banks[bank_flag]++;
nkeynes@284
   156
	    bank_flag = !bank_flag;
nkeynes@284
   157
	}
nkeynes@284
   158
	dwdest += dest_line_gap;
nkeynes@284
   159
	banks[0] += src_line_gap;
nkeynes@284
   160
	banks[1] += src_line_gap;
nkeynes@284
   161
	if( src_line_gap_flag ) {
nkeynes@284
   162
	    banks[bank_flag]++;
nkeynes@284
   163
	    bank_flag = !bank_flag;
nkeynes@284
   164
	}
nkeynes@310
   165
    }    
nkeynes@310
   166
}
nkeynes@310
   167
nkeynes@310
   168
/**
nkeynes@310
   169
 * @param dest Destination image buffer
nkeynes@310
   170
 * @param banks Source data expressed as two bank pointers
nkeynes@310
   171
 * @param offset Offset into banks[0] specifying where the next byte
nkeynes@310
   172
 *  to read is (0..3)
nkeynes@310
   173
 * @param x1,y1 Destination coordinates
nkeynes@310
   174
 * @param width Width of current destination block
nkeynes@310
   175
 * @param image_width Total width of image (ie stride)
nkeynes@310
   176
 */
nkeynes@310
   177
nkeynes@310
   178
static void pvr2_vram64_detwiddle_8( uint8_t *dest, uint8_t *banks[2], int offset,
nkeynes@310
   179
				     int x1, int y1, int width, int image_width )
nkeynes@310
   180
{
nkeynes@310
   181
    if( width == 2 ) {
nkeynes@310
   182
	dest[y1*image_width + x1] = *banks[0]++;
nkeynes@310
   183
	dest[(y1+1)*image_width + x1] = *banks[offset<3?0:1]++;
nkeynes@310
   184
	dest[y1*image_width + x1 + 1] = *banks[offset<2?0:1]++;
nkeynes@310
   185
	dest[(y1+1)*image_width + x1 + 1] = *banks[offset==0?0:1]++;
nkeynes@310
   186
	uint8_t *tmp = banks[0]; /* swap banks */
nkeynes@310
   187
	banks[0] = banks[1];
nkeynes@310
   188
	banks[1] = tmp;
nkeynes@310
   189
    } else {
nkeynes@310
   190
	int subdivide = width >> 1;
nkeynes@310
   191
	pvr2_vram64_detwiddle_8( dest, banks, offset, x1, y1, subdivide, image_width );
nkeynes@310
   192
	pvr2_vram64_detwiddle_8( dest, banks, offset, x1, y1+subdivide, subdivide, image_width );
nkeynes@310
   193
	pvr2_vram64_detwiddle_8( dest, banks, offset, x1+subdivide, y1, subdivide, image_width );
nkeynes@310
   194
	pvr2_vram64_detwiddle_8( dest, banks, offset, x1+subdivide, y1+subdivide, subdivide, image_width );
nkeynes@284
   195
    }
nkeynes@310
   196
}
nkeynes@310
   197
nkeynes@310
   198
/**
nkeynes@310
   199
 * @param dest Destination image buffer
nkeynes@310
   200
 * @param banks Source data expressed as two bank pointers
nkeynes@310
   201
 * @param offset Offset into banks[0] specifying where the next word
nkeynes@310
   202
 *  to read is (0 or 1)
nkeynes@310
   203
 * @param x1,y1 Destination coordinates
nkeynes@310
   204
 * @param width Width of current destination block
nkeynes@310
   205
 * @param image_width Total width of image (ie stride)
nkeynes@310
   206
 */
nkeynes@310
   207
nkeynes@310
   208
static void pvr2_vram64_detwiddle_16( uint16_t *dest, uint16_t *banks[2], int offset,
nkeynes@310
   209
				      int x1, int y1, int width, int image_width )
nkeynes@310
   210
{
nkeynes@310
   211
    if( width == 2 ) {
nkeynes@310
   212
	dest[y1*image_width + x1] = *banks[0]++;
nkeynes@310
   213
	dest[(y1+1)*image_width + x1] = *banks[offset]++;
nkeynes@310
   214
	dest[y1*image_width + x1 + 1] = *banks[1]++;
nkeynes@310
   215
	dest[(y1+1)*image_width + x1 + 1] = *banks[offset^1]++;
nkeynes@310
   216
    } else {
nkeynes@310
   217
	int subdivide = width >> 1;
nkeynes@310
   218
	pvr2_vram64_detwiddle_16( dest, banks, offset, x1, y1, subdivide, image_width );
nkeynes@310
   219
	pvr2_vram64_detwiddle_16( dest, banks, offset, x1, y1+subdivide, subdivide, image_width );
nkeynes@310
   220
	pvr2_vram64_detwiddle_16( dest, banks, offset, x1+subdivide, y1, subdivide, image_width );
nkeynes@310
   221
	pvr2_vram64_detwiddle_16( dest, banks, offset, x1+subdivide, y1+subdivide, subdivide, image_width );
nkeynes@310
   222
    }
nkeynes@310
   223
}
nkeynes@310
   224
nkeynes@310
   225
/**
nkeynes@310
   226
 * Read an image from 64-bit vram stored as twiddled 8-bit pixels. The 
nkeynes@310
   227
 * image is written out to the destination in detwiddled form.
nkeynes@310
   228
 * @param dest destination buffer, which must be at least width*height in length
nkeynes@310
   229
 * @param srcaddr source address in vram
nkeynes@310
   230
 * @param width image width (must be a power of 2)
nkeynes@310
   231
 * @param height image height (must be a power of 2)
nkeynes@310
   232
 */
nkeynes@310
   233
void pvr2_vram64_read_twiddled_8( char *dest, sh4addr_t srcaddr, uint32_t width, uint32_t height )
nkeynes@310
   234
{
nkeynes@310
   235
    int offset_flag = (srcaddr & 0x07);
nkeynes@310
   236
    uint8_t *banks[2];
nkeynes@310
   237
    uint8_t *wdest = (uint8_t*)dest;
nkeynes@310
   238
    int i,j;
nkeynes@310
   239
nkeynes@310
   240
    srcaddr = srcaddr & 0x7FFFF8;
nkeynes@310
   241
nkeynes@310
   242
    banks[0] = (uint8_t *)(video_base + (srcaddr>>1));
nkeynes@310
   243
    banks[1] = banks[0] + 0x400000;
nkeynes@310
   244
    if( offset_flag & 0x04 ) { // If source is not 64-bit aligned, swap the banks
nkeynes@310
   245
	uint8_t *tmp = banks[0];
nkeynes@310
   246
	banks[0] = banks[1];
nkeynes@310
   247
	banks[1] = tmp + 4;
nkeynes@310
   248
	offset_flag &= 0x03;
nkeynes@310
   249
    }
nkeynes@310
   250
    banks[0] += offset_flag;
nkeynes@310
   251
nkeynes@310
   252
    if( width > height ) {
nkeynes@310
   253
	for( i=0; i<width; i+=height ) {
nkeynes@310
   254
	    pvr2_vram64_detwiddle_8( wdest, banks, offset_flag, i, 0, height, width );
nkeynes@310
   255
	}
nkeynes@310
   256
    } else if( height > width ) {
nkeynes@310
   257
	for( i=0; i<height; i+=width ) {
nkeynes@310
   258
	    pvr2_vram64_detwiddle_8( wdest, banks, offset_flag, 0, i, width, width );
nkeynes@310
   259
	}
nkeynes@310
   260
    } else if( width == 1 ) {
nkeynes@310
   261
	*wdest = *banks[0];
nkeynes@310
   262
    } else {
nkeynes@310
   263
	pvr2_vram64_detwiddle_8( wdest, banks, offset_flag, 0, 0, width, width );
nkeynes@310
   264
    }   
nkeynes@310
   265
}
nkeynes@310
   266
nkeynes@310
   267
/**
nkeynes@310
   268
 * Read an image from 64-bit vram stored as twiddled 16-bit pixels. The 
nkeynes@310
   269
 * image is written out to the destination in detwiddled form.
nkeynes@310
   270
 * @param dest destination buffer, which must be at least width*height*2 in length
nkeynes@310
   271
 * @param srcaddr source address in vram (must be 16-bit aligned)
nkeynes@310
   272
 * @param width image width (must be a power of 2)
nkeynes@310
   273
 * @param height image height (must be a power of 2)
nkeynes@310
   274
 */
nkeynes@310
   275
void pvr2_vram64_read_twiddled_16( char *dest, sh4addr_t srcaddr, uint32_t width, uint32_t height ) {
nkeynes@310
   276
    int offset_flag = (srcaddr & 0x06) >> 1;
nkeynes@310
   277
    uint16_t *banks[2];
nkeynes@310
   278
    uint16_t *wdest = (uint16_t*)dest;
nkeynes@310
   279
    int i,j;
nkeynes@310
   280
nkeynes@310
   281
    srcaddr = srcaddr & 0x7FFFF8;
nkeynes@310
   282
nkeynes@310
   283
    banks[0] = (uint16_t *)(video_base + (srcaddr>>1));
nkeynes@310
   284
    banks[1] = banks[0] + 0x200000;
nkeynes@310
   285
    if( offset_flag & 0x02 ) { // If source is not 64-bit aligned, swap the banks
nkeynes@310
   286
	uint16_t *tmp = banks[0];
nkeynes@310
   287
	banks[0] = banks[1];
nkeynes@310
   288
	banks[1] = tmp + 2;
nkeynes@310
   289
	offset_flag &= 0x01;
nkeynes@310
   290
    }
nkeynes@310
   291
    banks[0] += offset_flag;
nkeynes@310
   292
	
nkeynes@310
   293
nkeynes@310
   294
    if( width > height ) {
nkeynes@310
   295
	for( i=0; i<width; i+=height ) {
nkeynes@310
   296
	    pvr2_vram64_detwiddle_16( wdest, banks, offset_flag, i, 0, height, width );
nkeynes@310
   297
	}
nkeynes@310
   298
    } else if( height > width ) {
nkeynes@310
   299
	for( i=0; i<height; i+=width ) {
nkeynes@310
   300
	    pvr2_vram64_detwiddle_16( wdest, banks, offset_flag, 0, i, width, width );
nkeynes@310
   301
	}
nkeynes@310
   302
    } else if( width == 1 ) {
nkeynes@310
   303
	*wdest = *banks[0];
nkeynes@310
   304
    } else {
nkeynes@310
   305
	pvr2_vram64_detwiddle_16( wdest, banks, offset_flag, 0, 0, width, width );
nkeynes@310
   306
    }    
nkeynes@284
   307
}
nkeynes@284
   308
nkeynes@284
   309
void pvr2_vram_write_invert( sh4addr_t destaddr, char *src, uint32_t length, uint32_t line_length )
nkeynes@284
   310
{
nkeynes@284
   311
    char *dest = video_base + (destaddr & 0x007FFFFF);
nkeynes@284
   312
    char *p = src + length - line_length;
nkeynes@284
   313
    while( p >= src ) {
nkeynes@284
   314
	memcpy( dest, p, line_length );
nkeynes@284
   315
	p -= line_length;
nkeynes@284
   316
	dest += line_length;
nkeynes@284
   317
    }
nkeynes@284
   318
}
nkeynes@284
   319
nkeynes@284
   320
void pvr2_vram64_read( char *dest, sh4addr_t srcaddr, uint32_t length )
nkeynes@284
   321
{
nkeynes@284
   322
    int bank_flag = (srcaddr & 0x04) >> 2;
nkeynes@284
   323
    uint32_t *banks[2];
nkeynes@284
   324
    uint32_t *dwdest;
nkeynes@284
   325
    int i;
nkeynes@284
   326
nkeynes@284
   327
    srcaddr = srcaddr & 0x7FFFFF;
nkeynes@284
   328
    if( srcaddr + length > 0x800000 )
nkeynes@284
   329
	length = 0x800000 - srcaddr;
nkeynes@284
   330
nkeynes@284
   331
    banks[0] = ((uint32_t *)(video_base + ((srcaddr&0x007FFFF8)>>1)));
nkeynes@284
   332
    banks[1] = banks[0] + 0x100000;
nkeynes@284
   333
    if( bank_flag )
nkeynes@284
   334
	banks[0]++;
nkeynes@284
   335
    
nkeynes@284
   336
    /* Handle non-aligned start of source */
nkeynes@284
   337
    if( srcaddr & 0x03 ) {
nkeynes@284
   338
	char *src = ((char *)banks[bank_flag]) + (srcaddr & 0x03);
nkeynes@284
   339
	for( i= srcaddr & 0x03; i < 4 && length > 0; i++, length-- ) {
nkeynes@284
   340
	    *dest++ = *src++;
nkeynes@284
   341
	}
nkeynes@284
   342
	bank_flag = !bank_flag;
nkeynes@284
   343
    }
nkeynes@284
   344
nkeynes@284
   345
    dwdest = (uint32_t *)dest;
nkeynes@284
   346
    while( length >= 4 ) {
nkeynes@284
   347
	*dwdest++ = *banks[bank_flag]++;
nkeynes@284
   348
	bank_flag = !bank_flag;
nkeynes@284
   349
	length -= 4;
nkeynes@284
   350
    }
nkeynes@284
   351
    
nkeynes@284
   352
    /* Handle non-aligned end of source */
nkeynes@284
   353
    if( length ) {
nkeynes@284
   354
	dest = (char *)dwdest;
nkeynes@284
   355
	char *src = (char *)banks[bank_flag];
nkeynes@284
   356
	while( length-- > 0 ) {
nkeynes@284
   357
	    *dest++ = *src++;
nkeynes@284
   358
	}
nkeynes@284
   359
    }
nkeynes@284
   360
}
nkeynes@284
   361
nkeynes@309
   362
void pvr2_vram64_dump_file( sh4addr_t addr, uint32_t length, gchar *filename )
nkeynes@309
   363
{
nkeynes@309
   364
    uint32_t tmp[length>>2];
nkeynes@309
   365
    FILE *f = fopen(filename, "wo");
nkeynes@309
   366
    unsigned int i, j;
nkeynes@309
   367
nkeynes@309
   368
    if( f == NULL ) {
nkeynes@309
   369
	ERROR( "Unable to write to dump file '%s' (%s)", filename, strerror(errno) );
nkeynes@309
   370
	return;
nkeynes@309
   371
    }
nkeynes@309
   372
    pvr2_vram64_read( tmp, addr, length );
nkeynes@309
   373
    fprintf( f, "%08X\n", addr );
nkeynes@309
   374
    for( i =0; i<length>>2; i+=8 ) {
nkeynes@309
   375
	for( j=i; j<i+8; j++ ) {
nkeynes@309
   376
	    if( j < length )
nkeynes@309
   377
		fprintf( f, " %08X", tmp[j] );
nkeynes@309
   378
	    else
nkeynes@309
   379
		fprintf( f, "         " );
nkeynes@309
   380
	}
nkeynes@309
   381
	fprintf( f, "\n" );
nkeynes@309
   382
    }
nkeynes@309
   383
    fclose(f);
nkeynes@309
   384
}
nkeynes@309
   385
nkeynes@284
   386
void pvr2_vram64_dump( sh4addr_t addr, uint32_t length, FILE *f ) 
nkeynes@284
   387
{
nkeynes@284
   388
    char tmp[length];
nkeynes@284
   389
    pvr2_vram64_read( tmp, addr, length );
nkeynes@284
   390
    fwrite_dump( tmp, length, f );
nkeynes@284
   391
}
.