The FDC READ TRACK command should now operate properly.
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include "x87.h"
|
||||
#include "mem.h"
|
||||
#include "cpu.h"
|
||||
#include "disc.h"
|
||||
#include "fdc.h"
|
||||
#include "timer.h"
|
||||
|
||||
|
@@ -8,6 +8,7 @@
|
||||
#include "mem.h"
|
||||
#include "codegen.h"
|
||||
#include "cpu.h"
|
||||
#include "disc.h"
|
||||
#include "fdc.h"
|
||||
#include "timer.h"
|
||||
|
||||
|
15
src/disc.h
15
src/disc.h
@@ -184,3 +184,18 @@ void null_set_sector(int drive, int side, uint8_t c, uint8_t h, uint8_t r, uint8
|
||||
uint32_t null_index_hole_pos(int drive, int side);
|
||||
|
||||
uint32_t common_get_raw_size(int drive, int side);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t c;
|
||||
uint8_t h;
|
||||
uint8_t r;
|
||||
uint8_t n;
|
||||
} sector_id_fields_t;
|
||||
|
||||
typedef union
|
||||
{
|
||||
uint32_t dword;
|
||||
uint8_t byte_array[4];
|
||||
sector_id_fields_t id;
|
||||
} sector_id_t;
|
||||
|
@@ -89,21 +89,6 @@ enum
|
||||
|
||||
static uint16_t CRCTable[256];
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t c;
|
||||
uint8_t h;
|
||||
uint8_t r;
|
||||
uint8_t n;
|
||||
} sector_id_fields_t;
|
||||
|
||||
typedef union
|
||||
{
|
||||
uint32_t dword;
|
||||
uint8_t byte_array[4];
|
||||
sector_id_fields_t id;
|
||||
} sector_id_t;
|
||||
|
||||
typedef struct __attribute__((packed))
|
||||
{
|
||||
uint8_t buffer[10];
|
||||
@@ -1394,6 +1379,17 @@ void d86f_read_sector_id(int drive, int side, int match)
|
||||
{
|
||||
// pclog("ID read (%02X)\n", d86f[drive].state);
|
||||
d86f_handler[drive].set_sector(drive, side, d86f[drive].last_sector.id.c, d86f[drive].last_sector.id.h, d86f[drive].last_sector.id.r, d86f[drive].last_sector.id.n);
|
||||
if (d86f[drive].state == STATE_02_READ_ID)
|
||||
{
|
||||
/* READ TRACK command, we need some special handling here. */
|
||||
if (d86f[drive].last_sector.dword != fdc_get_read_track_sector().dword)
|
||||
{
|
||||
d86f[drive].error_condition |= 4; /* Mark that the sector ID is not the one expected by the FDC. */
|
||||
/* Make sure we use the sector size from the FDC. */
|
||||
d86f[drive].last_sector.id.n = fdc_get_read_track_sector().id.n;
|
||||
}
|
||||
/* If the two ID's are identical, then we do not need to do anything regarding the sector size. */
|
||||
}
|
||||
d86f[drive].state++;
|
||||
}
|
||||
else
|
||||
|
@@ -2,10 +2,10 @@
|
||||
see COPYING for more details
|
||||
*/
|
||||
#include "ibm.h"
|
||||
#include "fdc.h"
|
||||
#include "fdd.h"
|
||||
#include "disc.h"
|
||||
#include "disc_imd.h"
|
||||
#include "fdc.h"
|
||||
#include "fdd.h"
|
||||
|
||||
#include <malloc.h>
|
||||
|
||||
|
@@ -2,10 +2,10 @@
|
||||
see COPYING for more details
|
||||
*/
|
||||
#include "ibm.h"
|
||||
#include "fdc.h"
|
||||
#include "fdd.h"
|
||||
#include "disc.h"
|
||||
#include "disc_img.h"
|
||||
#include "fdc.h"
|
||||
#include "fdd.h"
|
||||
|
||||
static struct
|
||||
{
|
||||
|
@@ -15,10 +15,10 @@
|
||||
*/
|
||||
|
||||
#include "ibm.h"
|
||||
#include "fdc.h"
|
||||
#include "fdd.h"
|
||||
#include "disc.h"
|
||||
#include "disc_td0.h"
|
||||
#include "fdc.h"
|
||||
#include "fdd.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
@@ -3,6 +3,7 @@
|
||||
*/
|
||||
#include "ibm.h"
|
||||
|
||||
#include "disc.h"
|
||||
#include "dma.h"
|
||||
#include "fdc.h"
|
||||
#include "io.h"
|
||||
|
13
src/fdc.c
13
src/fdc.c
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "disc.h"
|
||||
#include "dma.h"
|
||||
#include "fdc.h"
|
||||
#include "fdd.h"
|
||||
#include "io.h"
|
||||
#include "pic.h"
|
||||
@@ -94,6 +95,8 @@ typedef struct FDC
|
||||
|
||||
int sc;
|
||||
int satisfying_sectors;
|
||||
|
||||
sector_id_t read_track_sector;
|
||||
} FDC;
|
||||
|
||||
static FDC fdc;
|
||||
@@ -124,6 +127,11 @@ void fdc_reset()
|
||||
// pclog("Reset FDC\n");
|
||||
}
|
||||
|
||||
sector_id_t fdc_get_read_track_sector()
|
||||
{
|
||||
return fdc.read_track_sector;
|
||||
}
|
||||
|
||||
int fdc_get_compare_condition()
|
||||
{
|
||||
switch (discint)
|
||||
@@ -836,6 +844,10 @@ bad_command:
|
||||
fdc.eot[fdc.drive] = fdc.params[5];
|
||||
fdc.gap = fdc.params[6];
|
||||
fdc.dtl = fdc.params[7];
|
||||
fdc.read_track_sector.id.c = fdc.params[1];
|
||||
fdc.read_track_sector.id.h = fdc.params[2];
|
||||
fdc.read_track_sector.id.r = 1;
|
||||
fdc.read_track_sector.id.n = fdc.params[4];
|
||||
if (fdc.config & 0x40)
|
||||
{
|
||||
if (fdc.params[1] != fdc.track[fdc.drive])
|
||||
@@ -1281,6 +1293,7 @@ void fdc_callback()
|
||||
case 2: /*Read track*/
|
||||
readflash = 1;
|
||||
fdc.eot[fdc.drive]--;
|
||||
fdc.read_track_sector.id.r++;
|
||||
// pclog("Read a track callback, eot=%i\n", fdc.eot[fdc.drive]);
|
||||
if (!fdc.eot[fdc.drive] || fdc.tc)
|
||||
{
|
||||
|
@@ -31,6 +31,7 @@ void fdc_update_densel_force(int densel_force);
|
||||
void fdc_update_drvrate(int drive, int drvrate);
|
||||
void fdc_update_drv2en(int drv2en);
|
||||
|
||||
sector_id_t fdc_get_read_track_sector();
|
||||
int fdc_get_compare_condition();
|
||||
int fdc_is_deleted();
|
||||
int fdc_is_sk();
|
||||
|
@@ -3,6 +3,7 @@
|
||||
*/
|
||||
#include "ibm.h"
|
||||
|
||||
#include "disc.h"
|
||||
#include "fdc.h"
|
||||
#include "fdd.h"
|
||||
#include "io.h"
|
||||
|
@@ -8,6 +8,7 @@
|
||||
|
||||
#include "ibm.h"
|
||||
|
||||
#include "disc.h"
|
||||
#include "fdc.h"
|
||||
#include "fdd.h"
|
||||
#include "ide.h"
|
||||
|
@@ -14,6 +14,7 @@
|
||||
#include "amstrad.h"
|
||||
#include "compaq.h"
|
||||
#include "device.h"
|
||||
#include "disc.h"
|
||||
#include "dma.h"
|
||||
#include "fdc.h"
|
||||
#include "fdc37c665.h"
|
||||
|
@@ -8,6 +8,7 @@
|
||||
|
||||
#include "ibm.h"
|
||||
|
||||
#include "disc.h"
|
||||
#include "fdc.h"
|
||||
#include "fdd.h"
|
||||
#include "io.h"
|
||||
|
@@ -9,6 +9,7 @@
|
||||
#include "ibm.h"
|
||||
#include "ide.h"
|
||||
|
||||
#include "disc.h"
|
||||
#include "fdc.h"
|
||||
#include "fdd.h"
|
||||
#include "io.h"
|
||||
|
@@ -41,6 +41,7 @@ COM2 :
|
||||
|
||||
#include "ibm.h"
|
||||
|
||||
#include "disc.h"
|
||||
#include "fdc.h"
|
||||
#include "io.h"
|
||||
#include "lpt.h"
|
||||
|
@@ -2,6 +2,7 @@
|
||||
see COPYING for more details
|
||||
*/
|
||||
#include "ibm.h"
|
||||
#include "disc.h"
|
||||
#include "fdc.h"
|
||||
#include "io.h"
|
||||
#include "mem.h"
|
||||
|
Reference in New Issue
Block a user