Problem in bas2tap and sync bytes

Anything related to the tools Tap2Wav, Tap2CD, Tap2Dsk, Sedoric Disc Manager, Tape Header Creator, WriteDsk, and generaly speaking tools related to the management of Oric data files and devices.
Post Reply
Godzil
Squad Leader
Posts: 756
Joined: Sat May 21, 2011 7:21 pm
Location: Between UK and France
Contact:

Problem in bas2tap and sync bytes

Post by Godzil » Sat Apr 26, 2014 12:33 pm

Hi there,

It seems that bas2tap is unable to handle basic tape that was not generated by himself (or to be precise, that use more than three 0x16 byte for the synchronisation)

Oricutron (or may I say, the Oric ROM?) use 4bytes and bas2tap is unable to decode it.

The current version use hardcoded position :

Code: Select all

  if (ptr_buffer[0]!=0x16 || ptr_buffer[3]!=0x24) 
  { 
    ShowError("Not an Oric file");
  }
  if (ptr_buffer[6]) 
  { 
    ShowError("Not a BASIC file"); 
  }
  i=13;
So I made a simple patch to allow any number ≥ 3 of 0x16 before the 0x24:

Code: Select all

  i = 0;
  /* Get in sync with the header, number of 0x16 can't be determined.. */
  if (ptr_buffer[i] != 0x16)
  {
      ShowError("Not an Oric file [Byte 0 is not 0x16]");
  }
  while(ptr_buffer[++i] == 0x16);
  if (i < 3)
  {
      ShowError("Not an Oric file [Less than 3 0x16]");
  }
  if (ptr_buffer[i] != 0x24)
  {
      ShowError("Not an Oric file [0x16 stream is not followed by 0x24]");
  }
  
  /* Now we are "synchronized" */
  if  (ptr_buffer[i+3])
  { 
    ShowError("Not a BASIC file"); 
  }
  i += 10;

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests