hdc92x4: Added 9224 emulation; ti99_dsk: Fixed issue with deleted data marks in FM

This commit is contained in:
Michael Zapf 2016-08-14 21:47:12 +02:00
parent 449814b77d
commit bec5bd5022
3 changed files with 479 additions and 316 deletions

File diff suppressed because it is too large Load Diff

View File

@ -381,6 +381,9 @@ protected:
// Read/write logical or physical?
bool m_logical;
// Shall bad sectors be bypassed or shall the command be terminated in error?
bool m_bypass;
// Signals to abort writing
bool m_stopwrite;
@ -445,7 +448,7 @@ protected:
int sector_size();
// Returns the sector header length
int header_length();
virtual int header_length() =0;
// Returns the index of the register for the header field
int register_number(int slot);
@ -453,6 +456,9 @@ protected:
// Is the currently selected drive a floppy drive?
bool using_floppy();
// Was the Bad Sector flag set for the recently read sector header?
bool bad_sector();
// Common subprograms READ ID, VERIFY, and DATA TRANSFER
void read_id(int& cont, bool implied_seek, bool wait_seek_complete);
void verify(int& cont);
@ -488,6 +494,7 @@ public:
protected:
int step_time() override;
int header_length() override;
};
class hdc9234_device : public hdc92x4_device
@ -497,6 +504,7 @@ public:
protected:
int step_time() override;
int header_length() override;
};
#endif

View File

