From 0413f345edd99f59fae2209eb70e54ffb71bc6b4 Mon Sep 17 00:00:00 2001 From: hachti Date: Thu, 4 May 2006 12:57:30 +0000 Subject: [PATCH] *** empty log message *** --- pc-tools/ldc/ldc.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/pc-tools/ldc/ldc.c b/pc-tools/ldc/ldc.c index ae9ee51..81fd9e1 100644 --- a/pc-tools/ldc/ldc.c +++ b/pc-tools/ldc/ldc.c @@ -33,6 +33,8 @@ int ignore = 0; int dosplit = 0; int splitnum = 0; int silent = 0; +int read_pos = -5; +int block_pos= -5; /********************************************************/ @@ -214,7 +216,8 @@ datablock *get_block() if (tapemode) tapestart (); do { - ret = read (inputfd, buffer, 1); + read_pos+=ret=read (inputfd, buffer, 1); + #ifdef HARDCORE_DEBUG msgf ("READ : (hex)%02x (bin)%s (dec)%3i (oct)%3o", buffer[0], bin2str (buffer[0], 8), buffer[0], buffer[0]); @@ -234,7 +237,8 @@ datablock *get_block() } } while (*buffer != (unsigned char) CHAR_START); - + + block_pos=read_pos; msg ("get_block(): Blockstart erkannt"); // blk_data = (hw16 *) malloc (MAX_BLOCK_SIZE * sizeof (hw16)); @@ -246,6 +250,7 @@ datablock *get_block() do { complete = 0; ret = read (inputfd, buffer + round, 1); + read_pos+=ret; #ifdef HARDCORE_DEBUG static int lochzahl = 0; char *bin = bin2str (buffer[round], 8); @@ -302,12 +307,13 @@ datablock *get_block() if (checksum_error (blk_data, blk_size)) { - err ("get_block(): Checksummenfehler"); + errf ("get_block(): Checksum error!\nBlock start: %i (0x%x), read address %i (0x%x).", + block_pos,block_pos,read_pos,read_pos); #ifdef CHECKSUM_DUMP dump_data (buffer, 3); - read (inputfd, buffer, 3); + read_pos+=read (inputfd, buffer, 3); dump_data (buffer, 3); #endif @@ -407,6 +413,9 @@ int main (int argc, char **args) } datablock *akt_block; + /* Initialize read position */ + read_pos=0; + while (1) { msg ("********************************************************"); msgf ("Block no. %5i", blk_no++); -- 2.32.0