Logo Search packages:      
Sourcecode: c2n version File versions  Download package

static void encode264Block ( const char *  buf,
unsigned  size 
) [static]

Encode both copies of a data block in Commodore 264 format

Parameters:
buf the data buffer
size length of the data in bytes

data checksum

Definition at line 143 of file encode.c.

References chk, encodeByte(), encodeSync(), Medium, and verbose.

Referenced by encBlock().

{
  unsigned i;
  /** data checksum */
  unsigned chk = 0;

  if (verbose)
    fprintf (stderr, "encoding %u bytes (1st copy)\n", size);

  for (i = 0x89; i > 0x80; )
    encodeByte (i--);

  for (i = 0; i < size; i++) {
    chk ^= buf[i];
    encodeByte (buf[i]);
  }

  encodeByte (chk);
  (*enc_wr) (Medium);
  encodeSync (437);

  if (verbose)
    fprintf (stderr, "encoding %u bytes (2nd copy)\n", size);

  for (i = 9; i; )
    encodeByte (i--);

  for (i = 0; i < size; i++)
    encodeByte (buf[i]);

  encodeByte (chk);
  (*enc_wr) (Medium);
  encodeSync (192);
}


Generated by  Doxygen 1.6.0   Back to index