o add bankselect test for logic analyser test

This commit is contained in:
optixx
2009-04-26 16:24:04 +02:00
parent 096ad71b4e
commit d229719d0c
28 changed files with 881 additions and 0 deletions

37
snes/bankselect/crc.c Normal file
View File

@@ -0,0 +1,37 @@
#include "data.h"
word crc_update (char far *data, word size)
{
word i;
word j;
word crc=0;
for (j=0; j<size; j++){
crc = crc ^ ((word)data[j]<< 8);
for (i=0; i<8; i++){
if (crc & 0x8000)
crc = (crc << 1) ^ 0x1021;
else
crc <<= 1;
}
}
return crc;
}
word crc_update_mem (unsigned long addr, word size)
{
word i;
word j;
word crc=0;
for (j=0; j<size; j++){
crc = crc ^ ((word) *(byte*)(addr+j)<< 8);
for (i=0; i<8; i++){
if (crc & 0x8000)
crc = (crc << 1) ^ 0x1021;
else
crc <<= 1;
}
}
return crc;
}