Un-ignored: the dev drive is the ground truth the restoration and emulator work constantly reference (DPL3/LIBDPL + VRENDER i860 renderer source, BT/RP live+dev game trees, VGL_LABS pod boot, scene/audio content). Kept in-repo for the pod-owner community. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
207 lines
6.0 KiB
C++
207 lines
6.0 KiB
C++
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
/* #define XP */
|
|
|
|
|
|
extern void blitz_memcpy ( int *dst, int *src, int words );
|
|
|
|
typedef int (*ifptr)( int );
|
|
|
|
ifptr addemup;
|
|
|
|
/* #define blitz_memcpy(a,b,c) memcpy(a,b,(c)<<2 ) */
|
|
|
|
int main ( int argc, char **argv )
|
|
{
|
|
/*{{{ locals*/
|
|
int k, t, i, *memory, memwords=16*1024*1024, halfwords;
|
|
|
|
/*}}} */
|
|
|
|
/*{{{ grab as much ram as i can*/
|
|
memory=NULL;
|
|
while (memory == NULL) {
|
|
memwords-=127;
|
|
memory=(int *) malloc(memwords*4);
|
|
}
|
|
memwords-=64;
|
|
memwords&=0xffffffc0;
|
|
|
|
|
|
memwords=1024*512;
|
|
|
|
halfwords=memwords>>1;
|
|
|
|
printf ("Memwords = %d, halfwords=%d\n", memwords, halfwords );
|
|
/*}}} */
|
|
|
|
while (1) {
|
|
int k, j;
|
|
float then, now;
|
|
extern float second_();
|
|
|
|
then=second_();
|
|
for (k=0; k<1; k++ ) {
|
|
/*{{{ set and check to i*/
|
|
/* printf ("Setting memory[i] = i\n" ); */
|
|
|
|
for (j=0; j<6; j++ ) {
|
|
for (i=0; i<halfwords; i++ ) {
|
|
memory[i] = i;
|
|
}
|
|
for (i=0; i<halfwords; i++ ) {
|
|
if ((t=memory[i]) != i) {
|
|
printf ( "Mismatch at 0x%x (0x%x), got 0x%x\n", i, &memory[i], t );
|
|
}
|
|
}
|
|
}
|
|
/*}}} */
|
|
|
|
/*{{{ set and check to i, blitz copy, check copy*/
|
|
/* printf ("Setting memory[i] = i, blitz_memcpy\n" ); */
|
|
for (j=0; j<6; j++ ) {
|
|
for (i=0; i<halfwords; i++ ) {
|
|
memory[i] = i;
|
|
}
|
|
blitz_memcpy ( &memory[halfwords], memory, halfwords );
|
|
for (i=0; i<halfwords; i++ ) {
|
|
if ((t=memory[halfwords+i]) != i) {
|
|
printf ( "Mismatch at 0x%x (0x%x), got 0x%x\n", halfwords+i,
|
|
&memory[halfwords+i], t );
|
|
}
|
|
}
|
|
}
|
|
/*}}} */
|
|
|
|
/*{{{ set and check to ~i, blitz copy, check copy*/
|
|
/* printf ("Setting memory[i] = ~i, blitz_memcpy\n" ); */
|
|
for (j=0; j<6; j++ ) {
|
|
for (i=0; i<halfwords; i++ ) {
|
|
memory[i] = ~i;
|
|
}
|
|
blitz_memcpy ( &memory[halfwords], memory, halfwords );
|
|
for (i=0; i<halfwords; i++ ) {
|
|
if ((t=memory[halfwords+i]) != ~i) {
|
|
printf ( "Mismatch at 0x%x (0x%x), got 0x%x\n", halfwords+i,
|
|
&memory[halfwords+i], t );
|
|
}
|
|
}
|
|
}
|
|
/*}}} */
|
|
|
|
/*{{{ set and check to 0, blitz copy, check copy*/
|
|
/* printf ("Setting memory[i] = 0, blitz_memcpy\n" ); */
|
|
for (j=0; j<6; j++ ) {
|
|
for (i=0; i<halfwords; i++ ) {
|
|
memory[i] = 0;
|
|
}
|
|
blitz_memcpy ( &memory[halfwords], memory, halfwords );
|
|
for (i=0; i<halfwords; i++ ) {
|
|
if ((t=memory[halfwords+i]) != 0) {
|
|
printf ( "Mismatch at 0x%x (0x%x), got 0x%x\n", halfwords+i,
|
|
&memory[halfwords+i], t );
|
|
}
|
|
}
|
|
}
|
|
/*}}} */
|
|
|
|
/*{{{ set and check to -1, blitz copy, check copy*/
|
|
/* printf ("Setting memory[i] = -1, blitz_memcpy\n" ); */
|
|
for (j=0; j<6; j++ ) {
|
|
for (i=0; i<halfwords; i++ ) {
|
|
memory[i] = -1;
|
|
}
|
|
blitz_memcpy ( &memory[halfwords], memory, halfwords );
|
|
for (i=0; i<halfwords; i++ ) {
|
|
if ((t=memory[halfwords+i]) != (-1)) {
|
|
printf ( "Mismatch at 0x%x (0x%x), got 0x%x\n", halfwords+i,
|
|
&memory[halfwords+i], t );
|
|
}
|
|
}
|
|
}
|
|
/*}}} */
|
|
|
|
/*{{{ set and check to aa, blitz copy, check copy*/
|
|
/* printf ("Setting memory[i] = 0xaa, blitz_memcpy\n" ); */
|
|
for (j=0; j<6; j++ ) {
|
|
for (i=0; i<halfwords; i++ ) {
|
|
memory[i] = 0xaaaaaaaa;
|
|
}
|
|
blitz_memcpy ( &memory[halfwords], memory, halfwords );
|
|
for (i=0; i<halfwords; i++ ) {
|
|
if ((t=memory[halfwords+i]) != 0xaaaaaaaa) {
|
|
printf ( "Mismatch at 0x%x (0x%x), got 0x%x\n", halfwords+i,
|
|
&memory[halfwords+i], t );
|
|
}
|
|
}
|
|
}
|
|
/*}}} */
|
|
|
|
/*{{{ set and check to 55, blitz copy, check copy*/
|
|
/* printf ("Setting memory[i] = 0x55, blitz_memcpy\n" ); */
|
|
for (j=0; j<6; j++ ) {
|
|
for (i=0; i<halfwords; i++ ) {
|
|
memory[i] = 0x55555555;
|
|
}
|
|
blitz_memcpy ( &memory[halfwords], memory, halfwords );
|
|
for (i=0; i<halfwords; i++ ) {
|
|
if ((t=memory[halfwords+i]) != 0x55555555) {
|
|
printf ( "Mismatch at 0x%x (0x%x), got 0x%x\n", halfwords+i,
|
|
&memory[halfwords+i], t );
|
|
}
|
|
}
|
|
}
|
|
/*}}} */
|
|
|
|
/*{{{ set and check to adds 1, r16, r16, blitz copy, check copy*/
|
|
/* printf ("Setting memory[i] = 0x96100001, blitz_memcpy\n" ); */
|
|
for (j=0; j<6; j++ ) {
|
|
for (i=0; i<halfwords; i++ ) {
|
|
memory[i] = 0x96100001;
|
|
}
|
|
blitz_memcpy ( &memory[halfwords], memory, halfwords );
|
|
for (i=0; i<halfwords; i++ ) {
|
|
if ((t=memory[halfwords+i]) != 0x96100001) {
|
|
printf ( "Mismatch at 0x%x (0x%x), got 0x%x\n", halfwords+i,
|
|
&memory[halfwords+i], t );
|
|
}
|
|
}
|
|
}
|
|
/*}}} */
|
|
|
|
/*{{{ code test?*/
|
|
/* printf ("Code fetch test, putting adds 1, r16, r16 into memory\n" ); */
|
|
for (i=0; i<memwords; i++ ) {
|
|
memory[i] = 0x96100001; /* adds 1, r16, r16 */
|
|
}
|
|
for (i=0; i<memwords; i++ ) {
|
|
if ((t = memory[i]) != 0x96100001) {
|
|
printf ( "Mismatch at 0x%x (0x%x), got 0x%x\n", i,
|
|
0x9610001, t );
|
|
}
|
|
}
|
|
|
|
/* printf ("Patching bri r1 into penultimate location\n" ); */
|
|
|
|
memory[memwords-2] = 0x40000800; /* bri r1 */
|
|
|
|
/* printf ("Calling data vector\n" ); */
|
|
|
|
addemup = (ifptr) &memory[0];
|
|
|
|
flush();
|
|
|
|
for (j=0; j<6; j++ )
|
|
t=(*addemup)(0);
|
|
|
|
/* printf ("returned 0x%x, expected 0x%x\n", t, memwords-1 ); */
|
|
|
|
/*}}} */
|
|
}
|
|
now=second_();
|
|
printf ("Done an iteration, %f seconds\n", now-then );
|
|
}
|
|
}
|
|
|