@ -40,7 +40,7 @@
#include <time.h>
#include <assert.h>
#include "emu.h" // osd_printf_verbose
#include "emu.h" // osd_printf_* (in osdcore.h)
#include "imageutl.h"
#include "ti99_dsk.h"
@ -113,17 +113,17 @@ bool ti99_floppy_format::load(io_generic *io, UINT32 form_factor, floppy_image *
int track_size = get_track_size(cell_size, sector_count);
int track_count = file_size / (track_size*heads);
if (TRACE) osd_printf_verbose("ti99_dsk: track count = %d\n", track_count);
if (TRACE) osd_printf_info("ti99_dsk: track count = %d\n", track_count);
if (track_count > maxtrack)
{
osd_printf_verbose("ti99_dsk: Floppy disk has too many tracks for this drive.\n");
osd_printf_error("ti99_dsk: Floppy disk has too many tracks for this drive.\n");
return false;
}
bool doubletracks = (track_count * 2 <= maxtrack);
if (doubletracks) osd_printf_verbose("ti99_dsk: 40-track image in an 80-track drive. On save, image size will double.\n");
if (doubletracks) osd_printf_warning("ti99_dsk: 40-track image in an 80-track drive. On save, image size will double.\n");
// Read the image
for(int head=0; head < heads; head++)
@ -224,7 +224,7 @@ bool ti99_floppy_format::save(io_generic *io, floppy_image *image)
else maxsect = 9;
}
}
if (TRACE) osd_printf_verbose("ti99_dsk: Sectors/track: %d\n", maxsect);
if (TRACE) osd_printf_info("ti99_dsk: Sectors/track: %d\n", maxsect);
// We try different cell sizes until we find a fitting size.
// If this fails, we fall back to a size of 2000 ns
@ -245,12 +245,12 @@ bool ti99_floppy_format::save(io_generic *io, floppy_image *image)
{
if (min_heads()==1)
{
if (TRACE) osd_printf_verbose("ti99_dsk: We don't have a second side and the format allows for single-sided recording.\n");
if (TRACE) osd_printf_info("ti99_dsk: We don't have a second side and the format allows for single-sided recording.\n");
return true;
}
else
{
osd_printf_verbose("ti99_dsk: No second side, but this format requires two-sided recording. Saving empty tracks.\n");
osd_printf_warning("ti99_dsk: No second side, but this format requires two-sided recording. Saving empty tracks.\n");
}
}
}
@ -262,8 +262,8 @@ bool ti99_floppy_format::save(io_generic *io, floppy_image *image)
{
if (head == 0 && track == 0)
{
if (marks >=6) { if (TRACE) osd_printf_verbose("ti99_dsk: Decoding with cell size %d successful.\n", cell_size); }
else osd_printf_verbose("ti99_dsk: No address marks found on track 0. Assuming MFM format.\n");
if (marks >=6) { if (TRACE) osd_printf_info("ti99_dsk: Decoding with cell size %d successful.\n", cell_size); }
else osd_printf_info("ti99_dsk: No address marks found on track 0. Assuming MFM format.\n");
}
}
// Save to the file
@ -299,7 +299,7 @@ void ti99_floppy_format::generate_track_fm(int track, int head, int cell_size, U
if (check_for_address_marks(trackdata, floppy_image::FM)==false)
{
if (head==0 && track==0) osd_printf_verbose("ti99_dsk: Cannot find FM address marks on track %d, head %d; likely broken or unformatted.\n", track, head);
if (head==0 && track==0) osd_printf_warning("ti99_dsk: Cannot find FM address marks on track %d, head %d; likely broken or unformatted.\n", track, head);
return;
}
@ -323,7 +323,8 @@ void ti99_floppy_format::generate_track_fm(int track, int head, int cell_size, U
if (((i-start-30)%334==0) && (i < start + 9*334))
{
// DAM
raw_w(buffer, 16, 0xf56f);
// FB (1111010101101111) = normal data, F8 (1111010101101010)= deleted data
raw_w(buffer, 16, (trackdata[i]==0xf8)? 0xf56a : 0xf56f);
}
else
{
@ -343,7 +344,7 @@ void ti99_floppy_format::generate_track_fm(int track, int head, int cell_size, U
}
if (crc1 != found_crc)
{
osd_printf_verbose("ti99_dsk: Warning: CRC1 does not match (track=%d, head=%d). Found = %04x, calc = %04x\n", track, head, found_crc& 0xffff, crc1& 0xffff);
osd_printf_error("ti99_dsk: Warning: CRC1 does not match (track=%d, head=%d). Found = %04x, calc = %04x\n", track, head, found_crc& 0xffff, crc1& 0xffff);
}
}
else
@ -363,7 +364,7 @@ void ti99_floppy_format::generate_track_fm(int track, int head, int cell_size, U
}
if (crc2 != found_crc)
{
osd_printf_verbose("ti99_dsk: Warning: CRC2 does not match (track=%d, head=%d). Found = %04x, calc = %04x\n", track, head, found_crc& 0xffff, crc2& 0xffff);
osd_printf_error("ti99_dsk: Warning: CRC2 does not match (track=%d, head=%d). Found = %04x, calc = %04x\n", track, head, found_crc& 0xffff, crc2& 0xffff);
}
}
}
@ -391,7 +392,7 @@ void ti99_floppy_format::generate_track_mfm(int track, int head, int cell_size,
if (check_for_address_marks(trackdata, floppy_image::MFM)==false)
{
if (track==0 && head==0) osd_printf_verbose("ti99_dsk: Cannot find MFM address marks on track %d, head %d; likely broken or unformatted.\n", track, head);
if (track==0 && head==0) osd_printf_error("ti99_dsk: Cannot find MFM address marks on track %d, head %d; likely broken or unformatted.\n", track, head);
return;
}
@ -439,7 +440,7 @@ void ti99_floppy_format::generate_track_mfm(int track, int head, int cell_size,
}
if (crc1 != found_crc)
{
osd_printf_verbose("ti99_dsk: Warning: CRC1 does not match (track=%d, head=%d). Found = %04x, calc = %04x\n", track, head, found_crc & 0xffff, crc1& 0xffff);
osd_printf_error("ti99_dsk: Warning: CRC1 does not match (track=%d, head=%d). Found = %04x, calc = %04x\n", track, head, found_crc & 0xffff, crc1& 0xffff);
}
}
else
@ -459,7 +460,7 @@ void ti99_floppy_format::generate_track_mfm(int track, int head, int cell_size,
}
if (crc2 != found_crc)
{
osd_printf_verbose("ti99_dsk: Warning: CRC2 does not match (track=%d, head=%d). Found = %04x, calc = %04x\n", track, head, found_crc& 0xffff, crc2& 0xffff);
osd_printf_error("ti99_dsk: Warning: CRC2 does not match (track=%d, head=%d). Found = %04x, calc = %04x\n", track, head, found_crc& 0xffff, crc2& 0xffff);
}
}
}
@ -735,7 +736,7 @@ int ti99_sdf_format::identify(io_generic *io, UINT32 form_factor)
// as a bad sector map
if ((file_size / SECTOR_SIZE) % 10 == 3)
{
if (TRACE) osd_printf_verbose("ti99_dsk: Stripping map of bad sectors at image end\n");
if (TRACE) osd_printf_info("ti99_dsk: Stripping map of bad sectors at image end\n");
file_size -= SECTOR_SIZE*3;
}
@ -772,15 +773,15 @@ int ti99_sdf_format::identify(io_generic *io, UINT32 form_factor)
// Check from contents
if ((vib.id[0]=='D')&&(vib.id[1]=='S')&&(vib.id[2]=='K'))
{
if (TRACE) osd_printf_verbose("ti99_dsk: Found formatted SDF disk medium\n");
if (TRACE) osd_printf_info("ti99_dsk: Found formatted SDF disk medium\n");
vote = 100;
}
else
{
if (TRACE) osd_printf_verbose("ti99_dsk: No valid VIB found; disk may be unformatted\n");
if (TRACE) osd_printf_info("ti99_dsk: No valid VIB found; disk may be unformatted\n");
}
}
else if (TRACE) osd_printf_verbose("ti99_dsk: Disk image is not a SDF image\n");
else if (TRACE) osd_printf_info("ti99_dsk: Disk image is not a SDF image\n");
return vote;
}
@ -816,7 +817,7 @@ void ti99_sdf_format::determine_sizes(io_generic *io, int& cell_size, int& secto
if (vib.density < 4) cell_size = 2000;
else cell_size = 1000;
}
if (TRACE) osd_printf_verbose("ti99_dsk: VIB says that this disk is %s density with %d sectors per track, %d tracks, and %d heads\n", (cell_size==4000)? "single": ((cell_size==2000)? "double" : "high"), sector_count, vib.tracksperside, heads);
if (TRACE) osd_printf_info("ti99_dsk: VIB says that this disk is %s density with %d sectors per track, %d tracks, and %d heads\n", (cell_size==4000)? "single": ((cell_size==2000)? "double" : "high"), sector_count, vib.tracksperside, heads);
have_vib = true;
}
@ -855,13 +856,13 @@ void ti99_sdf_format::determine_sizes(io_generic *io, int& cell_size, int& secto
{
if (sector_count == 16 && sector_count1 == 18)
{
osd_printf_verbose("ti99_dsk: Warning: Invalid 16-sector format. Assuming 18 sectors.\n");
osd_printf_warning("ti99_dsk: Warning: Invalid 16-sector format. Assuming 18 sectors.\n");
sector_count = 18;
}
else
{
if (heads == 2 && ((cell_size1 != cell_size) || (sector_count1 != sector_count)))
osd_printf_verbose("ti99_dsk: Warning: Disk image size does not correspond with format information in VIB.\n");
osd_printf_warning("ti99_dsk: Warning: Disk image size does not correspond with format information in VIB.\n");
}
}
else