int ignore = 0;
int dosplit = 0;
int splitnum = 0;
+int silent = 0;
+int read_pos = -5;
+int block_pos= -5;
/********************************************************/
void say (char *string)
{
- printf ("%s\n", string);
+ if (!silent) printf ("%s\n", string);
}
void sayf (char *format, ...)
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]);
}
} while (*buffer != (unsigned char) CHAR_START);
-
+
+ block_pos=read_pos;
msg ("get_block(): Blockstart erkannt");
// blk_data = (hw16 *) malloc (MAX_BLOCK_SIZE * sizeof (hw16));
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);
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
//msgf ("Action %c, Arg dazu:%s", action, parm);
switch (action) {
case 'I':
- ignore++;
+ ignore=1;
break;
case 't':
- tapemode++;
+ tapemode=1;
break;
case 'S':
- splitnum++;
+ splitnum=1;
case 's':
- dosplit++;
+ dosplit=1;
break;
+ case 'l':
+ silent=1;
+ break;
default:
say ("Usage:\n");
sayf ("%s [-t] [-S] [-n] [-I] [filename]", args[0]);
sayf (" -S Split library tape into separate numbered files");
sayf (" -s same as -S but no numbering");
sayf (" -I Ignore errors");
+ sayf (" -l be silent");
sayf ("");
exit (1);
break;
}
datablock *akt_block;
+ /* Initialize read position */
+ read_pos=0;
+
while (1) {
msg ("********************************************************");
msgf ("Block no. %5i", blk_no++);