mirror of
https://github.com/holub/mame
synced 2025-07-07 19:03:29 +03:00
Fix issues with define of logerror (no whatsnew)
This commit is contained in:
parent
e2a7503880
commit
f7d01e8bf5
@ -1074,7 +1074,7 @@ static floperr_t apple35_2img_decode(floppy_image *floppy, UINT32 *image_format,
|
||||
// even though that's against the .2mg spec
|
||||
if (header.data_length == 0x800c00)
|
||||
{
|
||||
logerror("ap_dsk35: corrected bad-endian data length\n");
|
||||
LOG_FORMATS("ap_dsk35: corrected bad-endian data length\n");
|
||||
header.data_length = 0x0c8000;
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ static FLOPPY_CONSTRUCT( atarist_st_construct )
|
||||
geometry.tracks = tracks;
|
||||
geometry.sectors = sectors;
|
||||
|
||||
if (LOG) logerror("ST Heads %u Tracks %u Sectors %u\n", heads, tracks, sectors);
|
||||
if (LOG) LOG_FORMATS("ST Heads %u Tracks %u Sectors %u\n", heads, tracks, sectors);
|
||||
|
||||
return basicdsk_construct(floppy, &geometry);
|
||||
}
|
||||
|
@ -534,7 +534,7 @@ casserr_t cassette_put_samples(cassette_image *cassette, int channel,
|
||||
|
||||
if (LOG_PUT_SAMPLES)
|
||||
{
|
||||
logerror("cassette_put_samples(): Putting samples TIME=[%2.6g..%2.6g] INDEX=[%i..%i]\n",
|
||||
LOG_FORMATS("cassette_put_samples(): Putting samples TIME=[%2.6g..%2.6g] INDEX=[%i..%i]\n",
|
||||
time_index, time_index + sample_period,
|
||||
(int)ranges.sample_first, (int)ranges.sample_last);
|
||||
}
|
||||
|
@ -14,11 +14,7 @@
|
||||
#include "ioprocs.h"
|
||||
|
||||
#ifndef LOG_FORMATS
|
||||
#define LOG_FORMATS 0
|
||||
#endif
|
||||
|
||||
#ifndef logerror
|
||||
#define logerror if (LOG_FORMATS) printf
|
||||
#define LOG_FORMATS if (0) printf
|
||||
#endif
|
||||
|
||||
/***************************************************************************
|
||||
|
@ -185,17 +185,17 @@ static int cbm_tap_do_work( INT16 **buffer, int length, const UINT8 *data )
|
||||
/* Log .TAP info but only once */
|
||||
if (!(buffer == NULL))
|
||||
{
|
||||
logerror("TAP version : %d\n", version);
|
||||
logerror("Machine type : %d\n", system);
|
||||
logerror("Video standard : %d\n", video_standard);
|
||||
logerror("Tape frequency : %d\n", (tap_frequency) << 3);
|
||||
LOG_FORMATS("TAP version : %d\n", version);
|
||||
LOG_FORMATS("Machine type : %d\n", system);
|
||||
LOG_FORMATS("Video standard : %d\n", video_standard);
|
||||
LOG_FORMATS("Tape frequency : %d\n", (tap_frequency) << 3);
|
||||
}
|
||||
|
||||
|
||||
/* is this a supported version? */
|
||||
if ((version < 0) || (version > 2))
|
||||
{
|
||||
logerror("Unsupported .tap version: %d \n", version);
|
||||
LOG_FORMATS("Unsupported .tap version: %d \n", version);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -285,9 +285,9 @@ static int cbm_tap_do_work( INT16 **buffer, int length, const UINT8 *data )
|
||||
else
|
||||
{
|
||||
j += 1;
|
||||
logerror("Found a 00 byte close to the end of the .tap file.\n");
|
||||
logerror("This is not allowed by the format specs. \n");
|
||||
logerror("Check if your .tap file got corrupted when you created it!\n");
|
||||
LOG_FORMATS("Found a 00 byte close to the end of the .tap file.\n");
|
||||
LOG_FORMATS("This is not allowed by the format specs. \n");
|
||||
LOG_FORMATS("Check if your .tap file got corrupted when you created it!\n");
|
||||
}
|
||||
}
|
||||
else j = 1;
|
||||
|
@ -57,37 +57,37 @@ UINT8 *in_ptr;
|
||||
int bsize=0;
|
||||
|
||||
if ( memcmp( casdata, CSW_HEADER, sizeof(CSW_HEADER) ) ) {
|
||||
logerror( "csw_cas_to_wav_size: cassette image has incompatible header\n" );
|
||||
LOG_FORMATS( "csw_cas_to_wav_size: cassette image has incompatible header\n" );
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (casdata[0x16]!=0x1a) {
|
||||
logerror( "csw_cas_to_wav_size: Terminator Code Not Found\n" );
|
||||
LOG_FORMATS( "csw_cas_to_wav_size: Terminator Code Not Found\n" );
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
MajorRevision=casdata[0x17];
|
||||
MinorRevision=casdata[0x18];
|
||||
|
||||
logerror("Version %d : %d\n",MajorRevision,MinorRevision);
|
||||
LOG_FORMATS("Version %d : %d\n",MajorRevision,MinorRevision);
|
||||
|
||||
if (casdata[0x17]!=2){
|
||||
logerror( "csw_cas_to_wav_size: Unsuported Major Version\n" );
|
||||
LOG_FORMATS( "csw_cas_to_wav_size: Unsuported Major Version\n" );
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
SampleRate=get_leuint32(casdata+0x19);
|
||||
logerror("Sample rate %d\n",SampleRate);
|
||||
LOG_FORMATS("Sample rate %d\n",SampleRate);
|
||||
|
||||
NumberOfPulses=get_leuint32(casdata+0x1d);
|
||||
logerror("Number Of Pulses %d\n",NumberOfPulses);
|
||||
LOG_FORMATS("Number Of Pulses %d\n",NumberOfPulses);
|
||||
|
||||
|
||||
CompressionType=casdata[0x21];
|
||||
Flags=casdata[0x22];
|
||||
HeaderExtensionLength=casdata[0x23];
|
||||
|
||||
logerror("CompressionType %d Flast %d HeaderExtensionLength %d\n",CompressionType,Flags,HeaderExtensionLength);
|
||||
LOG_FORMATS("CompressionType %d Flast %d HeaderExtensionLength %d\n",CompressionType,Flags,HeaderExtensionLength);
|
||||
|
||||
mycaslen=caslen;
|
||||
//from here on down for now I am assuming it is compressed csw file.
|
||||
@ -111,7 +111,7 @@ int bsize=0;
|
||||
|
||||
err = inflateInit( &d_stream );
|
||||
if ( err != Z_OK ) {
|
||||
logerror( "inflateInit2 error: %d\n", err );
|
||||
LOG_FORMATS( "inflateInit2 error: %d\n", err );
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -136,13 +136,13 @@ int bsize=0;
|
||||
while (err==Z_OK);
|
||||
|
||||
if ( err != Z_STREAM_END ) {
|
||||
logerror( "inflate error: %d\n", err );
|
||||
LOG_FORMATS( "inflate error: %d\n", err );
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
err = inflateEnd( &d_stream );
|
||||
if ( err != Z_OK ) {
|
||||
logerror( "inflateEnd error: %d\n", err );
|
||||
LOG_FORMATS( "inflateEnd error: %d\n", err );
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -186,13 +186,13 @@ int bsize=0;
|
||||
int i;
|
||||
|
||||
|
||||
logerror("Length %d\n",length);
|
||||
LOG_FORMATS("Length %d\n",length);
|
||||
|
||||
SampleRate=get_leuint32(bytes+0x19);
|
||||
logerror("Sample rate %d\n",SampleRate);
|
||||
LOG_FORMATS("Sample rate %d\n",SampleRate);
|
||||
|
||||
NumberOfPulses=get_leuint32(bytes+0x1d);
|
||||
logerror("Number Of Pulses %d\n",NumberOfPulses);
|
||||
LOG_FORMATS("Number Of Pulses %d\n",NumberOfPulses);
|
||||
|
||||
CompressionType=bytes[0x21];
|
||||
Flags=bytes[0x22];
|
||||
@ -205,7 +205,7 @@ int i;
|
||||
Bit=100;
|
||||
}
|
||||
|
||||
logerror("CompressionType %d Flast %d HeaderExtensionLength %d\n",CompressionType,Flags,HeaderExtensionLength);
|
||||
LOG_FORMATS("CompressionType %d Flast %d HeaderExtensionLength %d\n",CompressionType,Flags,HeaderExtensionLength);
|
||||
|
||||
|
||||
//from here on down for now I am assuming it is compressed csw file.
|
||||
@ -229,7 +229,7 @@ int i;
|
||||
|
||||
err = inflateInit( &d_stream );
|
||||
if ( err != Z_OK ) {
|
||||
logerror( "inflateInit2 error: %d\n", err );
|
||||
LOG_FORMATS( "inflateInit2 error: %d\n", err );
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -258,13 +258,13 @@ int i;
|
||||
while (err==Z_OK);
|
||||
|
||||
if ( err != Z_STREAM_END ) {
|
||||
logerror( "inflate error: %d\n", err );
|
||||
LOG_FORMATS( "inflate error: %d\n", err );
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
err = inflateEnd( &d_stream );
|
||||
if ( err != Z_OK ) {
|
||||
logerror( "inflateEnd error: %d\n", err );
|
||||
LOG_FORMATS( "inflateEnd error: %d\n", err );
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -280,7 +280,7 @@ static int get_sector_error_code(floppy_image *floppy, int head, int dos_track,
|
||||
|
||||
if (sector_error != ERROR_00)
|
||||
{
|
||||
logerror("D64 error %s head %u track %u sector %u\n", ERROR_CODE[sector_error], head, dos_track, sector);
|
||||
LOG_FORMATS("D64 error %s head %u track %u sector %u\n", ERROR_CODE[sector_error], head, dos_track, sector);
|
||||
}
|
||||
|
||||
return sector_error;
|
||||
@ -707,11 +707,11 @@ FLOPPY_CONSTRUCT( d64_dsk_construct )
|
||||
|
||||
if (LOG)
|
||||
{
|
||||
logerror("D64 size: %04x\n", (UINT32)floppy_image_size(floppy));
|
||||
logerror("D64 heads: %u\n", heads);
|
||||
logerror("D64 tracks: %u\n", dos_tracks);
|
||||
logerror("D64 DOS version: %s\n", DOS_VERSION[dos]);
|
||||
logerror("D64 error codes: %s\n", has_errors ? "yes" : "no");
|
||||
LOG_FORMATS("D64 size: %04x\n", (UINT32)floppy_image_size(floppy));
|
||||
LOG_FORMATS("D64 heads: %u\n", heads);
|
||||
LOG_FORMATS("D64 tracks: %u\n", dos_tracks);
|
||||
LOG_FORMATS("D64 DOS version: %s\n", DOS_VERSION[dos]);
|
||||
LOG_FORMATS("D64 error codes: %s\n", has_errors ? "yes" : "no");
|
||||
}
|
||||
|
||||
/* clear track data offsets */
|
||||
@ -746,8 +746,8 @@ FLOPPY_CONSTRUCT( d64_dsk_construct )
|
||||
|
||||
if (LOG)
|
||||
{
|
||||
logerror("D64 head %u track %u data offset: %04x\n", head, track + 1, tag->track_offset[head][track]);
|
||||
if (has_errors) logerror("D64 head %u track %u error offset: %04x\n", head, track + 1, tag->error_offset[head][track]);
|
||||
LOG_FORMATS("D64 head %u track %u data offset: %04x\n", head, track + 1, tag->track_offset[head][track]);
|
||||
if (has_errors) LOG_FORMATS("D64 head %u track %u error offset: %04x\n", head, track + 1, tag->error_offset[head][track]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -779,8 +779,8 @@ FLOPPY_CONSTRUCT( d64_dsk_construct )
|
||||
|
||||
if (LOG)
|
||||
{
|
||||
logerror("D64 head %u track %.1f data offset: %04x\n", head, get_dos_track(track), tag->track_offset[head][track]);
|
||||
if (has_errors) logerror("D64 head %u track %.1f error offset: %04x\n", head, get_dos_track(track), tag->error_offset[head][track]);
|
||||
LOG_FORMATS("D64 head %u track %.1f data offset: %04x\n", head, get_dos_track(track), tag->track_offset[head][track]);
|
||||
if (has_errors) LOG_FORMATS("D64 head %u track %.1f error offset: %04x\n", head, get_dos_track(track), tag->error_offset[head][track]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -794,13 +794,13 @@ FLOPPY_CONSTRUCT( d64_dsk_construct )
|
||||
{
|
||||
tag->speed_zone[track] = DOS25_SPEED_ZONE[track];
|
||||
|
||||
if (LOG) logerror("D64 track %u speed zone: %u\n", track + 1, tag->speed_zone[track]);
|
||||
if (LOG) LOG_FORMATS("D64 track %u speed zone: %u\n", track + 1, tag->speed_zone[track]);
|
||||
}
|
||||
else
|
||||
{
|
||||
tag->speed_zone[track] = DOS1_SPEED_ZONE[track / 2];
|
||||
|
||||
if (LOG) logerror("D64 track %.1f speed zone: %u\n", get_dos_track(track), tag->speed_zone[track]);
|
||||
if (LOG) LOG_FORMATS("D64 track %.1f speed zone: %u\n", get_dos_track(track), tag->speed_zone[track]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -819,12 +819,12 @@ FLOPPY_CONSTRUCT( d64_dsk_construct )
|
||||
tag->id1 = id[0];
|
||||
tag->id2 = id[1];
|
||||
|
||||
if (LOG) logerror("D64 format ID: %02x%02x\n", id[0], id[1]);
|
||||
if (LOG) LOG_FORMATS("D64 format ID: %02x%02x\n", id[0], id[1]);
|
||||
|
||||
/* read errors */
|
||||
if (tag->has_errors)
|
||||
{
|
||||
if (LOG) logerror("D64 error blocks: %u %u\n", errors_size, track_offset);
|
||||
if (LOG) LOG_FORMATS("D64 error blocks: %u %u\n", errors_size, track_offset);
|
||||
floppy_image_read(floppy, tag->error, track_offset, errors_size);
|
||||
}
|
||||
else
|
||||
|
@ -154,14 +154,14 @@ static UINT32 d88_get_sector_offset(floppy_image* floppy, int head, int track, i
|
||||
floppy_image_read(floppy,sector_hdr,offset,16);
|
||||
if(sector == sector_hdr[2])
|
||||
{
|
||||
logerror("d88_get_sector_offset - track %i, side %i, sector %02x, returns %08x\n",track,head,sector,offset+16);
|
||||
LOG_FORMATS("d88_get_sector_offset - track %i, side %i, sector %02x, returns %08x\n",track,head,sector,offset+16);
|
||||
return offset + 16;
|
||||
}
|
||||
len = (sector_hdr[15] << 8) | sector_hdr[14];
|
||||
len += 16;
|
||||
offset += len;
|
||||
}
|
||||
logerror("d88_get_sector_offset - track %i, side %i, sector %02x, not found\n",track,head,sector);
|
||||
LOG_FORMATS("d88_get_sector_offset - track %i, side %i, sector %02x, not found\n",track,head,sector);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ FLOPPY_CONSTRUCT(dim_dsk_construct)
|
||||
}
|
||||
// TODO: expand on this basic implementation
|
||||
|
||||
logerror("FDD: DIM image loaded - type %i, %i tracks, %i sectors per track, %i bytes per sector\n", format_tmp,tracks, sectors,sectorlen);
|
||||
LOG_FORMATS("FDD: DIM image loaded - type %i, %i tracks, %i sectors per track, %i bytes per sector\n", format_tmp,tracks, sectors,sectorlen);
|
||||
|
||||
memset(&geometry, 0, sizeof(geometry));
|
||||
geometry.heads = heads;
|
||||
|
@ -240,17 +240,17 @@ FLOPPY_CONSTRUCT( fdi_dsk_construct )
|
||||
|
||||
if (LOG)
|
||||
{
|
||||
logerror("FDI creator: %s\n", header.creator);
|
||||
logerror("FDI comment: %s\n", header.comment);
|
||||
logerror("FDI version: %u\n", tag->version);
|
||||
logerror("FDI tracks: %u\n", tag->tracks);
|
||||
logerror("FDI heads: %u\n", tag->heads);
|
||||
logerror("FDI media type: %s\"\n", MEDIA_TYPE[header.type]);
|
||||
logerror("FDI rotation speed: %u\n", header.rotspeed + 128);
|
||||
if (header.flags & FLAGS_WRITE_PROTECTED) logerror("FDI is write protected\n");
|
||||
if (header.flags & FLAGS_INDEX_SYNC) logerror("FDI is index synchronized\n");
|
||||
logerror("FDI media TPI: %u\n", TRACKS_PER_INCH[header.tpi]);
|
||||
logerror("FDI head TPI: %u\n", TRACKS_PER_INCH[header.headwidth]);
|
||||
LOG_FORMATS("FDI creator: %s\n", header.creator);
|
||||
LOG_FORMATS("FDI comment: %s\n", header.comment);
|
||||
LOG_FORMATS("FDI version: %u\n", tag->version);
|
||||
LOG_FORMATS("FDI tracks: %u\n", tag->tracks);
|
||||
LOG_FORMATS("FDI heads: %u\n", tag->heads);
|
||||
LOG_FORMATS("FDI media type: %s\"\n", MEDIA_TYPE[header.type]);
|
||||
LOG_FORMATS("FDI rotation speed: %u\n", header.rotspeed + 128);
|
||||
if (header.flags & FLAGS_WRITE_PROTECTED) LOG_FORMATS("FDI is write protected\n");
|
||||
if (header.flags & FLAGS_INDEX_SYNC) LOG_FORMATS("FDI is index synchronized\n");
|
||||
LOG_FORMATS("FDI media TPI: %u\n", TRACKS_PER_INCH[header.tpi]);
|
||||
LOG_FORMATS("FDI head TPI: %u\n", TRACKS_PER_INCH[header.headwidth]);
|
||||
}
|
||||
|
||||
/* find track offsets */
|
||||
@ -261,7 +261,7 @@ FLOPPY_CONSTRUCT( fdi_dsk_construct )
|
||||
UINT8 type = header.track[track].type;
|
||||
int size = header.track[track].size * 256;
|
||||
|
||||
if (LOG) logerror("FDI track %u type %02x size %u offset %u\n", track, type, size, offset);
|
||||
if (LOG) LOG_FORMATS("FDI track %u type %02x size %u offset %u\n", track, type, size, offset);
|
||||
|
||||
tag->track_offset[track] = offset;
|
||||
tag->track_type[track] = type;
|
||||
|
@ -14,12 +14,9 @@
|
||||
#include "opresolv.h"
|
||||
|
||||
#ifndef LOG_FORMATS
|
||||
#define LOG_FORMATS 0
|
||||
#define LOG_FORMATS if (0) printf
|
||||
#endif
|
||||
|
||||
#ifndef logerror
|
||||
#define logerror if (LOG_FORMATS) printf
|
||||
#endif
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
|
@ -154,7 +154,7 @@ static floperr_t g64_read_track(floppy_image *floppy, int head, int track, UINT6
|
||||
memset(buffer, 0, buflen);
|
||||
}
|
||||
|
||||
if (LOG) logerror("G64 track %.1f length %u\n", get_dos_track(track), track_length);
|
||||
if (LOG) LOG_FORMATS("G64 track %.1f length %u\n", get_dos_track(track), track_length);
|
||||
|
||||
return FLOPPY_ERROR_SUCCESS;
|
||||
}
|
||||
@ -247,16 +247,16 @@ FLOPPY_CONSTRUCT( g64_dsk_construct )
|
||||
/* version */
|
||||
floppy_image_read(floppy, header, pos, 0x0c); pos += 0xc;
|
||||
tag->version = header[8];
|
||||
if (LOG) logerror("G64 version: %u\n", tag->version);
|
||||
if (LOG) LOG_FORMATS("G64 version: %u\n", tag->version);
|
||||
|
||||
/* number of half tracks */
|
||||
tag->heads = 1;
|
||||
tag->tracks = header[9];
|
||||
if (LOG) logerror("G64 tracks: %u\n", tag->tracks);
|
||||
if (LOG) LOG_FORMATS("G64 tracks: %u\n", tag->tracks);
|
||||
|
||||
/* size of each stored half track */
|
||||
tag->track_size = (header[11] << 8) | header[10];
|
||||
if (LOG) logerror("G64 track size: %04x\n", tag->track_size);
|
||||
if (LOG) LOG_FORMATS("G64 track size: %04x\n", tag->track_size);
|
||||
|
||||
/* data offsets */
|
||||
for (i = 0; i < tag->tracks; i++)
|
||||
@ -264,7 +264,7 @@ FLOPPY_CONSTRUCT( g64_dsk_construct )
|
||||
floppy_image_read(floppy, header, pos, 4); pos += 4;
|
||||
tag->track_offset[i] = (header[3] << 24) | (header[2] << 16) | (header[1] << 8) | header[0];
|
||||
|
||||
if (LOG) logerror("G64 track %.1f data offset: %04x\n", get_dos_track(i), tag->track_offset[i]);
|
||||
if (LOG) LOG_FORMATS("G64 track %.1f data offset: %04x\n", get_dos_track(i), tag->track_offset[i]);
|
||||
}
|
||||
|
||||
/* speed zone offsets */
|
||||
@ -276,9 +276,9 @@ FLOPPY_CONSTRUCT( g64_dsk_construct )
|
||||
if (LOG)
|
||||
{
|
||||
if (tag->speed_zone_offset[i] < 4) {
|
||||
logerror("G64 track %.1f speed zone: %u\n", get_dos_track(i), tag->speed_zone_offset[i]);
|
||||
LOG_FORMATS("G64 track %.1f speed zone: %u\n", get_dos_track(i), tag->speed_zone_offset[i]);
|
||||
} else {
|
||||
logerror("G64 track %.1f speed zone offset: %04x\n", get_dos_track(i), tag->speed_zone_offset[i]);
|
||||
LOG_FORMATS("G64 track %.1f speed zone offset: %04x\n", get_dos_track(i), tag->speed_zone_offset[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
#endif
|
||||
|
||||
//#define LOG(N,M,A)
|
||||
// if(VERBOSE>=N){ if( M )logerror("%11.6f: %-24s",machine.time().as_double(), (const char*)M ); logerror A; }
|
||||
// if(VERBOSE>=N){ if( M )LOG_FORMATS("%11.6f: %-24s",machine.time().as_double(), (const char*)M ); LOG_FORMATS A; }
|
||||
|
||||
#define LOG(N,M,A) \
|
||||
if(VERBOSE>=N){ if( M )printf("%-24s",(const char*)M ); printf A; }
|
||||
|
@ -240,7 +240,7 @@ static int oric_cassette_calculate_size_in_samples(const UINT8 *bytes, int lengt
|
||||
{
|
||||
if (data==ORIC_SYNC_BYTE)
|
||||
{
|
||||
logerror("found sync byte!\n");
|
||||
LOG_FORMATS("found sync byte!\n");
|
||||
/* found first sync byte */
|
||||
oric.cassette_state = ORIC_CASSETTE_GOT_SYNC_BYTE;
|
||||
}
|
||||
@ -254,7 +254,7 @@ static int oric_cassette_calculate_size_in_samples(const UINT8 *bytes, int lengt
|
||||
/* 0.25 second pause */
|
||||
count += oric_seconds_to_samples(0.25);
|
||||
|
||||
logerror("found end of sync bytes!\n");
|
||||
LOG_FORMATS("found end of sync bytes!\n");
|
||||
|
||||
/* oric writes approx 512 bytes */
|
||||
/* found end of sync bytes */
|
||||
@ -265,7 +265,7 @@ static int oric_cassette_calculate_size_in_samples(const UINT8 *bytes, int lengt
|
||||
|
||||
if (data==0x024)
|
||||
{
|
||||
//logerror("reading header!\n");
|
||||
//LOG_FORMATS("reading header!\n");
|
||||
count+=oric_calculate_byte_size_in_samples(0x024);
|
||||
|
||||
oric.cassette_state = ORIC_CASSETTE_READ_HEADER;
|
||||
@ -285,7 +285,7 @@ static int oric_cassette_calculate_size_in_samples(const UINT8 *bytes, int lengt
|
||||
|
||||
if (oric.data_count==oric.data_length)
|
||||
{
|
||||
//logerror("finished reading header!\n");
|
||||
//LOG_FORMATS("finished reading header!\n");
|
||||
oric.cassette_state = ORIC_CASSETTE_READ_FILENAME;
|
||||
}
|
||||
}
|
||||
@ -299,7 +299,7 @@ static int oric_cassette_calculate_size_in_samples(const UINT8 *bytes, int lengt
|
||||
if (data==0)
|
||||
{
|
||||
UINT16 end, start;
|
||||
logerror("got end of filename\n");
|
||||
LOG_FORMATS("got end of filename\n");
|
||||
|
||||
/* 100 1 bits to seperate header from data */
|
||||
for (i=0; i<100; i++)
|
||||
@ -326,7 +326,7 @@ static int oric_cassette_calculate_size_in_samples(const UINT8 *bytes, int lengt
|
||||
|
||||
if (oric.data_count==oric.data_length)
|
||||
{
|
||||
logerror("finished writing data!\n");
|
||||
LOG_FORMATS("finished writing data!\n");
|
||||
oric.cassette_state = ORIC_CASSETTE_SEARCHING_FOR_SYNC_BYTE;
|
||||
}
|
||||
}
|
||||
@ -380,7 +380,7 @@ static int oric_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
|
||||
{
|
||||
if (data==ORIC_SYNC_BYTE)
|
||||
{
|
||||
logerror("found sync byte!\n");
|
||||
LOG_FORMATS("found sync byte!\n");
|
||||
/* found first sync byte */
|
||||
oric.cassette_state = ORIC_CASSETTE_GOT_SYNC_BYTE;
|
||||
}
|
||||
@ -394,7 +394,7 @@ static int oric_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
|
||||
/* 0.25 second pause */
|
||||
p = oric_fill_pause(p, oric_seconds_to_samples(0.25));
|
||||
|
||||
logerror("found end of sync bytes!\n");
|
||||
LOG_FORMATS("found end of sync bytes!\n");
|
||||
/* found end of sync bytes */
|
||||
for (i=0; i<ORIC_LEADER_LENGTH; i++)
|
||||
{
|
||||
@ -403,7 +403,7 @@ static int oric_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
|
||||
|
||||
if (data==0x024)
|
||||
{
|
||||
//logerror("reading header!\n");
|
||||
//LOG_FORMATS("reading header!\n");
|
||||
p = oric_output_byte(p,data);
|
||||
oric.cassette_state = ORIC_CASSETTE_READ_HEADER;
|
||||
oric.data_count = 0;
|
||||
@ -421,7 +421,7 @@ static int oric_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
|
||||
|
||||
if (oric.data_count==oric.data_length)
|
||||
{
|
||||
//logerror("finished reading header!\n");
|
||||
//LOG_FORMATS("finished reading header!\n");
|
||||
oric.cassette_state = ORIC_CASSETTE_READ_FILENAME;
|
||||
}
|
||||
}
|
||||
@ -435,7 +435,7 @@ static int oric_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
|
||||
if (data==0)
|
||||
{
|
||||
UINT16 end, start;
|
||||
logerror("got end of filename\n");
|
||||
LOG_FORMATS("got end of filename\n");
|
||||
|
||||
/* oric includes a small delay, but I don't see
|
||||
it being 1 bits */
|
||||
@ -463,7 +463,7 @@ static int oric_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
|
||||
|
||||
if (oric.data_count==oric.data_length)
|
||||
{
|
||||
logerror("finished writing data!\n");
|
||||
LOG_FORMATS("finished writing data!\n");
|
||||
oric.cassette_state = ORIC_CASSETTE_SEARCHING_FOR_SYNC_BYTE;
|
||||
}
|
||||
}
|
||||
|
@ -90,15 +90,15 @@ static int primo_cassette_calculate_size_in_samples(const UINT8 *bytes, int leng
|
||||
while (i < length)
|
||||
{
|
||||
size_in_samples += PRIMO_PAUSE_LENGTH;
|
||||
logerror ("Samples (pause): %d\n", size_in_samples);
|
||||
LOG_FORMATS ("Samples (pause): %d\n", size_in_samples);
|
||||
|
||||
size_in_samples += PRIMO_FILE_PILOT_LENGTH;
|
||||
logerror ("Samples (file pilot): %d\n", size_in_samples);
|
||||
LOG_FORMATS ("Samples (file pilot): %d\n", size_in_samples);
|
||||
|
||||
/* file size with header */
|
||||
file_size = *(b+1) + *(b+2)*256;
|
||||
b += 3;
|
||||
logerror ("File size (with header): %d\n", file_size);
|
||||
LOG_FORMATS ("File size (with header): %d\n", file_size);
|
||||
|
||||
/* b is now set on the first data byte of file
|
||||
it means first byte (type) of block */
|
||||
@ -107,7 +107,7 @@ static int primo_cassette_calculate_size_in_samples(const UINT8 *bytes, int leng
|
||||
while (j < file_size-3)
|
||||
{
|
||||
size_in_samples += PRIMO_BLOCK_PILOT_LENGTH;
|
||||
logerror ("Samples (block pilot): %d\n", size_in_samples);
|
||||
LOG_FORMATS ("Samples (block pilot): %d\n", size_in_samples);
|
||||
|
||||
/* block size without header but including CRC byte */
|
||||
block_size = *(b+1) + *(b+2)*256;
|
||||
@ -121,9 +121,9 @@ static int primo_cassette_calculate_size_in_samples(const UINT8 *bytes, int leng
|
||||
size_in_samples += number_of_1 * PRIMO_BIT_1_LENGTH;
|
||||
size_in_samples += number_of_0 * PRIMO_BIT_0_LENGTH;
|
||||
|
||||
logerror ("Samples (block data): %d\n", size_in_samples);
|
||||
LOG_FORMATS ("Samples (block data): %d\n", size_in_samples);
|
||||
|
||||
logerror ("\tBlock size: %d\n", block_size);
|
||||
LOG_FORMATS ("\tBlock size: %d\n", block_size);
|
||||
|
||||
b += block_size;
|
||||
|
||||
@ -149,27 +149,27 @@ static int primo_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
|
||||
UINT32 file_size = 0;
|
||||
UINT16 block_size = 0;
|
||||
|
||||
logerror ("Image size: %d\n", length);
|
||||
LOG_FORMATS ("Image size: %d\n", length);
|
||||
|
||||
while (i < primo_tape_image_length)
|
||||
{
|
||||
logerror ("Beginning Primo file\n");
|
||||
LOG_FORMATS ("Beginning Primo file\n");
|
||||
/* pause */
|
||||
p = primo_emit_level (p, PRIMO_PAUSE_LENGTH, PRIMO_WAVEENTRY_ZERO);
|
||||
|
||||
logerror ("Samples (pause): %ld\n", (long int)(p-buffer));
|
||||
LOG_FORMATS ("Samples (pause): %ld\n", (long int)(p-buffer));
|
||||
|
||||
/* file pilot */
|
||||
for (k=0; k<512; k++)
|
||||
p = primo_output_byte (p, 0xaa);
|
||||
|
||||
logerror ("Samples (file pilot): %ld\n", (long int)(p-buffer));
|
||||
LOG_FORMATS ("Samples (file pilot): %ld\n", (long int)(p-buffer));
|
||||
|
||||
/* file size with header */
|
||||
file_size = *(b+1) + *(b+2)*256;
|
||||
b += 3;
|
||||
|
||||
logerror ("File size: %d\n", file_size);
|
||||
LOG_FORMATS ("File size: %d\n", file_size);
|
||||
|
||||
/* b is now set on the first data byte of file
|
||||
it means first byte (block type) of block header */
|
||||
@ -184,7 +184,7 @@ static int primo_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
|
||||
for (k=0; k<3; k++)
|
||||
p = primo_output_byte (p, 0xd3);
|
||||
|
||||
logerror ("Samples (block pilot): %ld\n", (long int)(p-buffer));
|
||||
LOG_FORMATS ("Samples (block pilot): %ld\n", (long int)(p-buffer));
|
||||
|
||||
/* block size without header but including CRC byte */
|
||||
block_size = *(b+1) + *(b+2)*256;
|
||||
@ -193,7 +193,7 @@ static int primo_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
|
||||
for (k=0; k<block_size; k++)
|
||||
p = primo_output_byte (p, *(b+k));
|
||||
|
||||
logerror ("Samples (block data): %ld\n", (long int)(p-buffer));
|
||||
LOG_FORMATS ("Samples (block data): %ld\n", (long int)(p-buffer));
|
||||
|
||||
b += block_size;
|
||||
|
||||
@ -202,13 +202,13 @@ static int primo_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
|
||||
j += block_size+3;
|
||||
}
|
||||
|
||||
logerror ("Primo file finished\n");
|
||||
logerror ("i = %d\n", i);
|
||||
LOG_FORMATS ("Primo file finished\n");
|
||||
LOG_FORMATS ("i = %d\n", i);
|
||||
i += file_size;
|
||||
logerror ("i = %d\n", i);
|
||||
LOG_FORMATS ("i = %d\n", i);
|
||||
}
|
||||
|
||||
logerror ("End of fill_wave/n");
|
||||
LOG_FORMATS ("End of fill_wave/n");
|
||||
|
||||
return p - buffer;
|
||||
}
|
||||
|
@ -331,10 +331,10 @@ static int ti99_sdf_guess_geometry(floppy_image *floppy, UINT64 size,
|
||||
&& (geometry->density <= 4) && (totsecs >= 2) && (! memcmp(vib.id, "DSK", 3))
|
||||
&& (file_size == totsecs*256))
|
||||
{
|
||||
logerror("SDF/VIB consistent; tracks = %d, heads = %d, sectors = %d\n", geometry->tracksperside, geometry->sides, geometry->secspertrack);
|
||||
LOG_FORMATS("SDF/VIB consistent; tracks = %d, heads = %d, sectors = %d\n", geometry->tracksperside, geometry->sides, geometry->secspertrack);
|
||||
return 100;
|
||||
}
|
||||
logerror("SDF/VIB not consistent; guessing format\n");
|
||||
LOG_FORMATS("SDF/VIB not consistent; guessing format\n");
|
||||
|
||||
// So that was not consistent. We guess the size from the file size
|
||||
// and assume that the VIB did not contain reliable data. For the
|
||||
@ -409,11 +409,11 @@ static int ti99_sdf_guess_geometry(floppy_image *floppy, UINT64 size,
|
||||
break;
|
||||
|
||||
default:
|
||||
logerror("Unrecognized disk image geometry\n");
|
||||
LOG_FORMATS("Unrecognized disk image geometry\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
logerror("SDF geometry guess: tracks = %d, heads = %d, sectors = %d\n", geometry->tracksperside, geometry->sides, geometry->secspertrack);
|
||||
LOG_FORMATS("SDF geometry guess: tracks = %d, heads = %d, sectors = %d\n", geometry->tracksperside, geometry->sides, geometry->secspertrack);
|
||||
return 100;
|
||||
}
|
||||
|
||||
@ -663,7 +663,7 @@ static floperr_t ti99_sdf_write_track(floppy_image *floppy, int head, int track,
|
||||
if (current_pos==TI99DSK_BLOCKNOTFOUND)
|
||||
{
|
||||
/* If neither, forget about this process completely. */
|
||||
logerror("Cannot find lead-in for track %d, head %d.\n", track, head);
|
||||
LOG_FORMATS("Cannot find lead-in for track %d, head %d.\n", track, head);
|
||||
return FLOPPY_ERROR_INVALIDIMAGE;
|
||||
}
|
||||
gap1 = 6;
|
||||
@ -682,7 +682,7 @@ static floperr_t ti99_sdf_write_track(floppy_image *floppy, int head, int track,
|
||||
{
|
||||
/* Forget about the rest. */
|
||||
if (found) break; /* we were already successful, so all ok */
|
||||
logerror("Cannot find gap1 for track %d, head %d.\n", track, head);
|
||||
LOG_FORMATS("Cannot find gap1 for track %d, head %d.\n", track, head);
|
||||
return FLOPPY_ERROR_INVALIDIMAGE;
|
||||
}
|
||||
found = TRUE;
|
||||
@ -703,7 +703,7 @@ static floperr_t ti99_sdf_write_track(floppy_image *floppy, int head, int track,
|
||||
new_pos = find_block(track_image, current_pos, buflen, 0x00, gap2);
|
||||
if (current_pos==TI99DSK_BLOCKNOTFOUND)
|
||||
{
|
||||
logerror("Cannot find gap2 for track %d, head %d.\n", imgtrack, head);
|
||||
LOG_FORMATS("Cannot find gap2 for track %d, head %d.\n", imgtrack, head);
|
||||
return FLOPPY_ERROR_INVALIDIMAGE;
|
||||
}
|
||||
else
|
||||
@ -719,7 +719,7 @@ static floperr_t ti99_sdf_write_track(floppy_image *floppy, int head, int track,
|
||||
current_pos += SECTOR_SIZE;
|
||||
}
|
||||
else
|
||||
logerror("DAM not found. Not writing write sector %d\n", sector);
|
||||
LOG_FORMATS("DAM not found. Not writing write sector %d\n", sector);
|
||||
/* else not found, ignore this sector. */
|
||||
}
|
||||
}
|
||||
@ -727,7 +727,7 @@ static floperr_t ti99_sdf_write_track(floppy_image *floppy, int head, int track,
|
||||
{
|
||||
// else the sector head data do not match the
|
||||
// current track and head. Ignore the sector.
|
||||
logerror("Wrong track: wtrack=%d, imgtrack=%d, whead=%d, imghead=%d\n",wtrack,imgtrack, whead,head);
|
||||
LOG_FORMATS("Wrong track: wtrack=%d, imgtrack=%d, whead=%d, imghead=%d\n",wtrack,imgtrack, whead,head);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -924,7 +924,7 @@ static FLOPPY_IDENTIFY(ti99_sdf_identify)
|
||||
UINT64 size;
|
||||
size = floppy_image_size(floppy);
|
||||
*vote = ti99_sdf_guess_geometry(floppy, size, NULL);
|
||||
logerror("SDF voting %d\n", *vote);
|
||||
LOG_FORMATS("SDF voting %d\n", *vote);
|
||||
return FLOPPY_ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
@ -936,7 +936,7 @@ static FLOPPY_CONSTRUCT(ti99_sdf_construct)
|
||||
struct ti99dsk_geometry geometry;
|
||||
struct FloppyCallbacks *callbacks;
|
||||
struct ti99dsk_tag *tag;
|
||||
logerror("Reading image as SDF\n");
|
||||
LOG_FORMATS("Reading image as SDF\n");
|
||||
|
||||
if (params)
|
||||
{
|
||||
@ -1116,7 +1116,7 @@ static floperr_t determine_offset(int format, UINT8 *track, int *offset)
|
||||
current_pos = find_block(track, 0, 50, 0x00, 22);
|
||||
if (current_pos==TI99DSK_BLOCKNOTFOUND)
|
||||
{
|
||||
logerror("Lead-in not found\n");
|
||||
LOG_FORMATS("Lead-in not found\n");
|
||||
retval = FLOPPY_ERROR_SEEKERROR;
|
||||
}
|
||||
else
|
||||
@ -1132,7 +1132,7 @@ static floperr_t determine_offset(int format, UINT8 *track, int *offset)
|
||||
}
|
||||
else
|
||||
{
|
||||
logerror("IDAM or DAM not found\n");
|
||||
LOG_FORMATS("IDAM or DAM not found\n");
|
||||
retval = FLOPPY_ERROR_SEEKERROR;
|
||||
}
|
||||
}
|
||||
@ -1144,7 +1144,7 @@ static floperr_t determine_offset(int format, UINT8 *track, int *offset)
|
||||
int track_start = find_block(track, 0, 100, 0x4e, 40);
|
||||
if (track_start==TI99DSK_BLOCKNOTFOUND)
|
||||
{
|
||||
logerror("Lead-in not found\n");
|
||||
LOG_FORMATS("Lead-in not found\n");
|
||||
retval = FLOPPY_ERROR_SEEKERROR;
|
||||
}
|
||||
else
|
||||
@ -1153,7 +1153,7 @@ static floperr_t determine_offset(int format, UINT8 *track, int *offset)
|
||||
current_pos = find_block(track, track_start, track_start+10, 0x00, 10);
|
||||
if (current_pos==TI99DSK_BLOCKNOTFOUND)
|
||||
{
|
||||
logerror("Pre-gap not found\n");
|
||||
LOG_FORMATS("Pre-gap not found\n");
|
||||
retval = FLOPPY_ERROR_SEEKERROR;
|
||||
}
|
||||
else
|
||||
@ -1170,7 +1170,7 @@ static floperr_t determine_offset(int format, UINT8 *track, int *offset)
|
||||
}
|
||||
else
|
||||
{
|
||||
logerror("Sync/IDAM/DAM not found\n");
|
||||
LOG_FORMATS("Sync/IDAM/DAM not found\n");
|
||||
retval = FLOPPY_ERROR_SEEKERROR;
|
||||
}
|
||||
}
|
||||
@ -1378,7 +1378,7 @@ static floperr_t ti99_tdf_seek_sector_in_track(floppy_image *floppy, int head, i
|
||||
{
|
||||
if (determine_offset(tag->format, track_data, &tag->first_idam)==FLOPPY_ERROR_SEEKERROR)
|
||||
{
|
||||
logerror("could not determine offset\n");
|
||||
LOG_FORMATS("could not determine offset\n");
|
||||
return FLOPPY_ERROR_SEEKERROR;
|
||||
}
|
||||
}
|
||||
@ -1408,7 +1408,7 @@ static floperr_t ti99_tdf_seek_sector_in_track(floppy_image *floppy, int head, i
|
||||
break;
|
||||
}
|
||||
}
|
||||
logerror("Sector not found.\n");
|
||||
LOG_FORMATS("Sector not found.\n");
|
||||
return FLOPPY_ERROR_SEEKERROR;
|
||||
}
|
||||
|
||||
@ -1764,7 +1764,7 @@ static int ti99_tdf_guess_geometry(floppy_image *floppy, UINT64 size,
|
||||
/* MFM failed. */
|
||||
if (determine_offset(TI99_FM, track_data, &first_idam)==FLOPPY_ERROR_SEEKERROR)
|
||||
{
|
||||
logerror("IDAM not found. Unformatted disk.\n");
|
||||
LOG_FORMATS("IDAM not found. Unformatted disk.\n");
|
||||
|
||||
// FM failed as well. Disk is not formatted. We assume
|
||||
// a format that fits into the space provided by the file.
|
||||
@ -1774,7 +1774,7 @@ static int ti99_tdf_guess_geometry(floppy_image *floppy, UINT64 size,
|
||||
free(track_data);
|
||||
if (size < 130120 || size > 2078720)
|
||||
{
|
||||
logerror("Unknown format size: %d\n", (int)size);
|
||||
LOG_FORMATS("Unknown format size: %d\n", (int)size);
|
||||
return 0;
|
||||
}
|
||||
if (size >= 130120 && size < 260240)
|
||||
@ -1888,7 +1888,7 @@ static int ti99_tdf_guess_geometry(floppy_image *floppy, UINT64 size,
|
||||
state = 0;
|
||||
}
|
||||
}
|
||||
logerror("Determined %d sectors\n", idamcnt);
|
||||
LOG_FORMATS("Determined %d sectors\n", idamcnt);
|
||||
|
||||
// Now calculate the geometry
|
||||
// The track size, in theory, may change due to reformatting,
|
||||
@ -1912,7 +1912,7 @@ static int ti99_tdf_guess_geometry(floppy_image *floppy, UINT64 size,
|
||||
if (determine_offset(format, track_data, &first_idam)==FLOPPY_ERROR_SEEKERROR)
|
||||
{
|
||||
/* error ... what now? */
|
||||
logerror("Error when reading last track. Image broken.\n");
|
||||
LOG_FORMATS("Error when reading last track. Image broken.\n");
|
||||
free(track_data);
|
||||
return 50;
|
||||
}
|
||||
@ -1930,7 +1930,7 @@ static int ti99_tdf_guess_geometry(floppy_image *floppy, UINT64 size,
|
||||
}
|
||||
else
|
||||
{
|
||||
logerror("Error: Last track has invalid first IDAM: head = %d.\n", track_data[first_idam+2]);
|
||||
LOG_FORMATS("Error: Last track has invalid first IDAM: head = %d.\n", track_data[first_idam+2]);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1942,7 +1942,7 @@ static int ti99_tdf_guess_geometry(floppy_image *floppy, UINT64 size,
|
||||
|
||||
if (geometry->tracksperside < 35 || geometry->tracksperside > 80)
|
||||
{
|
||||
logerror("Unsupported track count: %d\n", geometry->tracksperside);
|
||||
LOG_FORMATS("Unsupported track count: %d\n", geometry->tracksperside);
|
||||
free(track_data);
|
||||
return 0;
|
||||
}
|
||||
@ -1956,7 +1956,7 @@ static FLOPPY_IDENTIFY(ti99_tdf_identify)
|
||||
UINT64 size;
|
||||
size = floppy_image_size(floppy);
|
||||
*vote = ti99_tdf_guess_geometry(floppy, size, NULL);
|
||||
logerror("TDF voting %d\n", *vote);
|
||||
LOG_FORMATS("TDF voting %d\n", *vote);
|
||||
return FLOPPY_ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
@ -1965,7 +1965,7 @@ static FLOPPY_CONSTRUCT(ti99_tdf_construct)
|
||||
struct ti99dsk_geometry geometry;
|
||||
struct FloppyCallbacks *callbacks;
|
||||
struct ti99dsk_tag *tag;
|
||||
logerror("Reading image as TDF\n");
|
||||
LOG_FORMATS("Reading image as TDF\n");
|
||||
if (params)
|
||||
{
|
||||
/* create */
|
||||
|
@ -222,7 +222,7 @@ static int tzx_cas_handle_block( INT16 **buffer, const UINT8 *bytes, int pause,
|
||||
int size = 0;
|
||||
|
||||
/* Uncomment this to include into error.log a fully detailed analysis of each block */
|
||||
// logerror("tzx_cas_block_size: pilot_length = %d, pilot_samples = %d, sync1_samples = %d, sync2_samples = %d, bit0_samples = %d, bit1_samples = %d\n", pilot_length, pilot_samples, sync1_samples, sync2_samples, bit0_samples, bit1_samples);
|
||||
// LOG_FORMATS("tzx_cas_block_size: pilot_length = %d, pilot_samples = %d, sync1_samples = %d, sync2_samples = %d, bit0_samples = %d, bit1_samples = %d\n", pilot_length, pilot_samples, sync1_samples, sync2_samples, bit0_samples, bit1_samples);
|
||||
|
||||
/* PILOT */
|
||||
for ( ; pilot_length > 0; pilot_length--)
|
||||
@ -279,9 +279,9 @@ static int tzx_cas_handle_block( INT16 **buffer, const UINT8 *bytes, int pause,
|
||||
|
||||
static void ascii_block_common_log( const char *block_type_string, UINT8 block_type )
|
||||
{
|
||||
logerror("%s (type %02x) encountered.\n", block_type_string, block_type);
|
||||
logerror("This block contains info on the .tzx file you are loading.\n");
|
||||
logerror("Please include the following info in your bug reports, if the image has issue in M.E.S.S.\n");
|
||||
LOG_FORMATS("%s (type %02x) encountered.\n", block_type_string, block_type);
|
||||
LOG_FORMATS("This block contains info on the .tzx file you are loading.\n");
|
||||
LOG_FORMATS("Please include the following info in your bug reports, if the image has issue in M.E.S.S.\n");
|
||||
}
|
||||
|
||||
static const char *const archive_ident[] =
|
||||
@ -324,7 +324,7 @@ static int tzx_cas_do_work( INT16 **buffer )
|
||||
UINT8 block_type = cur_block[0];
|
||||
|
||||
/* Uncomment this to include into error.log a list of the types each block */
|
||||
// logerror("tzx_cas_fill_wave: block %d, block_type %02x\n", current_block, block_type);
|
||||
// LOG_FORMATS("tzx_cas_fill_wave: block %d, block_type %02x\n", current_block, block_type);
|
||||
|
||||
switch (block_type)
|
||||
{
|
||||
@ -386,28 +386,28 @@ static int tzx_cas_do_work( INT16 **buffer )
|
||||
case 0x17: /* C64 Turbo Tape Data Block */ // Deprecated in TZX 1.20
|
||||
case 0x34: /* Emulation Info */ // Deprecated in TZX 1.20
|
||||
case 0x40: /* Snapshot Block */ // Deprecated in TZX 1.20
|
||||
logerror("Deprecated block type (%02x) encountered.\n", block_type);
|
||||
logerror("Please look for an updated .tzx file.\n");
|
||||
LOG_FORMATS("Deprecated block type (%02x) encountered.\n", block_type);
|
||||
LOG_FORMATS("Please look for an updated .tzx file.\n");
|
||||
current_block++;
|
||||
break;
|
||||
case 0x30: /* Text Description */
|
||||
ascii_block_common_log("Text Description Block", block_type);
|
||||
for (data_size = 0; data_size < cur_block[1]; data_size++)
|
||||
logerror("%c", cur_block[2 + data_size]);
|
||||
logerror("\n");
|
||||
LOG_FORMATS("%c", cur_block[2 + data_size]);
|
||||
LOG_FORMATS("\n");
|
||||
current_block++;
|
||||
break;
|
||||
case 0x31: /* Message Block */
|
||||
ascii_block_common_log("Message Block", block_type);
|
||||
logerror("Expected duration of the message display: %02x\n", cur_block[1]);
|
||||
logerror("Message: \n");
|
||||
LOG_FORMATS("Expected duration of the message display: %02x\n", cur_block[1]);
|
||||
LOG_FORMATS("Message: \n");
|
||||
for (data_size = 0; data_size < cur_block[2]; data_size++)
|
||||
{
|
||||
logerror("%c", cur_block[3 + data_size]);
|
||||
LOG_FORMATS("%c", cur_block[3 + data_size]);
|
||||
if (cur_block[3 + data_size] == 0x0d)
|
||||
logerror("\n");
|
||||
LOG_FORMATS("\n");
|
||||
}
|
||||
logerror("\n");
|
||||
LOG_FORMATS("\n");
|
||||
current_block++;
|
||||
break;
|
||||
case 0x32: /* Archive Info */
|
||||
@ -417,29 +417,29 @@ static int tzx_cas_do_work( INT16 **buffer )
|
||||
for (data_size = 0; data_size < cur_block[3]; data_size++) // data_size = number of text blocks, in this case
|
||||
{
|
||||
if (cur_block[4 + text_size] < 0x09) {
|
||||
logerror("%s: \n", archive_ident[cur_block[4 + text_size]]);
|
||||
LOG_FORMATS("%s: \n", archive_ident[cur_block[4 + text_size]]);
|
||||
}
|
||||
else {
|
||||
logerror("Comment(s): \n");
|
||||
LOG_FORMATS("Comment(s): \n");
|
||||
}
|
||||
|
||||
for (i = 0; i < cur_block[4 + text_size + 1]; i++)
|
||||
{
|
||||
logerror("%c", cur_block[4 + text_size + 2 + i]);
|
||||
LOG_FORMATS("%c", cur_block[4 + text_size + 2 + i]);
|
||||
}
|
||||
text_size += 2 + i;
|
||||
}
|
||||
logerror("\n");
|
||||
LOG_FORMATS("\n");
|
||||
if (text_size != total_size)
|
||||
logerror("Malformed Archive Info Block (Text length different from the declared one).\n Please verify your tape image.\n");
|
||||
LOG_FORMATS("Malformed Archive Info Block (Text length different from the declared one).\n Please verify your tape image.\n");
|
||||
current_block++;
|
||||
break;
|
||||
case 0x33: /* Hardware Type */
|
||||
ascii_block_common_log("Hardware Type Block", block_type);
|
||||
for (data_size = 0; data_size < cur_block[1]; data_size++) // data_size = number of hardware blocks, in this case
|
||||
{
|
||||
logerror("Hardware Type %02x - Hardware ID %02x - ", cur_block[2 + data_size * 3], cur_block[2 + data_size * 3 + 1]);
|
||||
logerror("%s \n ", hw_info[cur_block[2 + data_size * 3 + 2]]);
|
||||
LOG_FORMATS("Hardware Type %02x - Hardware ID %02x - ", cur_block[2 + data_size * 3], cur_block[2 + data_size * 3 + 1]);
|
||||
LOG_FORMATS("%s \n ", hw_info[cur_block[2 + data_size * 3 + 2]]);
|
||||
}
|
||||
current_block++;
|
||||
break;
|
||||
@ -447,18 +447,18 @@ static int tzx_cas_do_work( INT16 **buffer )
|
||||
ascii_block_common_log("Custom Info Block", block_type);
|
||||
for (data_size = 0; data_size < 10; data_size++)
|
||||
{
|
||||
logerror("%c", cur_block[1 + data_size]);
|
||||
LOG_FORMATS("%c", cur_block[1 + data_size]);
|
||||
}
|
||||
logerror(":\n");
|
||||
LOG_FORMATS(":\n");
|
||||
text_size = cur_block[11] + (cur_block[12] << 8) + (cur_block[13] << 16) + (cur_block[14] << 24);
|
||||
for (data_size = 0; data_size < text_size; data_size++)
|
||||
logerror("%c", cur_block[15 + data_size]);
|
||||
logerror("\n");
|
||||
LOG_FORMATS("%c", cur_block[15 + data_size]);
|
||||
LOG_FORMATS("\n");
|
||||
current_block++;
|
||||
break;
|
||||
case 0x5A: /* "Glue" Block */
|
||||
logerror("Glue Block (type %02x) encountered.\n", block_type);
|
||||
logerror("Please use a .tzx handling utility to split the merged tape files.\n");
|
||||
LOG_FORMATS("Glue Block (type %02x) encountered.\n", block_type);
|
||||
LOG_FORMATS("Please use a .tzx handling utility to split the merged tape files.\n");
|
||||
current_block++;
|
||||
break;
|
||||
case 0x15: /* Direct Recording */
|
||||
@ -475,7 +475,7 @@ static int tzx_cas_do_work( INT16 **buffer )
|
||||
case 0x2A: /* Stop Tape if in 48K Mode */
|
||||
case 0x2B: /* Set signal level */
|
||||
default:
|
||||
logerror("Unsupported block type (%02x) encountered.\n", block_type);
|
||||
LOG_FORMATS("Unsupported block type (%02x) encountered.\n", block_type);
|
||||
current_block++;
|
||||
break;
|
||||
}
|
||||
@ -490,31 +490,31 @@ static int tzx_cas_to_wav_size( const UINT8 *casdata, int caslen )
|
||||
/* Header size plus major and minor version number */
|
||||
if (caslen < 10)
|
||||
{
|
||||
logerror("tzx_cas_to_wav_size: cassette image too small\n");
|
||||
LOG_FORMATS("tzx_cas_to_wav_size: cassette image too small\n");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* Check for correct header */
|
||||
if (memcmp(casdata, TZX_HEADER, sizeof(TZX_HEADER)))
|
||||
{
|
||||
logerror("tzx_cas_to_wav_size: cassette image has incompatible header\n");
|
||||
LOG_FORMATS("tzx_cas_to_wav_size: cassette image has incompatible header\n");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* Check major version number in header */
|
||||
if (casdata[0x08] > SUPPORTED_VERSION_MAJOR)
|
||||
{
|
||||
logerror("tzx_cas_to_wav_size: unsupported version\n");
|
||||
LOG_FORMATS("tzx_cas_to_wav_size: unsupported version\n");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
tzx_cas_get_blocks(casdata, caslen);
|
||||
|
||||
logerror("tzx_cas_to_wav_size: %d blocks found\n", block_count);
|
||||
LOG_FORMATS("tzx_cas_to_wav_size: %d blocks found\n", block_count);
|
||||
|
||||
if (block_count == 0)
|
||||
{
|
||||
logerror("tzx_cas_to_wav_size: no blocks found!\n");
|
||||
LOG_FORMATS("tzx_cas_to_wav_size: no blocks found!\n");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -554,10 +554,10 @@ static int tap_cas_to_wav_size( const UINT8 *casdata, int caslen )
|
||||
int data_size = p[0] + (p[1] << 8);
|
||||
int pilot_length = (p[2] == 0x00) ? 8064 : 3220; /* TZX specification */
|
||||
// int pilot_length = (p[2] == 0x00) ? 8063 : 3223; /* worldofspectrum */
|
||||
logerror("tap_cas_to_wav_size: Handling TAP block containing 0x%X bytes", data_size);
|
||||
LOG_FORMATS("tap_cas_to_wav_size: Handling TAP block containing 0x%X bytes", data_size);
|
||||
p += 2;
|
||||
size += tzx_cas_handle_block(NULL, p, 1000, data_size, 2168, pilot_length, 667, 735, 855, 1710, 8);
|
||||
logerror(", total size is now: %d\n", size);
|
||||
LOG_FORMATS(", total size is now: %d\n", size);
|
||||
p += data_size;
|
||||
}
|
||||
return size;
|
||||
@ -573,7 +573,7 @@ static int tap_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes )
|
||||
int data_size = bytes[0] + (bytes[1] << 8);
|
||||
int pilot_length = (bytes[2] == 0x00) ? 8064 : 3220; /* TZX specification */
|
||||
// int pilot_length = (bytes[2] == 0x00) ? 8063 : 3223; /* worldofspectrum */
|
||||
logerror("tap_cas_fill_wave: Handling TAP block containing 0x%X bytes\n", data_size);
|
||||
LOG_FORMATS("tap_cas_fill_wave: Handling TAP block containing 0x%X bytes\n", data_size);
|
||||
bytes += 2;
|
||||
size += tzx_cas_handle_block(&p, bytes, 1000, data_size, 2168, pilot_length, 667, 735, 855, 1710, 8);
|
||||
bytes += data_size;
|
||||
|
@ -126,17 +126,17 @@ static int uef_cas_to_wav_size( const UINT8 *casdata, int caslen ) {
|
||||
|
||||
err = inflateInit2( &d_stream, -MAX_WBITS );
|
||||
if ( err != Z_OK ) {
|
||||
logerror( "inflateInit2 error: %d\n", err );
|
||||
LOG_FORMATS( "inflateInit2 error: %d\n", err );
|
||||
goto cleanup;
|
||||
}
|
||||
err = inflate( &d_stream, Z_NO_FLUSH );
|
||||
if ( err != Z_STREAM_END && err != Z_OK ) {
|
||||
logerror( "inflate error: %d\n", err );
|
||||
LOG_FORMATS( "inflate error: %d\n", err );
|
||||
goto cleanup;
|
||||
}
|
||||
err = inflateEnd( &d_stream );
|
||||
if ( err != Z_OK ) {
|
||||
logerror( "inflateEnd error: %d\n", err );
|
||||
LOG_FORMATS( "inflateEnd error: %d\n", err );
|
||||
goto cleanup;
|
||||
}
|
||||
caslen = inflate_size;
|
||||
@ -144,15 +144,15 @@ static int uef_cas_to_wav_size( const UINT8 *casdata, int caslen ) {
|
||||
}
|
||||
|
||||
if ( caslen < 18 ) {
|
||||
logerror( "uef_cas_to_wav_size: cassette image too small\n" );
|
||||
LOG_FORMATS( "uef_cas_to_wav_size: cassette image too small\n" );
|
||||
goto cleanup;
|
||||
}
|
||||
if ( memcmp( casdata, UEF_HEADER, sizeof(UEF_HEADER) ) ) {
|
||||
logerror( "uef_cas_to_wav_size: cassette image has incompatible header\n" );
|
||||
LOG_FORMATS( "uef_cas_to_wav_size: cassette image has incompatible header\n" );
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
logerror( "UEF: Determinig tape size\n" );
|
||||
LOG_FORMATS( "UEF: Determinig tape size\n" );
|
||||
size = 0;
|
||||
pos = sizeof(UEF_HEADER) + 2;
|
||||
while( pos < caslen ) {
|
||||
@ -167,20 +167,20 @@ static int uef_cas_to_wav_size( const UINT8 *casdata, int caslen ) {
|
||||
break;
|
||||
case 0x0101: /* multiplexed data block */
|
||||
case 0x0103:
|
||||
logerror( "Unsupported chunk type: %04x\n", chunk_type );
|
||||
LOG_FORMATS( "Unsupported chunk type: %04x\n", chunk_type );
|
||||
break;
|
||||
case 0x0102: /* explicit tape data block */
|
||||
size += ( ( chunk_length * 10 ) - casdata[pos] ) * 4;
|
||||
break;
|
||||
case 0x0104:
|
||||
logerror( "Unsupported chunk type: %04x\n", chunk_type );
|
||||
LOG_FORMATS( "Unsupported chunk type: %04x\n", chunk_type );
|
||||
break;
|
||||
case 0x0110:
|
||||
baud_length = ( casdata[pos+1] << 8 ) | casdata[pos];
|
||||
size += baud_length * 2;
|
||||
break;
|
||||
case 0x0111:
|
||||
logerror( "Unsupported chunk type: %04x\n", chunk_type );
|
||||
LOG_FORMATS( "Unsupported chunk type: %04x\n", chunk_type );
|
||||
break;
|
||||
case 0x0112:
|
||||
baud_length = ( casdata[pos+1] << 8 ) | casdata[pos];
|
||||
@ -193,7 +193,7 @@ static int uef_cas_to_wav_size( const UINT8 *casdata, int caslen ) {
|
||||
case 0x0114:
|
||||
case 0x0115:
|
||||
case 0x0120:
|
||||
logerror( "Unsupported chunk type: %04x\n", chunk_type );
|
||||
LOG_FORMATS( "Unsupported chunk type: %04x\n", chunk_type );
|
||||
break;
|
||||
}
|
||||
pos += chunk_length;
|
||||
@ -259,7 +259,7 @@ static int uef_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) {
|
||||
break;
|
||||
case 0x0101: /* multiplexed data block */
|
||||
case 0x0103:
|
||||
logerror( "Unsupported chunk type: %04x\n", chunk_type );
|
||||
LOG_FORMATS( "Unsupported chunk type: %04x\n", chunk_type );
|
||||
break;
|
||||
case 0x0102: /* explicit tape data block */
|
||||
j = ( chunk_length * 10 ) - bytes[pos];
|
||||
|
@ -50,12 +50,12 @@ static int x1_handle_tap(INT16* buffer, const UINT8* casdata)
|
||||
|
||||
if(memcmp(casdata, "TAPE",4)) // header check
|
||||
{
|
||||
logerror("TAP: image is not a 'new' format TAP image\n");
|
||||
LOG_FORMATS("TAP: image is not a 'new' format TAP image\n");
|
||||
return -1;
|
||||
}
|
||||
if(samplerate != 8000)
|
||||
{
|
||||
logerror("TAP: images that are not 8000Hz are not yet supported\n");
|
||||
LOG_FORMATS("TAP: images that are not 8000Hz are not yet supported\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user