News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu

checkbyte für tape-daten (256byte)...

Started by funkheld, 16:52, 30 October 10

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

funkheld

I get it not go.

a tape-byte block is so 2048, they are divided into 8 sector-tape to 256 bytes.
behind these 256 byte sectors are a tape-2 Total bytes / check byte.

the figure it is not me.

who can tell me the total bill once these 256 bytes show with "Basic"?

I program in PureBasic.

thank you.
Greetings

arnoldemu

Quote from: funkheld on 16:52, 30 October 10
I get it not go.

a tape-byte block is so 2048, they are divided into 8 sector-tape to 256 bytes.
behind these 256 byte sectors are a tape-2 Total bytes / check byte.

the figure it is not me.

who can tell me the total bill once these 256 bytes show with "Basic"?

I program in PureBasic.

thank you.
Greetings
I give you the C code, maybe you can convert to PureBasic?


/* CRC code shamelessly taken from Pierre Guerrier's AIFF decoder! */
#define kCRCpoly  4129  /* used for binary long division in CRC */

/* CRC polynomial: X^16+X^12+X^5+1 */
unsigned int CRCupdate(unsigned int CRC, unsigned char new)
{
unsigned int aux = CRC ^ (new << 8);
int i;

for(i=0; i<8; i++)
   if (aux & 0x8000)
       aux = (aux <<= 1) ^ kCRCpoly;
     else
       aux <<= 1;

return(aux);
}


this part reads the data and calculates crc and stores it:


                /* reset CRC */
                CRC = 0x0ffff;

                /* calculate CRC for block */
                for (j=0; j<CPC_DATA_CHUNK_SIZE; j++)
                {
                    char ch;

                    ch = pBlockPtr[0];
                    pBlockPtr++;
                    CRC = CRCupdate(CRC, ch);
                }

                /* store CRC inverted */
                pBlockPtr[0] = (CRC>>8)^0x0ff;
                pBlockPtr++;
                pBlockPtr[0] = CRC^0x0ff;
                pBlockPtr++;
            }

My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Powered by SMFPacks Menu Editor Mod