Cleanup, moving stuff out of ibm.h and such. Moved more configuration variables into main. Minor changes for multiplatform.

This commit is contained in:
waltje
2017-11-02 02:28:00 -05:00
parent 0565bf76af
commit b40ea14027
92 changed files with 565 additions and 467 deletions

View File

@@ -9,7 +9,7 @@
* Implementation of the NEC uPD-765 and compatible floppy disk
* controller.
*
* Version: @(#)fdc.c 1.0.6 2017/10/16
* Version: @(#)fdc.c 1.0.7 2017/11/01
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -24,6 +24,7 @@
#include <wchar.h>
#include "../86box.h"
#include "../ibm.h"
#include "../machine/machine.h"
#include "../io.h"
#include "../mem.h"
#include "../rom.h"

View File

@@ -21,7 +21,7 @@
#include <string.h>
#include <wchar.h>
#include "../86box.h"
#include "../ibm.h"
//#include "../ibm.h"
#include "floppy.h"
#include "fdc.h"
#include "fdd.h"

View File

@@ -8,10 +8,11 @@
*
* Implementation of the floppy drive emulation.
*
* Version: @(#)fdd.h 1.0.2 2017/09/03
* Version: @(#)fdd.h 1.0.3 2017/10/01
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
*
* Copyright 2008-2017 Sarah Walker.
* Copyright 2016,2017 Miran Grca.
*/
@@ -22,6 +23,10 @@
#define SEEK_RECALIBRATE -999
#ifdef __cplusplus
extern "C" {
#endif
extern int fdd_swap;
@@ -60,5 +65,9 @@ extern int fdd_get_from_internal_name(char *s);
extern int fdd_track(int drive);
#ifdef __cplusplus
}
#endif
#endif /*EMU_FDD_H*/

View File

@@ -31,7 +31,7 @@
/* ELSE */
#define xmalloc malloc
#include "../86box.h"
#include "../ibm.h"
//#include "../ibm.h"
#include "fdi2raw.h"

View File

@@ -9,7 +9,7 @@
* Generic floppy disk interface that communicates with the
* other handlers.
*
* Version: @(#)floppy.c 1.0.10 2017/10/16
* Version: @(#)floppy.c 1.0.11 2017/11/01
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -23,6 +23,7 @@
#include <wchar.h>
#include "../86box.h"
#include "../ibm.h"
#include "../machine/machine.h"
#include "../mem.h"
#include "../rom.h"
#include "../config.h"

View File

@@ -9,7 +9,7 @@
* Generic floppy disk interface that communicates with the
* other handlers.
*
* Version: @(#)floppy.h 1.0.4 2017/10/15
* Version: @(#)floppy.h 1.0.5 2017/11/01
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -24,26 +24,29 @@
#define FDD_NUM 4
typedef struct
{
void (*seek)(int drive, int track);
void (*readsector)(int drive, int sector, int track, int side, int density, int sector_size);
void (*writesector)(int drive, int sector, int track, int side, int density, int sector_size);
void (*comparesector)(int drive, int sector, int track, int side, int density, int sector_size);
void (*readaddress)(int drive, int side, int density);
void (*format)(int drive, int side, int density, uint8_t fill);
int (*hole)(int drive);
double (*byteperiod)(int drive);
void (*stop)(int drive);
void (*poll)(int drive);
typedef struct {
void (*seek)(int drive, int track);
void (*readsector)(int drive, int sector, int track, int side, int density, int sector_size);
void (*writesector)(int drive, int sector, int track, int side, int density, int sector_size);
void (*comparesector)(int drive, int sector, int track, int side, int density, int sector_size);
void (*readaddress)(int drive, int side, int density);
void (*format)(int drive, int side, int density, uint8_t fill);
int (*hole)(int drive);
double (*byteperiod)(int drive);
void (*stop)(int drive);
void (*poll)(int drive);
} DRIVE;
extern DRIVE drives[FDD_NUM];
extern wchar_t floppyfns[FDD_NUM][512];
extern int driveempty[FDD_NUM];
extern int64_t floppy_poll_time[FDD_NUM];
extern int curdrive;
extern int floppy_time;
extern int64_t floppy_poll_time[FDD_NUM];
extern int64_t floppytime;
extern void floppy_load(int drive, wchar_t *fn);
@@ -84,9 +87,11 @@ extern void fdc_sectorid(uint8_t track, uint8_t side, uint8_t sector,
uint8_t size, uint8_t crc1, uint8_t crc2);
extern void fdc_indexpulse(void);
/*extern int fdc_time;
#if 0
extern int fdc_time;
extern int fdc_ready;
extern int fdc_indexcount;*/
extern int fdc_indexcount;
#endif
extern int motorspin;
extern int64_t motoron[FDD_NUM];

View File

@@ -10,7 +10,7 @@
* data in the form of FM/MFM-encoded transitions) which also
* forms the core of the emulator's floppy disk emulation.
*
* Version: @(#)floppy_86f.c 1.0.9 2017/10/19
* Version: @(#)floppy_86f.c 1.0.10 2017/11/01
*
* Author: Miran Grca, <mgrca8@gmail.com>
* Copyright 2016,2017 Miran Grca.
@@ -1303,7 +1303,7 @@ void d86f_read_sector_id(int drive, int side, int match)
if (d86f[drive].calc_crc.word != d86f[drive].track_crc.word)
{
d86f[drive].id_find.sync_marks = d86f[drive].id_find.bits_obtained = d86f[drive].id_find.bytes_obtained = 0;
printf("ID CRC error: %04X != %04X (%08X)\n", d86f[drive].track_crc.word, d86f[drive].calc_crc.word, d86f[drive].last_sector.dword);
pclog("86F: ID CRC error: %04X != %04X (%08X)\n", d86f[drive].track_crc.word, d86f[drive].calc_crc.word, d86f[drive].last_sector.dword);
if ((d86f[drive].state != STATE_02_READ_ID) && (d86f[drive].state != STATE_0A_READ_ID))
{
d86f[drive].error_condition = 0;
@@ -1495,7 +1495,7 @@ void d86f_read_sector_data(int drive, int side)
if ((d86f[drive].calc_crc.word != d86f[drive].track_crc.word) && (d86f[drive].state != STATE_02_READ_DATA))
{
printf("Data CRC error: %04X != %04X (%08X)\n", d86f[drive].track_crc.word, d86f[drive].calc_crc.word, d86f[drive].last_sector.dword);
pclog("86F: Data CRC error: %04X != %04X (%08X)\n", d86f[drive].track_crc.word, d86f[drive].calc_crc.word, d86f[drive].last_sector.dword);
d86f[drive].data_find.sync_marks = d86f[drive].data_find.bits_obtained = d86f[drive].data_find.bytes_obtained = 0;
d86f[drive].error_condition = 0;
d86f[drive].state = STATE_IDLE;

View File

@@ -19,7 +19,7 @@
#include <stdlib.h>
#include <wchar.h>
#include "../86box.h"
#include "../ibm.h"
//#include "../ibm.h"
#include "../floppy/floppy.h"
#include "floppy_common.h"

View File

@@ -22,7 +22,7 @@
#include <string.h>
#include <wchar.h>
#include "../86box.h"
#include "../ibm.h"
//#include "../ibm.h"
#include "../plat.h"
#include "floppy.h"
#include "floppy_86f.h"

View File

@@ -9,7 +9,7 @@
* Implementation of the raw sector-based floppy image format,
* as well as the Japanese FDI, CopyQM, and FDF formats.
*
* Version: @(#)floppy_img.c 1.0.5 2017/10/16
* Version: @(#)floppy_img.c 1.0.6 2017/11/01
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -674,7 +674,7 @@ void img_load(int drive, wchar_t *fn)
}
}
}
printf("Finished reading CopyQM image data\n");
pclog("Finished reading CopyQM image data\n");
cqm = 1;
img[drive].disk_at_once = 1;

View File

@@ -20,7 +20,7 @@
#include <stdlib.h>
#include <wchar.h>
#include "../86box.h"
#include "../ibm.h"
//#include "../ibm.h"
#include "../plat.h"
#include "floppy.h"
#include "fdc.h"

View File

@@ -43,7 +43,7 @@
#include <stdlib.h>
#include <wchar.h>
#include "../86box.h"
#include "../ibm.h"
//#include "../ibm.h"
#include "../plat.h"
#include "floppy.h"
#include "floppy_td0.h"