2017-05-30 03:38:38 +02:00
|
|
|
/*
|
2019-12-05 21:36:28 +01:00
|
|
|
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
|
|
|
|
* running old operating systems and software designed for IBM
|
|
|
|
|
* PC systems and compatibles from 1981 through fairly recent
|
|
|
|
|
* system designs based on the PCI bus.
|
2017-05-30 03:38:38 +02:00
|
|
|
*
|
2019-12-05 21:36:28 +01:00
|
|
|
* This file is part of the 86Box distribution.
|
2017-05-30 03:38:38 +02:00
|
|
|
*
|
|
|
|
|
* Implementation of the 86F floppy image format (stores the
|
|
|
|
|
* data in the form of FM/MFM-encoded transitions) which also
|
|
|
|
|
* forms the core of the emulator's floppy disk emulation.
|
|
|
|
|
*
|
2020-03-25 00:46:02 +02:00
|
|
|
*
|
2017-05-30 03:38:38 +02:00
|
|
|
*
|
2019-11-08 22:00:29 +01:00
|
|
|
* Authors: Miran Grca, <mgrca8@gmail.com>
|
|
|
|
|
* Fred N. van Kempen, <decwiz@yahoo.com>
|
2018-03-19 01:02:04 +01:00
|
|
|
*
|
2019-11-08 22:00:29 +01:00
|
|
|
* Copyright 2016-2019 Miran Grca.
|
|
|
|
|
* Copyright 2018,2019 Fred N. van Kempen.
|
2017-05-30 03:38:38 +02:00
|
|
|
*/
|
2016-11-02 22:39:07 +01:00
|
|
|
#include <stdint.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <string.h>
|
2017-09-25 04:31:20 -04:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <stdarg.h>
|
2016-11-02 22:39:07 +01:00
|
|
|
#include <assert.h>
|
2017-05-05 22:36:10 +02:00
|
|
|
#include <wchar.h>
|
2018-01-19 15:39:13 +01:00
|
|
|
#define HAVE_STDARG_H
|
2020-03-29 14:24:42 +02:00
|
|
|
#include <86box/86box.h>
|
|
|
|
|
#include <86box/timer.h>
|
|
|
|
|
#include <86box/dma.h>
|
|
|
|
|
#include <86box/nvr.h>
|
|
|
|
|
#include <86box/random.h>
|
|
|
|
|
#include <86box/plat.h>
|
|
|
|
|
#include <86box/ui.h>
|
|
|
|
|
#include <86box/fdd.h>
|
|
|
|
|
#include <86box/fdc.h>
|
|
|
|
|
#include <86box/fdd_86f.h>
|
2018-05-21 19:04:05 +02:00
|
|
|
#ifdef D86F_COMPRESS
|
2020-03-29 14:24:42 +02:00
|
|
|
#include <lzf.h>
|
2018-05-21 19:04:05 +02:00
|
|
|
#endif
|
2018-03-19 01:02:04 +01:00
|
|
|
|
2017-09-04 01:52:29 -04:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
/*
|
|
|
|
|
* Let's give this some more logic:
|
|
|
|
|
*
|
|
|
|
|
* Bits 4,3 = Read/write (0 = read, 1 = write, 2 = scan, 3 = verify)
|
|
|
|
|
* Bits 6,5 = Sector/track (0 = ID, 1 = sector, 2 = deleted sector, 3 = track)
|
|
|
|
|
* Bit 7 = State type (0 = idle states, 1 = active states)
|
|
|
|
|
*/
|
|
|
|
|
enum {
|
|
|
|
|
/* 0 ?? ?? ??? */
|
|
|
|
|
STATE_IDLE = 0x00,
|
|
|
|
|
STATE_SECTOR_NOT_FOUND,
|
|
|
|
|
|
|
|
|
|
/* 1 00 00 ??? */
|
|
|
|
|
STATE_0A_FIND_ID = 0x80, /* READ SECTOR ID */
|
|
|
|
|
STATE_0A_READ_ID,
|
|
|
|
|
|
|
|
|
|
/* 1 01 00 ??? */
|
|
|
|
|
STATE_06_FIND_ID = 0xA0, /* READ DATA */
|
|
|
|
|
STATE_06_READ_ID,
|
|
|
|
|
STATE_06_FIND_DATA,
|
|
|
|
|
STATE_06_READ_DATA,
|
|
|
|
|
|
|
|
|
|
/* 1 01 01 ??? */
|
|
|
|
|
STATE_05_FIND_ID = 0xA8, /* WRITE DATA */
|
|
|
|
|
STATE_05_READ_ID,
|
|
|
|
|
STATE_05_FIND_DATA,
|
|
|
|
|
STATE_05_WRITE_DATA,
|
|
|
|
|
|
|
|
|
|
/* 1 01 10 ??? */
|
|
|
|
|
STATE_11_FIND_ID = 0xB0, /* SCAN EQUAL,SCAN LOW/EQUAL,SCAN HIGH/EQUAL */
|
|
|
|
|
STATE_11_READ_ID,
|
|
|
|
|
STATE_11_FIND_DATA,
|
|
|
|
|
STATE_11_SCAN_DATA,
|
|
|
|
|
|
|
|
|
|
/* 1 01 11 ??? */
|
|
|
|
|
STATE_16_FIND_ID = 0xB8, /* VERIFY */
|
|
|
|
|
STATE_16_READ_ID,
|
|
|
|
|
STATE_16_FIND_DATA,
|
|
|
|
|
STATE_16_VERIFY_DATA,
|
|
|
|
|
|
|
|
|
|
/* 1 10 00 ??? */
|
|
|
|
|
STATE_0C_FIND_ID = 0xC0, /* READ DELETED DATA */
|
|
|
|
|
STATE_0C_READ_ID,
|
|
|
|
|
STATE_0C_FIND_DATA,
|
|
|
|
|
STATE_0C_READ_DATA,
|
|
|
|
|
|
|
|
|
|
/* 1 10 01 ??? */
|
|
|
|
|
STATE_09_FIND_ID = 0xC8, /* WRITE DELETED DATA */
|
|
|
|
|
STATE_09_READ_ID,
|
|
|
|
|
STATE_09_FIND_DATA,
|
|
|
|
|
STATE_09_WRITE_DATA,
|
|
|
|
|
|
|
|
|
|
/* 1 11 00 ??? */
|
|
|
|
|
STATE_02_SPIN_TO_INDEX = 0xE0, /* READ TRACK */
|
|
|
|
|
STATE_02_FIND_ID,
|
|
|
|
|
STATE_02_READ_ID,
|
|
|
|
|
STATE_02_FIND_DATA,
|
|
|
|
|
STATE_02_READ_DATA,
|
|
|
|
|
|
|
|
|
|
/* 1 11 01 ??? */
|
|
|
|
|
STATE_0D_SPIN_TO_INDEX = 0xE8, /* FORMAT TRACK */
|
|
|
|
|
STATE_0D_FORMAT_TRACK,
|
|
|
|
|
};
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
enum {
|
|
|
|
|
FMT_PRETRK_GAP0,
|
|
|
|
|
FMT_PRETRK_SYNC,
|
|
|
|
|
FMT_PRETRK_IAM,
|
|
|
|
|
FMT_PRETRK_GAP1,
|
|
|
|
|
|
|
|
|
|
FMT_SECTOR_ID_SYNC,
|
|
|
|
|
FMT_SECTOR_IDAM,
|
|
|
|
|
FMT_SECTOR_ID,
|
|
|
|
|
FMT_SECTOR_ID_CRC,
|
|
|
|
|
FMT_SECTOR_GAP2,
|
|
|
|
|
FMT_SECTOR_DATA_SYNC,
|
|
|
|
|
FMT_SECTOR_DATAAM,
|
|
|
|
|
FMT_SECTOR_DATA,
|
|
|
|
|
FMT_SECTOR_DATA_CRC,
|
|
|
|
|
FMT_SECTOR_GAP3,
|
|
|
|
|
|
|
|
|
|
FMT_POSTTRK_CHECK,
|
|
|
|
|
FMT_POSTTRK_GAP4
|
2016-08-20 03:40:12 +02:00
|
|
|
};
|
|
|
|
|
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
typedef struct {
|
|
|
|
|
uint8_t buffer[10];
|
|
|
|
|
uint32_t pos;
|
|
|
|
|
uint32_t len;
|
2016-11-02 22:39:07 +01:00
|
|
|
} sliding_buffer_t;
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
typedef struct {
|
|
|
|
|
uint32_t bits_obtained;
|
2020-06-27 23:27:19 +02:00
|
|
|
uint16_t bytes_obtained;
|
|
|
|
|
uint16_t sync_marks;
|
2018-03-19 01:02:04 +01:00
|
|
|
uint32_t sync_pos;
|
2016-11-02 22:39:07 +01:00
|
|
|
} find_t;
|
2017-11-24 02:23:00 -05:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
typedef struct {
|
|
|
|
|
unsigned nibble0 :4;
|
|
|
|
|
unsigned nibble1 :4;
|
2016-11-02 22:39:07 +01:00
|
|
|
} split_byte_t;
|
2016-09-03 18:07:46 +02:00
|
|
|
|
2016-11-02 22:39:07 +01:00
|
|
|
typedef union {
|
2018-03-19 01:02:04 +01:00
|
|
|
uint8_t byte;
|
|
|
|
|
split_byte_t nibbles;
|
2016-11-02 22:39:07 +01:00
|
|
|
} decoded_t;
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
typedef struct {
|
|
|
|
|
uint8_t c, h, r, n;
|
2019-12-05 21:36:28 +01:00
|
|
|
uint8_t flags, pad, pad0, pad1;
|
2018-03-19 01:02:04 +01:00
|
|
|
void *prev;
|
|
|
|
|
} sector_t;
|
2017-11-24 02:23:00 -05:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
/* Disk flags:
|
|
|
|
|
* Bit 0 Has surface data (1 = yes, 0 = no)
|
|
|
|
|
* Bits 2, 1 Hole (3 = ED + 2000 kbps, 2 = ED, 1 = HD, 0 = DD)
|
|
|
|
|
* Bit 3 Sides (1 = 2 sides, 0 = 1 side)
|
|
|
|
|
* Bit 4 Write protect (1 = yes, 0 = no)
|
|
|
|
|
* Bits 6, 5 RPM slowdown (3 = 2%, 2 = 1.5%, 1 = 1%, 0 = 0%)
|
|
|
|
|
* Bit 7 Bitcell mode (1 = Extra bitcells count specified after
|
|
|
|
|
* disk flags, 0 = No extra bitcells)
|
|
|
|
|
* The maximum number of extra bitcells is 1024 (which
|
|
|
|
|
* after decoding translates to 64 bytes)
|
|
|
|
|
* Bit 8 Disk type (1 = Zoned, 0 = Fixed RPM)
|
|
|
|
|
* Bits 10, 9 Zone type (3 = Commodore 64 zoned, 2 = Apple zoned,
|
|
|
|
|
* 1 = Pre-Apple zoned #2, 0 = Pre-Apple zoned #1)
|
|
|
|
|
* Bit 11 Data and surface bits are stored in reverse byte endianness
|
2019-02-06 03:34:39 +01:00
|
|
|
* Bit 12 If bits 6, 5 are not 0, they specify % of speedup instead
|
|
|
|
|
* of slowdown;
|
|
|
|
|
* If bits 6, 5 are 0, and bit 7 is 1, the extra bitcell count
|
|
|
|
|
* specifies the entire bitcell count
|
2018-03-19 01:02:04 +01:00
|
|
|
*/
|
|
|
|
|
typedef struct {
|
|
|
|
|
FILE *f;
|
2020-06-27 23:27:19 +02:00
|
|
|
uint8_t state, fill, sector_count, format_state,
|
|
|
|
|
error_condition, id_found;
|
|
|
|
|
uint16_t version, disk_flags, satisfying_bytes, turbo_pos;
|
|
|
|
|
uint16_t cur_track;
|
2018-03-19 01:02:04 +01:00
|
|
|
uint16_t track_encoded_data[2][53048];
|
2018-03-19 01:36:56 +01:00
|
|
|
uint16_t *track_surface_data[2];
|
2018-03-19 01:02:04 +01:00
|
|
|
uint16_t thin_track_encoded_data[2][2][53048];
|
2018-03-19 01:36:56 +01:00
|
|
|
uint16_t *thin_track_surface_data[2][2];
|
2018-03-19 01:02:04 +01:00
|
|
|
uint16_t side_flags[2];
|
2020-06-27 23:27:19 +02:00
|
|
|
uint16_t preceding_bit[2];
|
|
|
|
|
uint16_t current_byte[2];
|
|
|
|
|
uint16_t current_bit[2];
|
|
|
|
|
uint16_t last_word[2];
|
|
|
|
|
#ifdef D86F_COMPRESS
|
|
|
|
|
int is_compressed;
|
|
|
|
|
#endif
|
|
|
|
|
int32_t extra_bit_cells[2];
|
|
|
|
|
uint32_t file_size, index_count, track_pos, datac,
|
|
|
|
|
id_pos, dma_over;
|
2018-03-19 01:02:04 +01:00
|
|
|
uint32_t index_hole_pos[2];
|
|
|
|
|
uint32_t track_offset[512];
|
|
|
|
|
sector_id_t last_sector;
|
|
|
|
|
sector_id_t req_sector;
|
|
|
|
|
find_t id_find;
|
|
|
|
|
find_t data_find;
|
|
|
|
|
crc_t calc_crc;
|
|
|
|
|
crc_t track_crc;
|
2021-03-14 20:35:01 +01:00
|
|
|
char original_file_name[2048];
|
2020-06-27 23:27:19 +02:00
|
|
|
uint8_t *filebuf, *outbuf;
|
2018-03-19 01:02:04 +01:00
|
|
|
sector_t *last_side_sector[2];
|
|
|
|
|
} d86f_t;
|
2016-09-03 18:07:46 +02:00
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
static const uint8_t encoded_fm[64] = {
|
|
|
|
|
0xaa, 0xab, 0xae, 0xaf, 0xba, 0xbb, 0xbe, 0xbf,
|
|
|
|
|
0xea, 0xeb, 0xee, 0xef, 0xfa, 0xfb, 0xfe, 0xff,
|
|
|
|
|
0xaa, 0xab, 0xae, 0xaf, 0xba, 0xbb, 0xbe, 0xbf,
|
|
|
|
|
0xea, 0xeb, 0xee, 0xef, 0xfa, 0xfb, 0xfe, 0xff,
|
|
|
|
|
0xaa, 0xab, 0xae, 0xaf, 0xba, 0xbb, 0xbe, 0xbf,
|
|
|
|
|
0xea, 0xeb, 0xee, 0xef, 0xfa, 0xfb, 0xfe, 0xff,
|
|
|
|
|
0xaa, 0xab, 0xae, 0xaf, 0xba, 0xbb, 0xbe, 0xbf,
|
|
|
|
|
0xea, 0xeb, 0xee, 0xef, 0xfa, 0xfb, 0xfe, 0xff
|
|
|
|
|
};
|
|
|
|
|
static const uint8_t encoded_mfm[64] = {
|
|
|
|
|
0xaa, 0xa9, 0xa4, 0xa5, 0x92, 0x91, 0x94, 0x95,
|
|
|
|
|
0x4a, 0x49, 0x44, 0x45, 0x52, 0x51, 0x54, 0x55,
|
|
|
|
|
0x2a, 0x29, 0x24, 0x25, 0x12, 0x11, 0x14, 0x15,
|
|
|
|
|
0x4a, 0x49, 0x44, 0x45, 0x52, 0x51, 0x54, 0x55,
|
|
|
|
|
0xaa, 0xa9, 0xa4, 0xa5, 0x92, 0x91, 0x94, 0x95,
|
|
|
|
|
0x4a, 0x49, 0x44, 0x45, 0x52, 0x51, 0x54, 0x55,
|
|
|
|
|
0x2a, 0x29, 0x24, 0x25, 0x12, 0x11, 0x14, 0x15,
|
|
|
|
|
0x4a, 0x49, 0x44, 0x45, 0x52, 0x51, 0x54, 0x55
|
|
|
|
|
};
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
static d86f_t *d86f[FDD_NUM];
|
|
|
|
|
static uint16_t CRCTable[256];
|
|
|
|
|
static fdc_t *d86f_fdc;
|
|
|
|
|
uint64_t poly = 0x42F0E1EBA9EA3693ll; /* ECMA normal */
|
2017-11-24 02:23:00 -05:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
uint16_t d86f_side_flags(int drive);
|
|
|
|
|
int d86f_is_mfm(int drive);
|
|
|
|
|
void d86f_writeback(int drive);
|
|
|
|
|
uint8_t d86f_poll_read_data(int drive, int side, uint16_t pos);
|
|
|
|
|
void d86f_poll_write_data(int drive, int side, uint16_t pos, uint8_t data);
|
|
|
|
|
int d86f_format_conditions(int drive);
|
2017-01-16 01:49:19 +01:00
|
|
|
|
2017-11-24 02:23:00 -05:00
|
|
|
|
2018-10-19 00:39:32 +02:00
|
|
|
#ifdef ENABLE_D86F_LOG
|
|
|
|
|
int d86f_do_log = ENABLE_D86F_LOG;
|
|
|
|
|
|
|
|
|
|
|
2017-11-24 02:23:00 -05:00
|
|
|
static void
|
2018-10-19 00:39:32 +02:00
|
|
|
d86f_log(const char *fmt, ...)
|
2017-01-16 01:49:19 +01:00
|
|
|
{
|
2017-12-05 23:35:35 +01:00
|
|
|
va_list ap;
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (d86f_do_log) {
|
2018-10-19 00:39:32 +02:00
|
|
|
va_start(ap, fmt);
|
|
|
|
|
pclog_ex(fmt, ap);
|
2017-11-24 02:23:00 -05:00
|
|
|
va_end(ap);
|
2018-03-19 01:02:04 +01:00
|
|
|
}
|
2017-01-16 01:49:19 +01:00
|
|
|
}
|
2018-10-19 00:39:32 +02:00
|
|
|
#else
|
|
|
|
|
#define d86f_log(fmt, ...)
|
|
|
|
|
#endif
|
2017-01-16 01:49:19 +01:00
|
|
|
|
2017-11-24 02:23:00 -05:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
static void
|
|
|
|
|
setup_crc(uint16_t poly)
|
2017-07-26 00:16:54 +02:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
int c = 256, bc;
|
|
|
|
|
uint16_t temp;
|
|
|
|
|
|
|
|
|
|
while(c--) {
|
|
|
|
|
temp = c << 8;
|
|
|
|
|
bc = 8;
|
|
|
|
|
|
|
|
|
|
while (bc--) {
|
|
|
|
|
if (temp & 0x8000)
|
|
|
|
|
temp = (temp << 1) ^ poly;
|
|
|
|
|
else
|
|
|
|
|
temp <<= 1;
|
|
|
|
|
|
|
|
|
|
CRCTable[c] = temp;
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-03-15 00:02:19 +01:00
|
|
|
}
|
2017-07-26 00:16:54 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
d86f_destroy_linked_lists(int drive, int side)
|
2018-03-15 00:02:19 +01:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
sector_t *s, *t;
|
2018-03-15 00:02:19 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (dev == NULL) return;
|
|
|
|
|
|
|
|
|
|
if (dev->last_side_sector[side]) {
|
|
|
|
|
s = dev->last_side_sector[side];
|
|
|
|
|
while (s) {
|
|
|
|
|
t = s->prev;
|
|
|
|
|
free(s);
|
|
|
|
|
s = NULL;
|
|
|
|
|
if (! t)
|
|
|
|
|
break;
|
|
|
|
|
s = t;
|
|
|
|
|
}
|
|
|
|
|
dev->last_side_sector[side] = NULL;
|
|
|
|
|
}
|
2017-07-26 00:16:54 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
d86f_has_surface_desc(int drive)
|
2016-11-02 22:39:07 +01:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
return (d86f_handler[drive].disk_flags(drive) & 1);
|
|
|
|
|
}
|
2016-09-26 20:43:09 +02:00
|
|
|
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
int
|
|
|
|
|
d86f_get_sides(int drive)
|
|
|
|
|
{
|
|
|
|
|
return ((d86f_handler[drive].disk_flags(drive) >> 3) & 1) + 1;
|
|
|
|
|
}
|
2016-09-26 20:43:09 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
int
|
|
|
|
|
d86f_get_rpm_mode(int drive)
|
|
|
|
|
{
|
|
|
|
|
return (d86f_handler[drive].disk_flags(drive) & 0x60) >> 5;
|
2016-09-28 22:56:19 +02:00
|
|
|
}
|
|
|
|
|
|
2019-02-06 03:34:39 +01:00
|
|
|
|
|
|
|
|
int
|
|
|
|
|
d86f_get_speed_shift_dir(int drive)
|
|
|
|
|
{
|
|
|
|
|
return (d86f_handler[drive].disk_flags(drive) & 0x1000) >> 12;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
int
|
|
|
|
|
d86f_reverse_bytes(int drive)
|
2016-09-26 20:43:09 +02:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
return (d86f_handler[drive].disk_flags(drive) & 0x800) >> 11;
|
2016-09-26 20:43:09 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
uint16_t
|
|
|
|
|
d86f_disk_flags(int drive)
|
2016-09-26 20:43:09 +02:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
|
|
|
|
|
return dev->disk_flags;
|
2016-09-26 20:43:09 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
uint32_t
|
|
|
|
|
d86f_index_hole_pos(int drive, int side)
|
2016-09-22 21:22:56 +02:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
|
|
|
|
|
return dev->index_hole_pos[side];
|
2016-09-22 21:22:56 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
uint32_t
|
|
|
|
|
null_index_hole_pos(int drive, int side)
|
2016-09-22 21:22:56 +02:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
return 0;
|
2016-09-22 21:22:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
uint16_t
|
|
|
|
|
null_disk_flags(int drive)
|
2016-09-22 21:22:56 +02:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
return 0x09;
|
2016-09-22 21:22:56 +02:00
|
|
|
}
|
|
|
|
|
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
uint16_t
|
|
|
|
|
null_side_flags(int drive)
|
2016-11-02 22:39:07 +01:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
return 0x0A;
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
null_writeback(int drive)
|
2016-11-02 22:39:07 +01:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
return;
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
null_set_sector(int drive, int side, uint8_t c, uint8_t h, uint8_t r, uint8_t n)
|
2016-09-22 21:22:56 +02:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
return;
|
2016-09-22 21:22:56 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
null_write_data(int drive, int side, uint16_t pos, uint8_t data)
|
2016-09-22 21:22:56 +02:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
return;
|
2016-09-22 21:22:56 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
int
|
|
|
|
|
null_format_conditions(int drive)
|
2016-09-22 21:22:56 +02:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
return 0;
|
2016-09-22 21:22:56 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
int32_t
|
|
|
|
|
d86f_extra_bit_cells(int drive, int side)
|
2016-09-22 21:22:56 +02:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
|
|
|
|
|
return dev->extra_bit_cells[side];
|
2016-09-22 21:22:56 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
int32_t
|
|
|
|
|
null_extra_bit_cells(int drive, int side)
|
2016-09-22 21:22:56 +02:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
return 0;
|
2016-09-22 21:22:56 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
uint16_t*
|
|
|
|
|
common_encoded_data(int drive, int side)
|
2016-09-22 21:22:56 +02:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
|
|
|
|
|
return dev->track_encoded_data[side];
|
2016-09-22 21:22:56 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
common_read_revolution(int drive)
|
2016-09-22 21:22:56 +02:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
return;
|
2016-09-22 21:22:56 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
uint16_t
|
|
|
|
|
d86f_side_flags(int drive)
|
2016-09-22 21:22:56 +02:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
int side;
|
|
|
|
|
|
|
|
|
|
side = fdd_get_head(drive);
|
|
|
|
|
|
|
|
|
|
return dev->side_flags[side];
|
2016-09-22 21:22:56 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
uint16_t
|
|
|
|
|
d86f_track_flags(int drive)
|
2016-10-05 00:47:50 +02:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
uint16_t dr, rr, tf;
|
|
|
|
|
|
|
|
|
|
tf = d86f_handler[drive].side_flags(drive);
|
|
|
|
|
rr = tf & 0x67;
|
|
|
|
|
dr = fdd_get_flags(drive) & 7;
|
|
|
|
|
tf &= ~0x67;
|
|
|
|
|
|
|
|
|
|
switch (rr) {
|
|
|
|
|
case 0x02:
|
|
|
|
|
case 0x21:
|
|
|
|
|
/* 1 MB unformatted medium, treat these two as equivalent. */
|
|
|
|
|
switch (dr) {
|
|
|
|
|
case 0x06:
|
|
|
|
|
/* 5.25" Single-RPM HD drive, treat as 300 kbps, 360 rpm. */
|
|
|
|
|
tf |= 0x21;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
/* Any other drive, treat as 250 kbps, 300 rpm. */
|
|
|
|
|
tf |= 0x02;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
tf |= rr;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return tf;
|
2016-10-05 00:47:50 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
uint32_t
|
|
|
|
|
common_get_raw_size(int drive, int side)
|
2016-09-04 03:50:06 +02:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
double rate = 0.0;
|
|
|
|
|
double rpm, rpm_diff;
|
|
|
|
|
double size = 100000.0;
|
|
|
|
|
int mfm;
|
2019-02-06 03:34:39 +01:00
|
|
|
int rm, ssd;
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
uint32_t extra_bc = 0;
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
mfm = d86f_is_mfm(drive);
|
|
|
|
|
rpm = ((d86f_track_flags(drive) & 0xE0) == 0x20) ? 360.0 : 300.0;
|
|
|
|
|
rpm_diff = 1.0;
|
2019-02-06 03:34:39 +01:00
|
|
|
rm = d86f_get_rpm_mode(drive);
|
|
|
|
|
ssd = d86f_get_speed_shift_dir(drive);
|
2018-03-19 01:02:04 +01:00
|
|
|
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
/* 0% speed shift and shift direction 1: special case where extra bit cells are the entire track size. */
|
|
|
|
|
if (!rm && ssd)
|
|
|
|
|
extra_bc = d86f_handler[drive].extra_bit_cells(drive, side);
|
|
|
|
|
|
|
|
|
|
if (extra_bc)
|
|
|
|
|
return extra_bc;
|
|
|
|
|
|
2019-02-06 03:34:39 +01:00
|
|
|
switch (rm) {
|
2018-03-19 01:02:04 +01:00
|
|
|
case 1:
|
|
|
|
|
rpm_diff = 1.01;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
rpm_diff = 1.015;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
|
rpm_diff = 1.02;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
rpm_diff = 1.0;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2019-02-06 03:34:39 +01:00
|
|
|
if (ssd)
|
|
|
|
|
rpm_diff = 1.0 / rpm_diff;
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
switch (d86f_track_flags(drive) & 7) {
|
|
|
|
|
case 0:
|
|
|
|
|
rate = 500.0;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
|
rate = 300.0;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
rate = 250.0;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
|
rate = 1000.0;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 5:
|
|
|
|
|
rate = 2000.0;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
rate = 250.0;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (! mfm) rate /= 2.0;
|
|
|
|
|
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
size = (size / 250.0) * rate;
|
|
|
|
|
size = (size * 300.0) / rpm;
|
|
|
|
|
size *= rpm_diff;
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Round down to a multiple of 16 and add the extra bit cells,
|
|
|
|
|
* then return.
|
|
|
|
|
*/
|
|
|
|
|
return ((((uint32_t) size) >> 4) << 4) + d86f_handler[drive].extra_bit_cells(drive, side);
|
2016-09-04 03:50:06 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
d86f_set_version(int drive, uint16_t version)
|
2016-08-20 03:40:12 +02:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
|
|
|
|
|
dev->version = version;
|
2016-08-20 03:40:12 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
d86f_unregister(int drive)
|
2016-08-31 22:49:56 +02:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
2016-08-31 22:49:56 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (dev == NULL) return;
|
2016-08-31 22:49:56 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_handler[drive].disk_flags = null_disk_flags;
|
|
|
|
|
d86f_handler[drive].side_flags = null_side_flags;
|
|
|
|
|
d86f_handler[drive].writeback = null_writeback;
|
|
|
|
|
d86f_handler[drive].set_sector = null_set_sector;
|
|
|
|
|
d86f_handler[drive].write_data = null_write_data;
|
|
|
|
|
d86f_handler[drive].format_conditions = null_format_conditions;
|
|
|
|
|
d86f_handler[drive].extra_bit_cells = null_extra_bit_cells;
|
|
|
|
|
d86f_handler[drive].encoded_data = common_encoded_data;
|
|
|
|
|
d86f_handler[drive].read_revolution = common_read_revolution;
|
|
|
|
|
d86f_handler[drive].index_hole_pos = null_index_hole_pos;
|
|
|
|
|
d86f_handler[drive].get_raw_size = common_get_raw_size;
|
|
|
|
|
d86f_handler[drive].check_crc = 0;
|
|
|
|
|
|
|
|
|
|
dev->version = 0x0063; /* Proxied formats report as version 0.99. */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
d86f_register_86f(int drive)
|
|
|
|
|
{
|
|
|
|
|
d86f_handler[drive].disk_flags = d86f_disk_flags;
|
|
|
|
|
d86f_handler[drive].side_flags = d86f_side_flags;
|
|
|
|
|
d86f_handler[drive].writeback = d86f_writeback;
|
|
|
|
|
d86f_handler[drive].set_sector = null_set_sector;
|
|
|
|
|
d86f_handler[drive].write_data = null_write_data;
|
|
|
|
|
d86f_handler[drive].format_conditions = d86f_format_conditions;
|
|
|
|
|
d86f_handler[drive].extra_bit_cells = d86f_extra_bit_cells;
|
|
|
|
|
d86f_handler[drive].encoded_data = common_encoded_data;
|
|
|
|
|
d86f_handler[drive].read_revolution = common_read_revolution;
|
|
|
|
|
d86f_handler[drive].index_hole_pos = d86f_index_hole_pos;
|
|
|
|
|
d86f_handler[drive].get_raw_size = common_get_raw_size;
|
|
|
|
|
d86f_handler[drive].check_crc = 1;
|
2016-08-31 22:49:56 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
int
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
d86f_get_array_size(int drive, int side, int words)
|
2016-08-20 03:40:12 +02:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
int array_size;
|
|
|
|
|
int hole, rm;
|
2019-02-06 03:34:39 +01:00
|
|
|
int ssd;
|
2016-09-07 20:59:08 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
rm = d86f_get_rpm_mode(drive);
|
2019-02-06 03:34:39 +01:00
|
|
|
ssd = d86f_get_speed_shift_dir(drive);
|
2018-03-19 01:02:04 +01:00
|
|
|
hole = (d86f_handler[drive].disk_flags(drive) & 6) >> 1;
|
2019-02-06 03:34:39 +01:00
|
|
|
|
|
|
|
|
if (!rm && ssd) /* Special case - extra bit cells size specifies entire array size. */
|
|
|
|
|
array_size = 0;
|
|
|
|
|
else switch (hole) {
|
2018-03-19 01:02:04 +01:00
|
|
|
case 0:
|
|
|
|
|
case 1:
|
|
|
|
|
default:
|
|
|
|
|
array_size = 12500;
|
|
|
|
|
switch (rm) {
|
|
|
|
|
case 1:
|
2019-02-06 03:34:39 +01:00
|
|
|
array_size = ssd ? 12376 : 12625;
|
2018-03-19 01:02:04 +01:00
|
|
|
break;
|
2016-09-22 21:22:56 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
case 2:
|
2019-02-06 03:34:39 +01:00
|
|
|
array_size = ssd ? 12315 : 12687;
|
2018-03-19 01:02:04 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 3:
|
2019-02-06 03:34:39 +01:00
|
|
|
array_size = ssd ? 12254 : 12750;
|
2018-03-19 01:02:04 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
array_size = 25000;
|
|
|
|
|
switch (rm) {
|
|
|
|
|
case 1:
|
2019-02-06 03:34:39 +01:00
|
|
|
array_size = ssd ? 24752 : 25250;
|
2018-03-19 01:02:04 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 2:
|
2019-02-06 03:34:39 +01:00
|
|
|
array_size = ssd ? 24630 : 25375;
|
2018-03-19 01:02:04 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 3:
|
2019-02-06 03:34:39 +01:00
|
|
|
array_size = ssd ? 24509 : 25500;
|
2018-03-19 01:02:04 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
|
array_size = 50000;
|
|
|
|
|
switch (rm) {
|
|
|
|
|
case 1:
|
2019-02-06 03:34:39 +01:00
|
|
|
array_size = ssd ? 49504 : 50500;
|
2018-03-19 01:02:04 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 2:
|
2019-02-06 03:34:39 +01:00
|
|
|
array_size = ssd ? 49261 : 50750;
|
2018-03-19 01:02:04 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 3:
|
2019-02-06 03:34:39 +01:00
|
|
|
array_size = ssd ? 49019 : 51000;
|
2018-03-19 01:02:04 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
array_size <<= 4;
|
|
|
|
|
array_size += d86f_handler[drive].extra_bit_cells(drive, side);
|
|
|
|
|
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
if (array_size & 15)
|
|
|
|
|
array_size = (array_size >> 4) + 1;
|
|
|
|
|
else
|
|
|
|
|
array_size = (array_size >> 4);
|
|
|
|
|
|
|
|
|
|
if (!words)
|
|
|
|
|
array_size <<= 1;
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
return array_size;
|
2016-09-28 22:56:19 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
int
|
|
|
|
|
d86f_valid_bit_rate(int drive)
|
2016-09-05 21:58:28 +02:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
int hole, rate;
|
|
|
|
|
|
|
|
|
|
rate = fdc_get_bit_rate(d86f_fdc);
|
|
|
|
|
hole = (d86f_handler[drive].disk_flags(drive) & 6) >> 1;
|
|
|
|
|
switch (hole) {
|
|
|
|
|
case 0: /* DD */
|
|
|
|
|
if (!rate && (fdd_get_flags(drive) & 0x10)) return 1;
|
|
|
|
|
if ((rate < 1) || (rate > 2)) return 0;
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
case 1: /* HD */
|
|
|
|
|
if (rate != 0) return 0;
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
case 2: /* ED */
|
|
|
|
|
if (rate != 3) return 0;
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
case 3: /* ED with 2000 kbps support */
|
|
|
|
|
if (rate < 3) return 0;
|
|
|
|
|
return 1;
|
2018-09-15 02:50:38 +02:00
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
2018-03-19 01:02:04 +01:00
|
|
|
}
|
|
|
|
|
|
2018-09-14 15:35:41 +02:00
|
|
|
return 0;
|
2016-09-05 21:58:28 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
int
|
|
|
|
|
d86f_hole(int drive)
|
2016-09-22 21:22:56 +02:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
if (((d86f_handler[drive].disk_flags(drive) >> 1) & 3) == 3)
|
|
|
|
|
return 2;
|
|
|
|
|
|
|
|
|
|
return (d86f_handler[drive].disk_flags(drive) >> 1) & 3;
|
2016-09-22 21:22:56 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
uint8_t
|
|
|
|
|
d86f_get_encoding(int drive)
|
2016-09-28 22:56:19 +02:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
return (d86f_track_flags(drive) & 0x18) >> 3;
|
2016-09-28 22:56:19 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
uint64_t
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_byteperiod(int drive)
|
2016-09-28 22:56:19 +02:00
|
|
|
{
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
double dusec = (double) TIMER_USEC;
|
|
|
|
|
double p = 2.0;
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
switch (d86f_track_flags(drive) & 0x0f) {
|
|
|
|
|
case 0x02: /* 125 kbps, FM */
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
p = 4.0;
|
|
|
|
|
break;
|
2018-03-19 01:02:04 +01:00
|
|
|
case 0x01: /* 150 kbps, FM */
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
p = 20.0 / 6.0;
|
|
|
|
|
break;
|
2018-03-19 01:02:04 +01:00
|
|
|
case 0x0a: /* 250 kbps, MFM */
|
|
|
|
|
case 0x00: /* 250 kbps, FM */
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
default:
|
|
|
|
|
p = 2.0;
|
|
|
|
|
break;
|
2018-03-19 01:02:04 +01:00
|
|
|
case 0x09: /* 300 kbps, MFM */
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
p = 10.0 / 6.0;
|
|
|
|
|
break;
|
2018-03-19 01:02:04 +01:00
|
|
|
case 0x08: /* 500 kbps, MFM */
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
p = 1.0;
|
|
|
|
|
break;
|
2018-03-19 01:02:04 +01:00
|
|
|
case 0x0b: /* 1000 kbps, MFM */
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
p = 0.5;
|
|
|
|
|
break;
|
2018-03-19 01:02:04 +01:00
|
|
|
case 0x0d: /* 2000 kbps, MFM */
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
p = 0.25;
|
2018-03-19 01:02:04 +01:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
return (uint64_t) (p * dusec);
|
2016-09-28 22:56:19 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
int
|
|
|
|
|
d86f_is_mfm(int drive)
|
2016-09-28 22:56:19 +02:00
|
|
|
{
|
2020-03-23 09:02:32 +01:00
|
|
|
return ((d86f_track_flags(drive) & 0x18) == 0x08) ? 1 : 0;
|
2016-09-28 22:56:19 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
uint32_t
|
|
|
|
|
d86f_get_data_len(int drive)
|
2016-08-20 03:40:12 +02:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
2020-06-28 04:46:32 +02:00
|
|
|
uint32_t i, ret = 128;
|
2018-03-19 01:02:04 +01:00
|
|
|
|
2020-06-28 04:46:32 +02:00
|
|
|
if (dev->req_sector.id.n)
|
|
|
|
|
ret = (uint32_t)128 << dev->req_sector.id.n;
|
|
|
|
|
else if ((i = fdc_get_dtl(d86f_fdc)) < 128)
|
|
|
|
|
ret = i;
|
|
|
|
|
|
|
|
|
|
return ret;
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
2016-08-20 03:40:12 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
uint32_t
|
|
|
|
|
d86f_has_extra_bit_cells(int drive)
|
2016-11-02 22:39:07 +01:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
return (d86f_handler[drive].disk_flags(drive) >> 7) & 1;
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
2016-09-27 03:16:57 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
uint32_t
|
|
|
|
|
d86f_header_size(int drive)
|
2016-11-02 22:39:07 +01:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
return 8;
|
2016-08-20 03:40:12 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
static uint16_t
|
|
|
|
|
d86f_encode_get_data(uint8_t dat)
|
2016-08-20 03:40:12 +02:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
uint16_t temp;
|
|
|
|
|
temp = 0;
|
|
|
|
|
|
|
|
|
|
if (dat & 0x01) temp |= 1;
|
|
|
|
|
if (dat & 0x02) temp |= 4;
|
|
|
|
|
if (dat & 0x04) temp |= 16;
|
|
|
|
|
if (dat & 0x08) temp |= 64;
|
|
|
|
|
if (dat & 0x10) temp |= 256;
|
|
|
|
|
if (dat & 0x20) temp |= 1024;
|
|
|
|
|
if (dat & 0x40) temp |= 4096;
|
|
|
|
|
if (dat & 0x80) temp |= 16384;
|
|
|
|
|
|
|
|
|
|
return temp;
|
2016-08-20 03:40:12 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
static uint16_t
|
|
|
|
|
d86f_encode_get_clock(uint8_t dat)
|
2016-09-05 21:58:28 +02:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
uint16_t temp;
|
|
|
|
|
temp = 0;
|
|
|
|
|
|
|
|
|
|
if (dat & 0x01) temp |= 2;
|
|
|
|
|
if (dat & 0x02) temp |= 8;
|
|
|
|
|
if (dat & 0x40) temp |= 32;
|
|
|
|
|
if (dat & 0x08) temp |= 128;
|
|
|
|
|
if (dat & 0x10) temp |= 512;
|
|
|
|
|
if (dat & 0x20) temp |= 2048;
|
|
|
|
|
if (dat & 0x40) temp |= 8192;
|
|
|
|
|
if (dat & 0x80) temp |= 32768;
|
|
|
|
|
|
|
|
|
|
return temp;
|
2016-09-05 21:58:28 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
int
|
|
|
|
|
d86f_format_conditions(int drive)
|
2016-08-20 03:40:12 +02:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
return d86f_valid_bit_rate(drive);
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
2016-09-22 21:22:56 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
int
|
|
|
|
|
d86f_wrong_densel(int drive)
|
2016-12-23 03:16:24 +01:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
int is_3mode = 0;
|
2016-12-23 03:16:24 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if ((fdd_get_flags(drive) & 7) == 3)
|
|
|
|
|
is_3mode = 1;
|
2016-12-23 03:16:24 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
switch (d86f_hole(drive)) {
|
|
|
|
|
case 0:
|
|
|
|
|
default:
|
|
|
|
|
if (fdd_is_dd(drive))
|
|
|
|
|
return 0;
|
|
|
|
|
if (fdd_get_densel(drive))
|
|
|
|
|
return 1;
|
|
|
|
|
else
|
|
|
|
|
return 0;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
|
if (fdd_is_dd(drive))
|
|
|
|
|
return 1;
|
|
|
|
|
if (fdd_get_densel(drive))
|
|
|
|
|
return 0;
|
|
|
|
|
else {
|
|
|
|
|
if (is_3mode)
|
2016-12-23 03:16:24 +01:00
|
|
|
return 0;
|
2018-03-19 01:02:04 +01:00
|
|
|
else
|
2016-12-23 03:16:24 +01:00
|
|
|
return 1;
|
2018-03-19 01:02:04 +01:00
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
if (fdd_is_dd(drive) || !fdd_is_ed(drive))
|
|
|
|
|
return 1;
|
|
|
|
|
if (fdd_get_densel(drive))
|
|
|
|
|
return 0;
|
|
|
|
|
else
|
|
|
|
|
return 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2016-12-23 03:16:24 +01:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
int
|
|
|
|
|
d86f_can_format(int drive)
|
|
|
|
|
{
|
|
|
|
|
int temp;
|
|
|
|
|
|
|
|
|
|
temp = !writeprot[drive];
|
|
|
|
|
temp = temp && !fdc_get_swwp(d86f_fdc);
|
|
|
|
|
temp = temp && fdd_can_read_medium(real_drive(d86f_fdc, drive));
|
|
|
|
|
temp = temp && d86f_handler[drive].format_conditions(drive); /* Allows proxied formats to add their own extra conditions to formatting. */
|
|
|
|
|
temp = temp && !d86f_wrong_densel(drive);
|
|
|
|
|
|
|
|
|
|
return temp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uint16_t
|
|
|
|
|
d86f_encode_byte(int drive, int sync, decoded_t b, decoded_t prev_b)
|
|
|
|
|
{
|
|
|
|
|
uint8_t encoding = d86f_get_encoding(drive);
|
|
|
|
|
uint8_t bits89AB = prev_b.nibbles.nibble0;
|
|
|
|
|
uint8_t bits7654 = b.nibbles.nibble1;
|
|
|
|
|
uint8_t bits3210 = b.nibbles.nibble0;
|
|
|
|
|
uint16_t encoded_7654, encoded_3210, result;
|
|
|
|
|
|
2020-06-27 23:27:19 +02:00
|
|
|
if (encoding > 1)
|
|
|
|
|
return 0xffff;
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
if (sync) {
|
|
|
|
|
result = d86f_encode_get_data(b.byte);
|
|
|
|
|
if (encoding) {
|
|
|
|
|
switch(b.byte) {
|
|
|
|
|
case 0xa1:
|
|
|
|
|
return result | d86f_encode_get_clock(0x0a);
|
|
|
|
|
|
|
|
|
|
case 0xc2:
|
|
|
|
|
return result | d86f_encode_get_clock(0x14);
|
|
|
|
|
|
|
|
|
|
case 0xf8:
|
|
|
|
|
return result | d86f_encode_get_clock(0x03);
|
|
|
|
|
|
|
|
|
|
case 0xfb:
|
|
|
|
|
case 0xfe:
|
|
|
|
|
return result | d86f_encode_get_clock(0x00);
|
|
|
|
|
|
|
|
|
|
case 0xfc:
|
|
|
|
|
return result | d86f_encode_get_clock(0x01);
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
} else {
|
|
|
|
|
switch(b.byte) {
|
|
|
|
|
case 0xf8:
|
|
|
|
|
case 0xfb:
|
|
|
|
|
case 0xfe:
|
|
|
|
|
return result | d86f_encode_get_clock(0xc7);
|
|
|
|
|
|
|
|
|
|
case 0xfc:
|
|
|
|
|
return result | d86f_encode_get_clock(0xd7);
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
2016-08-20 03:40:12 +02:00
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bits3210 += ((bits7654 & 3) << 4);
|
|
|
|
|
bits7654 += ((bits89AB & 3) << 4);
|
|
|
|
|
encoded_3210 = (encoding == 1) ? encoded_mfm[bits3210] : encoded_fm[bits3210];
|
|
|
|
|
encoded_7654 = (encoding == 1) ? encoded_mfm[bits7654] : encoded_fm[bits7654];
|
|
|
|
|
result = (encoded_7654 << 8) | encoded_3210;
|
|
|
|
|
|
|
|
|
|
return result;
|
2016-08-31 22:49:56 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
d86f_get_bitcell_period(int drive)
|
2016-08-31 22:49:56 +02:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
double rate = 0.0;
|
|
|
|
|
int mfm = 0;
|
|
|
|
|
int tflags = 0;
|
|
|
|
|
double rpm = 0;
|
|
|
|
|
double size = 8000.0;
|
2016-09-22 21:22:56 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
tflags = d86f_track_flags(drive);
|
2016-09-22 21:22:56 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
mfm = (tflags & 8) ? 1 : 0;
|
|
|
|
|
rpm = ((tflags & 0xE0) == 0x20) ? 360.0 : 300.0;
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
switch (tflags & 7) {
|
|
|
|
|
case 0:
|
|
|
|
|
rate = 500.0;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
|
rate = 300.0;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
rate = 250.0;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
|
rate = 1000.0;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 5:
|
|
|
|
|
rate = 2000.0;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (! mfm)
|
|
|
|
|
rate /= 2.0;
|
|
|
|
|
size = (size * 250.0) / rate;
|
|
|
|
|
size = (size * 300.0) / rpm;
|
|
|
|
|
size = (size * fdd_getrpm(real_drive(d86f_fdc, drive))) / 300.0;
|
|
|
|
|
|
|
|
|
|
return (int)size;
|
2016-08-31 22:49:56 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
int
|
|
|
|
|
d86f_can_read_address(int drive)
|
2016-08-20 03:40:12 +02:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
int temp;
|
|
|
|
|
|
|
|
|
|
temp = (fdc_get_bitcell_period(d86f_fdc) == d86f_get_bitcell_period(drive));
|
|
|
|
|
temp = temp && fdd_can_read_medium(real_drive(d86f_fdc, drive));
|
|
|
|
|
temp = temp && (fdc_is_mfm(d86f_fdc) == d86f_is_mfm(drive));
|
|
|
|
|
temp = temp && (d86f_get_encoding(drive) <= 1);
|
|
|
|
|
|
|
|
|
|
return temp;
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
d86f_get_bit(int drive, int side)
|
2016-11-02 22:39:07 +01:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
uint32_t track_word;
|
|
|
|
|
uint32_t track_bit;
|
|
|
|
|
uint16_t encoded_data;
|
|
|
|
|
uint16_t surface_data = 0;
|
|
|
|
|
uint16_t current_bit;
|
|
|
|
|
uint16_t surface_bit;
|
2016-09-27 03:16:57 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
track_word = dev->track_pos >> 4;
|
2016-08-20 03:40:12 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
/* We need to make sure we read the bits from MSB to LSB. */
|
|
|
|
|
track_bit = 15 - (dev->track_pos & 15);
|
2016-08-20 03:40:12 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (d86f_reverse_bytes(drive)) {
|
|
|
|
|
/* Image is in reverse endianness, read the data as is. */
|
|
|
|
|
encoded_data = d86f_handler[drive].encoded_data(drive, side)[track_word];
|
|
|
|
|
} else {
|
|
|
|
|
/* We store the words as big endian, so we need to convert them to little endian when reading. */
|
|
|
|
|
encoded_data = (d86f_handler[drive].encoded_data(drive, side)[track_word] & 0xFF) << 8;
|
|
|
|
|
encoded_data |= (d86f_handler[drive].encoded_data(drive, side)[track_word] >> 8);
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-03 14:25:10 +02:00
|
|
|
/* In some cases, misindentification occurs so we need to make sure the surface data array is not
|
|
|
|
|
not NULL. */
|
2019-03-20 02:42:55 +08:00
|
|
|
if (d86f_has_surface_desc(drive) && dev->track_surface_data[side]) {
|
2018-03-19 01:02:04 +01:00
|
|
|
if (d86f_reverse_bytes(drive)) {
|
|
|
|
|
surface_data = dev->track_surface_data[side][track_word] & 0xFF;
|
|
|
|
|
} else {
|
|
|
|
|
surface_data = (dev->track_surface_data[side][track_word] & 0xFF) << 8;
|
|
|
|
|
surface_data |= (dev->track_surface_data[side][track_word] >> 8);
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
}
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
current_bit = (encoded_data >> track_bit) & 1;
|
|
|
|
|
dev->last_word[side] <<= 1;
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2019-03-20 02:42:55 +08:00
|
|
|
if (d86f_has_surface_desc(drive) && dev->track_surface_data[side]) {
|
2018-03-19 01:02:04 +01:00
|
|
|
surface_bit = (surface_data >> track_bit) & 1;
|
2019-02-06 03:34:39 +01:00
|
|
|
if (! surface_bit)
|
|
|
|
|
dev->last_word[side] |= current_bit;
|
|
|
|
|
else {
|
2019-11-08 22:00:29 +01:00
|
|
|
/* Bit is either 0 or 1 and is set to fuzzy, we randomly generate it. */
|
|
|
|
|
dev->last_word[side] |= (random_generate() & 1);
|
2016-08-20 03:40:12 +02:00
|
|
|
}
|
2019-02-06 03:34:39 +01:00
|
|
|
} else
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->last_word[side] |= current_bit;
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
2016-08-31 22:49:56 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
d86f_put_bit(int drive, int side, int bit)
|
2016-11-02 22:39:07 +01:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
uint32_t track_word;
|
|
|
|
|
uint32_t track_bit;
|
|
|
|
|
uint16_t encoded_data;
|
|
|
|
|
uint16_t surface_data = 0;
|
|
|
|
|
uint16_t current_bit;
|
|
|
|
|
uint16_t surface_bit;
|
2016-08-31 22:49:56 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (fdc_get_diswr(d86f_fdc))
|
|
|
|
|
return;
|
2018-01-17 18:43:36 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
track_word = dev->track_pos >> 4;
|
2016-08-31 22:49:56 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
/* We need to make sure we read the bits from MSB to LSB. */
|
|
|
|
|
track_bit = 15 - (dev->track_pos & 15);
|
2016-09-27 03:16:57 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (d86f_reverse_bytes(drive)) {
|
|
|
|
|
/* Image is in reverse endianness, read the data as is. */
|
|
|
|
|
encoded_data = d86f_handler[drive].encoded_data(drive, side)[track_word];
|
|
|
|
|
} else {
|
|
|
|
|
/* We store the words as big endian, so we need to convert them to little endian when reading. */
|
|
|
|
|
encoded_data = (d86f_handler[drive].encoded_data(drive, side)[track_word] & 0xFF) << 8;
|
|
|
|
|
encoded_data |= (d86f_handler[drive].encoded_data(drive, side)[track_word] >> 8);
|
|
|
|
|
}
|
2016-08-31 22:49:56 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (d86f_has_surface_desc(drive)) {
|
|
|
|
|
if (d86f_reverse_bytes(drive)) {
|
|
|
|
|
surface_data = dev->track_surface_data[side][track_word] & 0xFF;
|
|
|
|
|
} else {
|
|
|
|
|
surface_data = (dev->track_surface_data[side][track_word] & 0xFF) << 8;
|
|
|
|
|
surface_data |= (dev->track_surface_data[side][track_word] >> 8);
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-09-28 22:56:19 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
current_bit = (encoded_data >> track_bit) & 1;
|
|
|
|
|
dev->last_word[side] <<= 1;
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (d86f_has_surface_desc(drive)) {
|
|
|
|
|
surface_bit = (surface_data >> track_bit) & 1;
|
|
|
|
|
if (! surface_bit) {
|
2020-01-15 04:58:28 +01:00
|
|
|
dev->last_word[side] |= bit;
|
|
|
|
|
current_bit = bit;
|
2018-03-19 01:02:04 +01:00
|
|
|
} else {
|
|
|
|
|
if (current_bit) {
|
|
|
|
|
/* Bit is 1 and is set to fuzzy, we overwrite it with a non-fuzzy bit. */
|
|
|
|
|
dev->last_word[side] |= bit;
|
|
|
|
|
current_bit = bit;
|
|
|
|
|
surface_bit = 0;
|
2016-09-26 21:03:23 +02:00
|
|
|
}
|
2016-08-20 03:40:12 +02:00
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
surface_data &= ~(1 << track_bit);
|
|
|
|
|
surface_data |= (surface_bit << track_bit);
|
|
|
|
|
if (d86f_reverse_bytes(drive)) {
|
|
|
|
|
dev->track_surface_data[side][track_word] = surface_data;
|
|
|
|
|
} else {
|
|
|
|
|
dev->track_surface_data[side][track_word] = (surface_data & 0xFF) << 8;
|
|
|
|
|
dev->track_surface_data[side][track_word] |= (surface_data >> 8);
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
} else {
|
|
|
|
|
dev->last_word[side] |= bit;
|
|
|
|
|
current_bit = bit;
|
|
|
|
|
}
|
2016-08-20 03:40:12 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
encoded_data &= ~(1 << track_bit);
|
|
|
|
|
encoded_data |= (current_bit << track_bit);
|
2016-09-03 18:07:46 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (d86f_reverse_bytes(drive)) {
|
|
|
|
|
d86f_handler[drive].encoded_data(drive, side)[track_word] = encoded_data;
|
|
|
|
|
} else {
|
|
|
|
|
d86f_handler[drive].encoded_data(drive, side)[track_word] = (encoded_data & 0xFF) << 8;
|
|
|
|
|
d86f_handler[drive].encoded_data(drive, side)[track_word] |= (encoded_data >> 8);
|
|
|
|
|
}
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
2016-08-20 03:40:12 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
static uint8_t
|
|
|
|
|
decodefm(int drive, uint16_t dat)
|
2016-11-02 22:39:07 +01:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
uint8_t temp = 0;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* We write the encoded bytes in big endian, so we
|
|
|
|
|
* process the two 8-bit halves swapped here.
|
|
|
|
|
*/
|
|
|
|
|
if (dat & 0x0001) temp |= 1;
|
|
|
|
|
if (dat & 0x0004) temp |= 2;
|
|
|
|
|
if (dat & 0x0010) temp |= 4;
|
|
|
|
|
if (dat & 0x0040) temp |= 8;
|
|
|
|
|
if (dat & 0x0100) temp |= 16;
|
|
|
|
|
if (dat & 0x0400) temp |= 32;
|
|
|
|
|
if (dat & 0x1000) temp |= 64;
|
|
|
|
|
if (dat & 0x4000) temp |= 128;
|
|
|
|
|
|
|
|
|
|
return temp;
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
2016-08-31 22:49:56 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
fdd_calccrc(uint8_t byte, crc_t *crc_var)
|
2016-11-02 22:39:07 +01:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
crc_var->word = (crc_var->word << 8) ^
|
|
|
|
|
CRCTable[(crc_var->word >> 8)^byte];
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
d86f_calccrc(d86f_t *dev, uint8_t byte)
|
2016-11-02 22:39:07 +01:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
fdd_calccrc(byte, &(dev->calc_crc));
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
2016-09-07 20:59:08 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
int
|
|
|
|
|
d86f_word_is_aligned(int drive, int side, uint32_t base_pos)
|
2016-11-02 22:39:07 +01:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
uint32_t adjusted_track_pos = dev->track_pos;
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2019-12-06 02:37:52 +01:00
|
|
|
if (base_pos == 0xFFFFFFFF)
|
|
|
|
|
return 0;
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
/*
|
|
|
|
|
* This is very important, it makes sure alignment is detected
|
|
|
|
|
* correctly even across the index hole of a track whose length
|
|
|
|
|
* is not divisible by 16.
|
|
|
|
|
*/
|
2019-12-06 02:37:52 +01:00
|
|
|
if (adjusted_track_pos < base_pos)
|
2018-03-19 01:02:04 +01:00
|
|
|
adjusted_track_pos += d86f_handler[drive].get_raw_size(drive, side);
|
2016-09-27 03:16:57 +02:00
|
|
|
|
2019-12-06 02:37:52 +01:00
|
|
|
if ((adjusted_track_pos & 15) == (base_pos & 15))
|
|
|
|
|
return 1;
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* State 1: Find sector ID */
|
|
|
|
|
void
|
2019-02-06 03:34:39 +01:00
|
|
|
d86f_find_address_mark_fm(int drive, int side, find_t *find, uint16_t req_am, uint16_t other_am, uint16_t wrong_am, uint16_t ignore_other_am)
|
2018-03-19 01:02:04 +01:00
|
|
|
{
|
|
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
|
|
|
|
|
d86f_get_bit(drive, side);
|
|
|
|
|
|
|
|
|
|
if (dev->last_word[side] == req_am) {
|
|
|
|
|
dev->calc_crc.word = 0xFFFF;
|
|
|
|
|
fdd_calccrc(decodefm(drive, dev->last_word[side]), &(dev->calc_crc));
|
|
|
|
|
find->sync_marks = find->bits_obtained = find->bytes_obtained = 0;
|
|
|
|
|
find->sync_pos = 0xFFFFFFFF;
|
|
|
|
|
dev->preceding_bit[side] = dev->last_word[side] & 1;
|
|
|
|
|
dev->state++;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2019-02-06 03:34:39 +01:00
|
|
|
if ((wrong_am) && (dev->last_word[side] == wrong_am)) {
|
|
|
|
|
dev->data_find.sync_marks = dev->data_find.bits_obtained = dev->data_find.bytes_obtained = 0;
|
|
|
|
|
dev->error_condition = 0;
|
|
|
|
|
dev->state = STATE_IDLE;
|
|
|
|
|
fdc_finishread(d86f_fdc);
|
|
|
|
|
fdc_nodataam(d86f_fdc);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if ((ignore_other_am & 2) && (dev->last_word[side] == other_am)) {
|
|
|
|
|
dev->calc_crc.word = 0xFFFF;
|
|
|
|
|
fdd_calccrc(decodefm(drive, dev->last_word[side]), &(dev->calc_crc));
|
|
|
|
|
find->sync_marks = find->bits_obtained = find->bytes_obtained = 0;
|
|
|
|
|
find->sync_pos = 0xFFFFFFFF;
|
|
|
|
|
if (ignore_other_am & 1) {
|
|
|
|
|
/* Skip mode, let's go back to finding ID. */
|
|
|
|
|
dev->state -= 2;
|
|
|
|
|
} else {
|
|
|
|
|
/* Not skip mode, process the sector anyway. */
|
|
|
|
|
fdc_set_wrong_am(d86f_fdc);
|
|
|
|
|
dev->preceding_bit[side] = dev->last_word[side] & 1;
|
|
|
|
|
dev->state++;
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* When writing in FM mode, we find the beginning of the address mark by looking for 352 (22 * 16) set bits (gap fill = 0xFF, 0xFFFF FM-encoded). */
|
|
|
|
|
void
|
|
|
|
|
d86f_write_find_address_mark_fm(int drive, int side, find_t *find)
|
|
|
|
|
{
|
|
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
|
|
|
|
|
d86f_get_bit(drive, side);
|
|
|
|
|
|
|
|
|
|
if (dev->last_word[side] & 1) {
|
|
|
|
|
find->sync_marks++;
|
|
|
|
|
if (find->sync_marks == 352) {
|
|
|
|
|
dev->calc_crc.word = 0xFFFF;
|
|
|
|
|
dev->preceding_bit[side] = 1;
|
|
|
|
|
find->sync_marks = 0;
|
|
|
|
|
dev->state++;
|
|
|
|
|
return;
|
2016-09-05 21:58:28 +02:00
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If we hadn't found enough set bits but have found a clear bit, null the counter of set bits. */
|
|
|
|
|
if (!(dev->last_word[side] & 1)) {
|
|
|
|
|
find->sync_marks = find->bits_obtained = find->bytes_obtained = 0;
|
|
|
|
|
find->sync_pos = 0xFFFFFFFF;
|
|
|
|
|
}
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
2016-09-27 03:16:57 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
void
|
2019-02-06 03:34:39 +01:00
|
|
|
d86f_find_address_mark_mfm(int drive, int side, find_t *find, uint16_t req_am, uint16_t other_am, uint16_t wrong_am, uint16_t ignore_other_am)
|
2016-11-02 22:39:07 +01:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
|
|
|
|
|
d86f_get_bit(drive, side);
|
|
|
|
|
|
|
|
|
|
if (dev->last_word[side] == 0x4489) {
|
|
|
|
|
find->sync_marks++;
|
|
|
|
|
find->sync_pos = dev->track_pos;
|
|
|
|
|
return;
|
|
|
|
|
}
|
2016-08-31 22:49:56 +02:00
|
|
|
|
2019-02-06 03:34:39 +01:00
|
|
|
if ((wrong_am) && (dev->last_word[side] == wrong_am) && (find->sync_marks >= 3)) {
|
|
|
|
|
dev->data_find.sync_marks = dev->data_find.bits_obtained = dev->data_find.bytes_obtained = 0;
|
|
|
|
|
dev->error_condition = 0;
|
|
|
|
|
dev->state = STATE_IDLE;
|
|
|
|
|
fdc_finishread(d86f_fdc);
|
|
|
|
|
fdc_nodataam(d86f_fdc);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if ((dev->last_word[side] == req_am) && (find->sync_marks >= 3)) {
|
|
|
|
|
if (d86f_word_is_aligned(drive, side, find->sync_pos)) {
|
|
|
|
|
dev->calc_crc.word = 0xCDB4;
|
|
|
|
|
fdd_calccrc(decodefm(drive, dev->last_word[side]), &(dev->calc_crc));
|
2016-11-02 22:39:07 +01:00
|
|
|
find->sync_marks = find->bits_obtained = find->bytes_obtained = 0;
|
|
|
|
|
find->sync_pos = 0xFFFFFFFF;
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->preceding_bit[side] = dev->last_word[side] & 1;
|
|
|
|
|
dev->state++;
|
2016-11-02 22:39:07 +01:00
|
|
|
return;
|
|
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
}
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if ((ignore_other_am & 2) && (dev->last_word[side] == other_am) && (find->sync_marks >= 3)) {
|
|
|
|
|
if (d86f_word_is_aligned(drive, side, find->sync_pos)) {
|
|
|
|
|
dev->calc_crc.word = 0xCDB4;
|
|
|
|
|
fdd_calccrc(decodefm(drive, dev->last_word[side]), &(dev->calc_crc));
|
2016-11-02 22:39:07 +01:00
|
|
|
find->sync_marks = find->bits_obtained = find->bytes_obtained = 0;
|
|
|
|
|
find->sync_pos = 0xFFFFFFFF;
|
2018-03-19 01:02:04 +01:00
|
|
|
if (ignore_other_am & 1) {
|
2016-11-02 22:39:07 +01:00
|
|
|
/* Skip mode, let's go back to finding ID. */
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->state -= 2;
|
|
|
|
|
} else {
|
2016-11-02 22:39:07 +01:00
|
|
|
/* Not skip mode, process the sector anyway. */
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc_set_wrong_am(d86f_fdc);
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->preceding_bit[side] = dev->last_word[side] & 1;
|
|
|
|
|
dev->state++;
|
2016-09-26 21:03:23 +02:00
|
|
|
}
|
2016-11-02 22:39:07 +01:00
|
|
|
return;
|
2016-08-31 22:49:56 +02:00
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
}
|
2016-09-22 21:22:56 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (dev->last_word[side] != 0x4489) {
|
|
|
|
|
if (d86f_word_is_aligned(drive, side, find->sync_pos)) {
|
2016-11-02 22:39:07 +01:00
|
|
|
find->sync_marks = find->bits_obtained = find->bytes_obtained = 0;
|
|
|
|
|
find->sync_pos = 0xFFFFFFFF;
|
2016-08-31 22:49:56 +02:00
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
}
|
2016-08-20 03:40:12 +02:00
|
|
|
}
|
|
|
|
|
|
2016-08-31 22:49:56 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
/* When writing in MFM mode, we find the beginning of the address mark by looking for 3 0xA1 sync bytes. */
|
|
|
|
|
void
|
|
|
|
|
d86f_write_find_address_mark_mfm(int drive, int side, find_t *find)
|
|
|
|
|
{
|
|
|
|
|
d86f_t *dev = d86f[drive];
|
2016-08-31 22:49:56 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_get_bit(drive, side);
|
2016-09-22 21:22:56 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (dev->last_word[side] == 0x4489) {
|
|
|
|
|
find->sync_marks++;
|
|
|
|
|
find->sync_pos = dev->track_pos;
|
|
|
|
|
if (find->sync_marks == 3) {
|
|
|
|
|
dev->calc_crc.word = 0xCDB4;
|
|
|
|
|
dev->preceding_bit[side] = 1;
|
|
|
|
|
find->sync_marks = 0;
|
|
|
|
|
dev->state++;
|
|
|
|
|
return;
|
2016-08-31 22:49:56 +02:00
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
}
|
2016-08-31 22:49:56 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
/* If we hadn't found enough address mark sync marks, null the counter. */
|
|
|
|
|
if (dev->last_word[side] != 0x4489) {
|
|
|
|
|
if (d86f_word_is_aligned(drive, side, find->sync_pos)) {
|
|
|
|
|
find->sync_marks = find->bits_obtained = find->bytes_obtained = 0;
|
|
|
|
|
find->sync_pos = 0xFFFFFFFF;
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
}
|
2016-08-20 03:40:12 +02:00
|
|
|
}
|
|
|
|
|
|
2016-10-05 05:37:07 +02:00
|
|
|
|
2016-11-02 22:39:07 +01:00
|
|
|
/* State 2: Read sector ID and CRC*/
|
2018-03-19 01:02:04 +01:00
|
|
|
void
|
|
|
|
|
d86f_read_sector_id(int drive, int side, int match)
|
|
|
|
|
{
|
|
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
|
|
|
|
|
if (dev->id_find.bits_obtained) {
|
|
|
|
|
if (! (dev->id_find.bits_obtained & 15)) {
|
|
|
|
|
/* We've got a byte. */
|
|
|
|
|
if (dev->id_find.bytes_obtained < 4) {
|
|
|
|
|
dev->last_sector.byte_array[dev->id_find.bytes_obtained] = decodefm(drive, dev->last_word[side]);
|
|
|
|
|
fdd_calccrc(dev->last_sector.byte_array[dev->id_find.bytes_obtained], &(dev->calc_crc));
|
|
|
|
|
} else if ((dev->id_find.bytes_obtained >= 4) && (dev->id_find.bytes_obtained < 6)) {
|
|
|
|
|
dev->track_crc.bytes[(dev->id_find.bytes_obtained & 1) ^ 1] = decodefm(drive, dev->last_word[side]);
|
|
|
|
|
}
|
|
|
|
|
dev->id_find.bytes_obtained++;
|
|
|
|
|
|
|
|
|
|
if (dev->id_find.bytes_obtained == 6) {
|
|
|
|
|
/* We've got the ID. */
|
2019-02-06 03:34:39 +01:00
|
|
|
if ((dev->calc_crc.word != dev->track_crc.word) && (dev->last_sector.dword == dev->req_sector.dword)) {
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->id_find.sync_marks = dev->id_find.bits_obtained = dev->id_find.bytes_obtained = 0;
|
|
|
|
|
d86f_log("86F: ID CRC error: %04X != %04X (%08X)\n", dev->track_crc.word, dev->calc_crc.word, dev->last_sector.dword);
|
|
|
|
|
if ((dev->state != STATE_02_READ_ID) && (dev->state != STATE_0A_READ_ID)) {
|
|
|
|
|
dev->error_condition = 0;
|
|
|
|
|
dev->state = STATE_IDLE;
|
|
|
|
|
fdc_finishread(d86f_fdc);
|
|
|
|
|
fdc_headercrcerror(d86f_fdc);
|
2018-07-15 01:41:53 +02:00
|
|
|
} else if (dev->state == STATE_0A_READ_ID)
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->state--;
|
2018-07-15 01:41:53 +02:00
|
|
|
else {
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->error_condition |= 1; /* Mark that there was an ID CRC error. */
|
|
|
|
|
dev->state++;
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
} else if ((dev->calc_crc.word == dev->track_crc.word) && (dev->state == STATE_0A_READ_ID)) {
|
|
|
|
|
/* CRC is valid and this is a read sector ID command. */
|
|
|
|
|
dev->id_find.sync_marks = dev->id_find.bits_obtained = dev->id_find.bytes_obtained = dev->error_condition = 0;
|
|
|
|
|
fdc_sectorid(d86f_fdc, dev->last_sector.id.c, dev->last_sector.id.h, dev->last_sector.id.r, dev->last_sector.id.n, 0, 0);
|
|
|
|
|
dev->state = STATE_IDLE;
|
|
|
|
|
} else {
|
|
|
|
|
/* CRC is valid. */
|
|
|
|
|
dev->id_find.sync_marks = dev->id_find.bits_obtained = dev->id_find.bytes_obtained = 0;
|
2020-06-27 23:27:19 +02:00
|
|
|
dev->id_found |= 1;
|
2018-03-19 01:02:04 +01:00
|
|
|
if ((dev->last_sector.dword == dev->req_sector.dword) || !match) {
|
|
|
|
|
d86f_handler[drive].set_sector(drive, side, dev->last_sector.id.c, dev->last_sector.id.h, dev->last_sector.id.r, dev->last_sector.id.n);
|
|
|
|
|
if (dev->state == STATE_02_READ_ID) {
|
|
|
|
|
/* READ TRACK command, we need some special handling here. */
|
|
|
|
|
/* Code corrected: Only the C, H, and N portions of the sector ID are compared, the R portion (the sector number) is ignored. */
|
|
|
|
|
if ((dev->last_sector.id.c != fdc_get_read_track_sector(d86f_fdc).id.c) || (dev->last_sector.id.h != fdc_get_read_track_sector(d86f_fdc).id.h) || (dev->last_sector.id.n != fdc_get_read_track_sector(d86f_fdc).id.n)) {
|
|
|
|
|
dev->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. */
|
|
|
|
|
dev->last_sector.id.n = fdc_get_read_track_sector(d86f_fdc).id.n;
|
2016-11-11 03:16:41 +01:00
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
/* If the two ID's are identical, then we do not need to do anything regarding the sector size. */
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->state++;
|
|
|
|
|
} else {
|
|
|
|
|
if (dev->last_sector.id.c != dev->req_sector.id.c) {
|
|
|
|
|
if (dev->last_sector.id.c == 0xFF) {
|
|
|
|
|
dev->error_condition |= 8;
|
|
|
|
|
} else {
|
|
|
|
|
dev->error_condition |= 0x10;
|
2016-12-23 03:16:24 +01:00
|
|
|
}
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
dev->state--;
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-08-31 22:49:56 +02:00
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
}
|
2016-08-20 03:40:12 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_get_bit(drive, side);
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->id_find.bits_obtained++;
|
2016-08-20 03:40:12 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
uint8_t
|
|
|
|
|
d86f_get_data(int drive, int base)
|
2016-08-20 03:40:12 +02:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
int data;
|
2016-09-26 21:03:23 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (dev->data_find.bytes_obtained < (d86f_get_data_len(drive) + base)) {
|
|
|
|
|
data = fdc_getdata(d86f_fdc, dev->data_find.bytes_obtained == (d86f_get_data_len(drive) + base - 1));
|
|
|
|
|
if ((data & DMA_OVER) || (data == -1)) {
|
|
|
|
|
dev->dma_over++;
|
|
|
|
|
if (data == -1)
|
|
|
|
|
data = 0;
|
|
|
|
|
else
|
|
|
|
|
data &= 0xff;
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
} else {
|
|
|
|
|
data = 0;
|
|
|
|
|
}
|
2016-09-03 18:07:46 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
return data;
|
2016-09-22 21:22:56 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
d86f_compare_byte(int drive, uint8_t received_byte, uint8_t disk_byte)
|
2016-09-22 21:22:56 +02:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
|
|
|
|
|
switch(fdc_get_compare_condition(d86f_fdc)) {
|
|
|
|
|
case 0: /* SCAN EQUAL */
|
|
|
|
|
if ((received_byte == disk_byte) || (received_byte == 0xFF))
|
|
|
|
|
dev->satisfying_bytes++;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 1: /* SCAN LOW OR EQUAL */
|
|
|
|
|
if ((received_byte <= disk_byte) || (received_byte == 0xFF))
|
|
|
|
|
dev->satisfying_bytes++;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 2: /* SCAN HIGH OR EQUAL */
|
|
|
|
|
if ((received_byte >= disk_byte) || (received_byte == 0xFF))
|
|
|
|
|
dev->satisfying_bytes++;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2016-09-22 21:22:56 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
2016-11-02 22:39:07 +01:00
|
|
|
/* State 4: Read sector data and CRC*/
|
2018-03-19 01:02:04 +01:00
|
|
|
void
|
|
|
|
|
d86f_read_sector_data(int drive, int side)
|
|
|
|
|
{
|
|
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
int data = 0;
|
|
|
|
|
int recv_data = 0;
|
|
|
|
|
int read_status = 0;
|
|
|
|
|
uint32_t sector_len = dev->last_sector.id.n;
|
|
|
|
|
uint32_t crc_pos = 0;
|
|
|
|
|
sector_len = 1 << (7 + sector_len);
|
|
|
|
|
crc_pos = sector_len + 2;
|
|
|
|
|
|
|
|
|
|
if (dev->data_find.bits_obtained) {
|
|
|
|
|
if (!(dev->data_find.bits_obtained & 15)) {
|
|
|
|
|
/* We've got a byte. */
|
2018-07-15 01:41:53 +02:00
|
|
|
d86f_log("86F: We've got a byte.\n");
|
2018-03-19 01:02:04 +01:00
|
|
|
if (dev->data_find.bytes_obtained < sector_len) {
|
2019-12-05 21:36:28 +01:00
|
|
|
if (d86f_handler[drive].read_data != NULL)
|
|
|
|
|
data = d86f_handler[drive].read_data(drive, side, dev->data_find.bytes_obtained);
|
|
|
|
|
else {
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
#ifdef HACK_FOR_DBASE_III
|
2019-12-05 21:36:28 +01:00
|
|
|
if ((dev->last_sector.id.c == 39) && (dev->last_sector.id.h == 0) &&
|
|
|
|
|
(dev->last_sector.id.r == 5) && (dev->data_find.bytes_obtained >= 272))
|
|
|
|
|
data = (random_generate() & 0xff);
|
|
|
|
|
else
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
#endif
|
2019-12-05 21:36:28 +01:00
|
|
|
data = decodefm(drive, dev->last_word[side]);
|
|
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
if (dev->state == STATE_11_SCAN_DATA) {
|
|
|
|
|
/* Scan/compare command. */
|
|
|
|
|
recv_data = d86f_get_data(drive, 0);
|
|
|
|
|
d86f_compare_byte(drive, recv_data, data);
|
|
|
|
|
} else {
|
|
|
|
|
if (dev->data_find.bytes_obtained < d86f_get_data_len(drive)) {
|
|
|
|
|
if (dev->state != STATE_16_VERIFY_DATA) {
|
2021-09-17 02:18:23 +02:00
|
|
|
read_status = fdc_data(d86f_fdc, data, dev->data_find.bytes_obtained == ((d86f_get_data_len(drive)) - 1));
|
2018-07-15 01:41:53 +02:00
|
|
|
if (read_status == -1)
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->dma_over++;
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
fdd_calccrc(data, &(dev->calc_crc));
|
2018-07-15 01:41:53 +02:00
|
|
|
} else if (dev->data_find.bytes_obtained < crc_pos)
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->track_crc.bytes[(dev->data_find.bytes_obtained - sector_len) ^ 1] = decodefm(drive, dev->last_word[side]);
|
|
|
|
|
dev->data_find.bytes_obtained++;
|
2016-12-23 03:16:24 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (dev->data_find.bytes_obtained == (crc_pos + fdc_get_gap(d86f_fdc))) {
|
|
|
|
|
/* We've got the data. */
|
|
|
|
|
if ((dev->calc_crc.word != dev->track_crc.word) && (dev->state != STATE_02_READ_DATA)) {
|
|
|
|
|
d86f_log("86F: Data CRC error: %04X != %04X (%08X)\n", dev->track_crc.word, dev->calc_crc.word, dev->last_sector.dword);
|
|
|
|
|
dev->data_find.sync_marks = dev->data_find.bits_obtained = dev->data_find.bytes_obtained = 0;
|
|
|
|
|
dev->error_condition = 0;
|
|
|
|
|
dev->state = STATE_IDLE;
|
|
|
|
|
fdc_finishread(d86f_fdc);
|
|
|
|
|
fdc_datacrcerror(d86f_fdc);
|
|
|
|
|
} else if ((dev->calc_crc.word != dev->track_crc.word) && (dev->state == STATE_02_READ_DATA)) {
|
|
|
|
|
dev->data_find.sync_marks = dev->data_find.bits_obtained = dev->data_find.bytes_obtained = 0;
|
|
|
|
|
dev->error_condition |= 2; /* Mark that there was a data error. */
|
|
|
|
|
dev->state = STATE_IDLE;
|
|
|
|
|
fdc_track_finishread(d86f_fdc, dev->error_condition);
|
|
|
|
|
} else {
|
|
|
|
|
/* CRC is valid. */
|
2019-12-05 21:36:28 +01:00
|
|
|
d86f_log("86F: Data CRC OK: %04X == %04X (%08X)\n", dev->track_crc.word, dev->calc_crc.word, dev->last_sector.dword);
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->data_find.sync_marks = dev->data_find.bits_obtained = dev->data_find.bytes_obtained = 0;
|
|
|
|
|
dev->error_condition = 0;
|
2018-07-15 01:41:53 +02:00
|
|
|
dev->state = STATE_IDLE;
|
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
|
|
|
if (dev->state == STATE_02_READ_DATA)
|
|
|
|
|
fdc_track_finishread(d86f_fdc, dev->error_condition);
|
|
|
|
|
else if (dev->state == STATE_11_SCAN_DATA)
|
2018-03-19 01:02:04 +01:00
|
|
|
fdc_sector_finishcompare(d86f_fdc, (dev->satisfying_bytes == ((128 << ((uint32_t) dev->last_sector.id.n)) - 1)) ? 1 : 0);
|
2018-07-15 01:41:53 +02:00
|
|
|
else
|
2018-03-19 01:02:04 +01:00
|
|
|
fdc_sector_finishread(d86f_fdc);
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
|
|
|
|
}
|
2016-09-22 21:22:56 +02:00
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
}
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_get_bit(drive, side);
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->data_find.bits_obtained++;
|
2016-09-22 21:22:56 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
d86f_write_sector_data(int drive, int side, int mfm, uint16_t am)
|
2016-09-22 21:22:56 +02:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
uint16_t bit_pos;
|
|
|
|
|
uint16_t temp;
|
|
|
|
|
uint32_t sector_len = dev->last_sector.id.n;
|
|
|
|
|
uint32_t crc_pos = 0;
|
|
|
|
|
sector_len = (1 << (7 + sector_len)) + 1;
|
|
|
|
|
crc_pos = sector_len + 2;
|
2016-09-22 21:22:56 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (! (dev->data_find.bits_obtained & 15)) {
|
|
|
|
|
if (dev->data_find.bytes_obtained < crc_pos) {
|
|
|
|
|
if (! dev->data_find.bytes_obtained) {
|
|
|
|
|
/* We're writing the address mark. */
|
|
|
|
|
dev->current_byte[side] = am;
|
|
|
|
|
} else if (dev->data_find.bytes_obtained < sector_len) {
|
|
|
|
|
/* We're in the data field of the sector, read byte from FDC and request new byte. */
|
|
|
|
|
dev->current_byte[side] = d86f_get_data(drive, 1);
|
|
|
|
|
if (! fdc_get_diswr(d86f_fdc))
|
|
|
|
|
d86f_handler[drive].write_data(drive, side, dev->data_find.bytes_obtained - 1, dev->current_byte[side]);
|
|
|
|
|
} else {
|
|
|
|
|
/* We're in the data field of the sector, use a CRC byte. */
|
|
|
|
|
dev->current_byte[side] = dev->calc_crc.bytes[(dev->data_find.bytes_obtained & 1)];
|
|
|
|
|
}
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->current_bit[side] = (15 - (dev->data_find.bits_obtained & 15)) >> 1;
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
/* Write the bit. */
|
|
|
|
|
temp = (dev->current_byte[side] >> dev->current_bit[side]) & 1;
|
|
|
|
|
if ((!temp && !dev->preceding_bit[side]) || !mfm) {
|
|
|
|
|
temp |= 2;
|
|
|
|
|
}
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
/* This is an even bit, so write the clock. */
|
|
|
|
|
if (! dev->data_find.bytes_obtained) {
|
|
|
|
|
/* Address mark, write bit directly. */
|
|
|
|
|
d86f_put_bit(drive, side, am >> 15);
|
|
|
|
|
} else {
|
|
|
|
|
d86f_put_bit(drive, side, temp >> 1);
|
|
|
|
|
}
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (dev->data_find.bytes_obtained < sector_len) {
|
|
|
|
|
/* This is a data byte, so CRC it. */
|
|
|
|
|
if (! dev->data_find.bytes_obtained) {
|
|
|
|
|
fdd_calccrc(decodefm(drive, am), &(dev->calc_crc));
|
|
|
|
|
} else {
|
|
|
|
|
fdd_calccrc(dev->current_byte[side], &(dev->calc_crc));
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
|
|
|
|
}
|
2016-09-22 21:22:56 +02:00
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
} else {
|
|
|
|
|
if (dev->data_find.bytes_obtained < crc_pos) {
|
|
|
|
|
/* Encode the bit. */
|
|
|
|
|
bit_pos = 15 - (dev->data_find.bits_obtained & 15);
|
|
|
|
|
dev->current_bit[side] = bit_pos >> 1;
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
temp = (dev->current_byte[side] >> dev->current_bit[side]) & 1;
|
|
|
|
|
if ((!temp && !dev->preceding_bit[side]) || !mfm) {
|
|
|
|
|
temp |= 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (! dev->data_find.bytes_obtained) {
|
|
|
|
|
/* Address mark, write directly. */
|
|
|
|
|
d86f_put_bit(drive, side, am >> bit_pos);
|
|
|
|
|
if (! (bit_pos & 1)) {
|
|
|
|
|
dev->preceding_bit[side] = am >> bit_pos;
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
} else {
|
|
|
|
|
if (bit_pos & 1) {
|
|
|
|
|
/* Clock bit */
|
|
|
|
|
d86f_put_bit(drive, side, temp >> 1);
|
|
|
|
|
} else {
|
|
|
|
|
/* Data bit */
|
|
|
|
|
d86f_put_bit(drive, side, temp & 1);
|
|
|
|
|
dev->preceding_bit[side] = temp & 1;
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
|
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
}
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if ((dev->data_find.bits_obtained & 15) == 15) {
|
|
|
|
|
dev->data_find.bytes_obtained++;
|
2016-12-23 03:16:24 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (dev->data_find.bytes_obtained == (crc_pos + fdc_get_gap(d86f_fdc))) {
|
|
|
|
|
/* We've written the data. */
|
|
|
|
|
dev->data_find.sync_marks = dev->data_find.bits_obtained = dev->data_find.bytes_obtained = 0;
|
|
|
|
|
dev->error_condition = 0;
|
|
|
|
|
dev->state = STATE_IDLE;
|
|
|
|
|
fdc_sector_finishread(d86f_fdc);
|
|
|
|
|
return;
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
2016-09-22 21:22:56 +02:00
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
}
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->data_find.bits_obtained++;
|
2016-09-22 21:22:56 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
2016-11-02 22:39:07 +01:00
|
|
|
void d86f_advance_bit(int drive, int side)
|
2016-09-27 03:16:57 +02:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->track_pos++;
|
|
|
|
|
dev->track_pos %= d86f_handler[drive].get_raw_size(drive, side);
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (dev->track_pos == d86f_handler[drive].index_hole_pos(drive, side)) {
|
|
|
|
|
d86f_handler[drive].read_revolution(drive);
|
|
|
|
|
|
|
|
|
|
if (dev->state != STATE_IDLE)
|
|
|
|
|
dev->index_count++;
|
|
|
|
|
}
|
2016-11-10 21:16:24 +01:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
d86f_advance_word(int drive, int side)
|
2016-11-10 21:16:24 +01:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
|
|
|
|
|
dev->track_pos += 16;
|
|
|
|
|
dev->track_pos %= d86f_handler[drive].get_raw_size(drive, side);
|
2016-12-23 03:16:24 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if ((dev->track_pos == d86f_handler[drive].index_hole_pos(drive, side)) && (dev->state != STATE_IDLE))
|
|
|
|
|
dev->index_count++;
|
2016-11-10 21:16:24 +01:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
d86f_spin_to_index(int drive, int side)
|
2016-11-10 21:16:24 +01:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
2016-11-10 21:16:24 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_get_bit(drive, side);
|
|
|
|
|
d86f_get_bit(drive, side ^ 1);
|
2016-11-10 21:16:24 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_advance_bit(drive, side);
|
|
|
|
|
|
|
|
|
|
if (dev->track_pos == d86f_handler[drive].index_hole_pos(drive, side)) {
|
2020-06-28 04:46:32 +02:00
|
|
|
if (dev->state == STATE_0D_SPIN_TO_INDEX) {
|
2018-03-19 01:02:04 +01:00
|
|
|
/* When starting format, reset format state to the beginning. */
|
|
|
|
|
dev->preceding_bit[side] = 1;
|
|
|
|
|
dev->format_state = FMT_PRETRK_GAP0;
|
2016-11-10 21:16:24 +01:00
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
/* This is to make sure both READ TRACK and FORMAT TRACK command don't end prematurely. */
|
|
|
|
|
dev->index_count = 0;
|
|
|
|
|
dev->state++;
|
|
|
|
|
}
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
d86f_write_direct_common(int drive, int side, uint16_t byte, uint8_t type, uint32_t pos)
|
2016-11-02 22:39:07 +01:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
uint16_t encoded_byte = 0, mask_data, mask_surface, mask_hole, mask_fuzzy;
|
|
|
|
|
decoded_t dbyte, dpbyte;
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (fdc_get_diswr(d86f_fdc)) return;
|
2018-01-17 18:43:36 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
dbyte.byte = byte & 0xff;
|
|
|
|
|
dpbyte.byte = dev->preceding_bit[side] & 0xff;
|
|
|
|
|
|
|
|
|
|
if (type == 0) {
|
|
|
|
|
/* Byte write. */
|
|
|
|
|
encoded_byte = d86f_encode_byte(drive, 0, dbyte, dpbyte);
|
|
|
|
|
if (! d86f_reverse_bytes(drive)) {
|
|
|
|
|
mask_data = encoded_byte >> 8;
|
|
|
|
|
encoded_byte &= 0xFF;
|
|
|
|
|
encoded_byte <<= 8;
|
|
|
|
|
encoded_byte |= mask_data;
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
} else {
|
|
|
|
|
/* Word write. */
|
|
|
|
|
encoded_byte = byte;
|
|
|
|
|
if (d86f_reverse_bytes(drive)) {
|
|
|
|
|
mask_data = encoded_byte >> 8;
|
|
|
|
|
encoded_byte &= 0xFF;
|
|
|
|
|
encoded_byte <<= 8;
|
|
|
|
|
encoded_byte |= mask_data;
|
2016-09-22 21:22:56 +02:00
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
}
|
2016-09-22 21:22:56 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->preceding_bit[side] = encoded_byte & 1;
|
2017-05-05 01:49:42 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (d86f_has_surface_desc(drive)) {
|
|
|
|
|
mask_data = dev->track_encoded_data[side][pos] ^= 0xFFFF;
|
|
|
|
|
mask_surface = dev->track_surface_data[side][pos];
|
|
|
|
|
mask_hole = (mask_surface & mask_data) ^ 0xFFFF; /* This will retain bits that are both fuzzy and 0, therefore physical holes. */
|
|
|
|
|
encoded_byte &= mask_hole; /* Filter out physical hole bits from the encoded data. */
|
|
|
|
|
mask_data ^= 0xFFFF; /* Invert back so bits 1 are 1 again. */
|
|
|
|
|
mask_fuzzy = (mask_surface & mask_data) ^ 0xFFFF; /* All fuzzy bits are 0. */
|
|
|
|
|
dev->track_surface_data[side][pos] &= mask_fuzzy; /* Remove fuzzy bits (but not hole bits) from the surface mask, making them regular again. */
|
|
|
|
|
}
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->track_encoded_data[side][pos] = encoded_byte;
|
|
|
|
|
dev->last_word[side] = encoded_byte;
|
2016-08-31 22:49:56 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
d86f_write_direct(int drive, int side, uint16_t byte, uint8_t type)
|
2016-09-22 21:22:56 +02:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
|
|
|
|
|
d86f_write_direct_common(drive, side, byte, type, dev->track_pos >> 4);
|
2016-09-22 21:22:56 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
uint16_t
|
|
|
|
|
endian_swap(uint16_t word)
|
2016-09-17 20:22:02 +02:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
uint16_t temp;
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
temp = word & 0xff;
|
|
|
|
|
temp <<= 8;
|
|
|
|
|
temp |= (word >> 8);
|
|
|
|
|
|
|
|
|
|
return temp;
|
2016-09-17 20:22:02 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
d86f_format_finish(int drive, int side, int mfm, uint16_t sc, uint16_t gap_fill, int do_write)
|
2016-12-23 03:16:24 +01:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
|
|
|
|
|
if (mfm && do_write) {
|
|
|
|
|
if (do_write && (dev->track_pos == d86f_handler[drive].index_hole_pos(drive, side))) {
|
|
|
|
|
d86f_write_direct_common(drive, side, gap_fill, 0, 0);
|
2016-12-23 03:16:24 +01:00
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
}
|
2016-12-23 03:16:24 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->state = STATE_IDLE;
|
2017-05-05 01:49:42 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (do_write)
|
|
|
|
|
d86f_handler[drive].writeback(drive);
|
2017-05-05 01:49:42 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->error_condition = 0;
|
|
|
|
|
dev->datac = 0;
|
|
|
|
|
fdc_sector_finishread(d86f_fdc);
|
2016-12-23 03:16:24 +01:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
d86f_format_turbo_finish(int drive, int side, int do_write)
|
2017-07-26 00:16:54 +02:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
2017-07-26 00:16:54 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->state = STATE_IDLE;
|
2017-07-26 00:16:54 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (do_write)
|
|
|
|
|
d86f_handler[drive].writeback(drive);
|
|
|
|
|
|
|
|
|
|
dev->error_condition = 0;
|
|
|
|
|
dev->datac = 0;
|
|
|
|
|
fdc_sector_finishread(d86f_fdc);
|
2017-07-26 00:16:54 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
d86f_format_track(int drive, int side, int do_write)
|
|
|
|
|
{
|
|
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
int data;
|
|
|
|
|
uint16_t max_len;
|
|
|
|
|
|
|
|
|
|
int mfm;
|
|
|
|
|
uint16_t sc = 0;
|
|
|
|
|
uint16_t dtl = 0;
|
|
|
|
|
int gap_sizes[4] = { 0, 0, 0, 0 };
|
|
|
|
|
int am_len = 0;
|
|
|
|
|
int sync_len = 0;
|
|
|
|
|
uint16_t iam_mfm[4] = { 0x2452, 0x2452, 0x2452, 0x5255 };
|
|
|
|
|
uint16_t idam_mfm[4] = { 0x8944, 0x8944, 0x8944, 0x5455 };
|
|
|
|
|
uint16_t dataam_mfm[4] = { 0x8944, 0x8944, 0x8944, 0x4555 };
|
|
|
|
|
uint16_t iam_fm = 0xFAF7;
|
|
|
|
|
uint16_t idam_fm = 0x7EF5;
|
|
|
|
|
uint16_t dataam_fm = 0x6FF5;
|
|
|
|
|
uint16_t gap_fill = 0x4E;
|
|
|
|
|
|
|
|
|
|
mfm = d86f_is_mfm(drive);
|
|
|
|
|
am_len = mfm ? 4 : 1;
|
|
|
|
|
gap_sizes[0] = mfm ? 80 : 40;
|
|
|
|
|
gap_sizes[1] = mfm ? 50 : 26;
|
|
|
|
|
gap_sizes[2] = fdc_get_gap2(d86f_fdc, real_drive(d86f_fdc, drive));
|
|
|
|
|
gap_sizes[3] = fdc_get_gap(d86f_fdc);
|
|
|
|
|
sync_len = mfm ? 12 : 6;
|
|
|
|
|
sc = fdc_get_format_sectors(d86f_fdc);
|
|
|
|
|
dtl = 128 << fdc_get_format_n(d86f_fdc);
|
|
|
|
|
gap_fill = mfm ? 0x4E : 0xFF;
|
|
|
|
|
|
|
|
|
|
switch(dev->format_state) {
|
|
|
|
|
case FMT_POSTTRK_GAP4:
|
|
|
|
|
max_len = 60000;
|
|
|
|
|
if (do_write)
|
|
|
|
|
d86f_write_direct(drive, side, gap_fill, 0);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case FMT_PRETRK_GAP0:
|
|
|
|
|
max_len = gap_sizes[0];
|
|
|
|
|
if (do_write)
|
|
|
|
|
d86f_write_direct(drive, side, gap_fill, 0);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case FMT_SECTOR_ID_SYNC:
|
|
|
|
|
max_len = sync_len;
|
|
|
|
|
if (dev->datac <= 3) {
|
|
|
|
|
data = fdc_getdata(d86f_fdc, 0);
|
|
|
|
|
if (data != -1)
|
|
|
|
|
data &= 0xff;
|
|
|
|
|
if ((data == -1) && (dev->datac < 3))
|
|
|
|
|
data = 0;
|
2020-06-20 22:34:51 +02:00
|
|
|
d86f_fdc->format_sector_id.byte_array[dev->datac] = data & 0xff;
|
2018-03-19 01:02:04 +01:00
|
|
|
if (dev->datac == 3)
|
|
|
|
|
fdc_stop_id_request(d86f_fdc);
|
|
|
|
|
}
|
|
|
|
|
/*FALLTHROUGH*/
|
|
|
|
|
|
|
|
|
|
case FMT_PRETRK_SYNC:
|
|
|
|
|
case FMT_SECTOR_DATA_SYNC:
|
|
|
|
|
max_len = sync_len;
|
|
|
|
|
if (do_write)
|
|
|
|
|
d86f_write_direct(drive, side, 0x00, 0);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case FMT_PRETRK_IAM:
|
|
|
|
|
max_len = am_len;
|
|
|
|
|
if (do_write) {
|
2016-11-02 22:39:07 +01:00
|
|
|
if (mfm)
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_write_direct(drive, side, iam_mfm[dev->datac], 1);
|
2016-11-02 22:39:07 +01:00
|
|
|
else
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_write_direct(drive, side, iam_fm, 1);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case FMT_PRETRK_GAP1:
|
|
|
|
|
max_len = gap_sizes[1];
|
|
|
|
|
if (do_write)
|
|
|
|
|
d86f_write_direct(drive, side, gap_fill, 0);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case FMT_SECTOR_IDAM:
|
|
|
|
|
max_len = am_len;
|
|
|
|
|
if (mfm) {
|
2016-11-02 22:39:07 +01:00
|
|
|
if (do_write)
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_write_direct(drive, side, idam_mfm[dev->datac], 1);
|
|
|
|
|
d86f_calccrc(dev, (dev->datac < 3) ? 0xA1 : 0xFE);
|
|
|
|
|
} else {
|
2017-05-08 19:43:57 +02:00
|
|
|
if (do_write)
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_write_direct(drive, side, idam_fm, 1);
|
|
|
|
|
d86f_calccrc(dev, 0xFE);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case FMT_SECTOR_ID:
|
|
|
|
|
max_len = 4;
|
|
|
|
|
if (do_write) {
|
2020-06-20 22:34:51 +02:00
|
|
|
d86f_write_direct(drive, side, d86f_fdc->format_sector_id.byte_array[dev->datac], 0);
|
|
|
|
|
d86f_calccrc(dev, d86f_fdc->format_sector_id.byte_array[dev->datac]);
|
2018-03-19 01:02:04 +01:00
|
|
|
} else {
|
|
|
|
|
if (dev->datac == 3) {
|
2020-06-20 22:34:51 +02:00
|
|
|
d86f_handler[drive].set_sector(drive, side, d86f_fdc->format_sector_id.id.c, d86f_fdc->format_sector_id.id.h, d86f_fdc->format_sector_id.id.r, d86f_fdc->format_sector_id.id.n);
|
2018-03-19 01:02:04 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case FMT_SECTOR_ID_CRC:
|
|
|
|
|
case FMT_SECTOR_DATA_CRC:
|
|
|
|
|
max_len = 2;
|
|
|
|
|
if (do_write)
|
|
|
|
|
d86f_write_direct(drive, side, dev->calc_crc.bytes[dev->datac ^ 1], 0);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case FMT_SECTOR_GAP2:
|
|
|
|
|
max_len = gap_sizes[2];
|
|
|
|
|
if (do_write)
|
|
|
|
|
d86f_write_direct(drive, side, gap_fill, 0);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case FMT_SECTOR_DATAAM:
|
|
|
|
|
max_len = am_len;
|
|
|
|
|
if (mfm) {
|
|
|
|
|
if (do_write)
|
|
|
|
|
d86f_write_direct(drive, side, dataam_mfm[dev->datac], 1);
|
|
|
|
|
d86f_calccrc(dev, (dev->datac < 3) ? 0xA1 : 0xFB);
|
|
|
|
|
} else {
|
|
|
|
|
if (do_write)
|
|
|
|
|
d86f_write_direct(drive, side, dataam_fm, 1);
|
|
|
|
|
d86f_calccrc(dev, 0xFB);
|
|
|
|
|
}
|
|
|
|
|
break;
|
2016-08-20 03:40:12 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
case FMT_SECTOR_DATA:
|
|
|
|
|
max_len = dtl;
|
|
|
|
|
if (do_write) {
|
|
|
|
|
d86f_write_direct(drive, side, dev->fill, 0);
|
|
|
|
|
d86f_handler[drive].write_data(drive, side, dev->datac, dev->fill);
|
|
|
|
|
}
|
|
|
|
|
d86f_calccrc(dev, dev->fill);
|
|
|
|
|
break;
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
case FMT_SECTOR_GAP3:
|
|
|
|
|
max_len = gap_sizes[3];
|
|
|
|
|
if (do_write)
|
|
|
|
|
d86f_write_direct(drive, side, gap_fill, 0);
|
|
|
|
|
break;
|
2016-11-10 21:16:24 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
default:
|
|
|
|
|
max_len = 0;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dev->datac++;
|
|
|
|
|
|
|
|
|
|
d86f_advance_word(drive, side);
|
|
|
|
|
|
|
|
|
|
if ((dev->index_count) && ((dev->format_state < FMT_SECTOR_ID_SYNC) || (dev->format_state > FMT_SECTOR_GAP3))) {
|
|
|
|
|
d86f_format_finish(drive, side, mfm, sc, gap_fill, do_write);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2016-11-10 21:16:24 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (dev->datac >= max_len) {
|
|
|
|
|
dev->datac = 0;
|
|
|
|
|
dev->format_state++;
|
|
|
|
|
|
|
|
|
|
switch (dev->format_state) {
|
|
|
|
|
case FMT_SECTOR_ID_SYNC:
|
|
|
|
|
fdc_request_next_sector_id(d86f_fdc);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case FMT_SECTOR_IDAM:
|
|
|
|
|
case FMT_SECTOR_DATAAM:
|
|
|
|
|
dev->calc_crc.word = 0xffff;
|
|
|
|
|
break;
|
2016-09-22 21:22:56 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
case FMT_POSTTRK_CHECK:
|
|
|
|
|
if (dev->index_count) {
|
|
|
|
|
d86f_format_finish(drive, side, mfm, sc, gap_fill, do_write);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
dev->sector_count++;
|
|
|
|
|
if (dev->sector_count < sc) {
|
|
|
|
|
/* Sector within allotted amount, change state to SECTOR_ID_SYNC. */
|
|
|
|
|
dev->format_state = FMT_SECTOR_ID_SYNC;
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc_request_next_sector_id(d86f_fdc);
|
2016-11-10 21:16:24 +01:00
|
|
|
break;
|
2018-03-19 01:02:04 +01:00
|
|
|
} else {
|
|
|
|
|
dev->format_state = FMT_POSTTRK_GAP4;
|
|
|
|
|
dev->sector_count = 0;
|
2016-11-10 21:16:24 +01:00
|
|
|
break;
|
2018-03-19 01:02:04 +01:00
|
|
|
}
|
|
|
|
|
break;
|
2016-09-07 20:59:08 +02:00
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
}
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
2016-09-27 03:16:57 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
d86f_initialize_last_sector_id(int drive, int c, int h, int r, int n)
|
2017-07-26 00:16:54 +02:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
|
|
|
|
|
dev->last_sector.id.c = c;
|
|
|
|
|
dev->last_sector.id.h = h;
|
|
|
|
|
dev->last_sector.id.r = r;
|
|
|
|
|
dev->last_sector.id.n = n;
|
2017-07-26 00:16:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2019-12-05 21:36:28 +01:00
|
|
|
static uint8_t
|
|
|
|
|
d86f_sector_flags(int drive, int side, uint8_t c, uint8_t h, uint8_t r, uint8_t n)
|
|
|
|
|
{
|
|
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
sector_t *s, *t;
|
|
|
|
|
|
|
|
|
|
if (dev->last_side_sector[side]) {
|
|
|
|
|
s = dev->last_side_sector[side];
|
|
|
|
|
while (s) {
|
|
|
|
|
if ((s->c == c) && (s->h == h) && (s->r == r) && (s->n == n))
|
|
|
|
|
return s->flags;
|
|
|
|
|
if (! s->prev)
|
|
|
|
|
break;
|
|
|
|
|
t = s->prev;
|
|
|
|
|
s = t;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0x00;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
void
|
|
|
|
|
d86f_turbo_read(int drive, int side)
|
|
|
|
|
{
|
|
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
uint8_t dat = 0;
|
|
|
|
|
int recv_data = 0;
|
|
|
|
|
int read_status = 0;
|
2019-12-05 21:36:28 +01:00
|
|
|
uint8_t flags = d86f_sector_flags(drive, side, dev->req_sector.id.c, dev->req_sector.id.h, dev->req_sector.id.r, dev->req_sector.id.n);
|
2017-07-26 00:16:54 +02:00
|
|
|
|
2019-12-05 21:36:28 +01:00
|
|
|
if (d86f_handler[drive].read_data != NULL)
|
|
|
|
|
dat = d86f_handler[drive].read_data(drive, side, dev->turbo_pos);
|
|
|
|
|
else
|
|
|
|
|
dat = (random_generate() & 0xff);
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->turbo_pos++;
|
2017-07-26 00:16:54 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (dev->state == STATE_11_SCAN_DATA) {
|
|
|
|
|
/* Scan/compare command. */
|
|
|
|
|
recv_data = d86f_get_data(drive, 0);
|
|
|
|
|
d86f_compare_byte(drive, recv_data, dat);
|
|
|
|
|
} else {
|
|
|
|
|
if (dev->data_find.bytes_obtained < (128UL << dev->last_sector.id.n)) {
|
|
|
|
|
if (dev->state != STATE_16_VERIFY_DATA) {
|
2021-09-17 02:18:23 +02:00
|
|
|
read_status = fdc_data(d86f_fdc, dat, dev->data_find.bytes_obtained == ((128UL << dev->last_sector.id.n) - 1));
|
2018-03-19 01:02:04 +01:00
|
|
|
if (read_status == -1)
|
|
|
|
|
dev->dma_over++;
|
2017-07-26 00:16:54 +02:00
|
|
|
}
|
|
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
}
|
2017-07-26 00:16:54 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (dev->turbo_pos >= (128 << dev->last_sector.id.n)) {
|
|
|
|
|
dev->data_find.sync_marks = dev->data_find.bits_obtained = dev->data_find.bytes_obtained = 0;
|
2019-12-05 21:36:28 +01:00
|
|
|
if ((flags & SECTOR_CRC_ERROR) && (dev->state != STATE_02_READ_DATA)) {
|
|
|
|
|
#ifdef ENABLE_D86F_LOG
|
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
|
|
|
d86f_log("86F: Data CRC error in turbo mode (%02X)\n", dev->state);
|
2019-12-05 21:36:28 +01:00
|
|
|
#endif
|
|
|
|
|
dev->error_condition = 0;
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->state = STATE_IDLE;
|
2019-12-05 21:36:28 +01:00
|
|
|
fdc_finishread(d86f_fdc);
|
|
|
|
|
fdc_datacrcerror(d86f_fdc);
|
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
|
|
|
} else if ((flags & SECTOR_CRC_ERROR) && (dev->state == STATE_02_READ_DATA)) {
|
|
|
|
|
#ifdef ENABLE_D86F_LOG
|
|
|
|
|
d86f_log("86F: Data CRC error in turbo mode at READ TRACK command\n");
|
|
|
|
|
#endif
|
2019-12-05 21:36:28 +01:00
|
|
|
dev->error_condition |= 2; /* Mark that there was a data error. */
|
|
|
|
|
dev->state = STATE_IDLE;
|
|
|
|
|
fdc_track_finishread(d86f_fdc, dev->error_condition);
|
2018-03-19 01:02:04 +01:00
|
|
|
} else {
|
2019-12-05 21:36:28 +01:00
|
|
|
/* CRC is valid. */
|
|
|
|
|
#ifdef ENABLE_D86F_LOG
|
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
|
|
|
d86f_log("86F: Data CRC OK in turbo mode\n");
|
2019-12-05 21:36:28 +01:00
|
|
|
#endif
|
|
|
|
|
dev->error_condition = 0;
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->state = STATE_IDLE;
|
2019-12-05 21:36:28 +01:00
|
|
|
if (dev->state == STATE_11_SCAN_DATA)
|
|
|
|
|
fdc_sector_finishcompare(d86f_fdc, (dev->satisfying_bytes == ((128 << ((uint32_t) dev->last_sector.id.n)) - 1)) ? 1 : 0);
|
|
|
|
|
else
|
|
|
|
|
fdc_sector_finishread(d86f_fdc);
|
2017-07-26 00:16:54 +02:00
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
}
|
2017-07-26 00:16:54 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
d86f_turbo_write(int drive, int side)
|
2017-07-26 00:16:54 +02:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
uint8_t dat = 0;
|
2017-07-26 00:16:54 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
dat = d86f_get_data(drive, 1);
|
|
|
|
|
d86f_handler[drive].write_data(drive, side, dev->turbo_pos, dat);
|
2017-07-26 00:16:54 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->turbo_pos++;
|
2017-07-26 00:16:54 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (dev->turbo_pos >= (128 << dev->last_sector.id.n)) {
|
|
|
|
|
/* We've written the data. */
|
|
|
|
|
dev->data_find.sync_marks = dev->data_find.bits_obtained = dev->data_find.bytes_obtained = 0;
|
|
|
|
|
dev->error_condition = 0;
|
|
|
|
|
dev->state = STATE_IDLE;
|
|
|
|
|
d86f_handler[drive].writeback(drive);
|
|
|
|
|
fdc_sector_finishread(d86f_fdc);
|
|
|
|
|
}
|
2017-07-26 00:16:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
void
|
|
|
|
|
d86f_turbo_format(int drive, int side, int nop)
|
|
|
|
|
{
|
|
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
int dat;
|
|
|
|
|
uint16_t sc;
|
|
|
|
|
uint16_t dtl;
|
|
|
|
|
int i;
|
2017-07-26 00:16:54 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
sc = fdc_get_format_sectors(d86f_fdc);
|
|
|
|
|
dtl = 128 << fdc_get_format_n(d86f_fdc);
|
2017-07-26 00:16:54 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (dev->datac <= 3) {
|
|
|
|
|
dat = fdc_getdata(d86f_fdc, 0);
|
|
|
|
|
if (dat != -1)
|
|
|
|
|
dat &= 0xff;
|
|
|
|
|
if ((dat == -1) && (dev->datac < 3))
|
|
|
|
|
dat = 0;
|
2020-06-20 22:34:51 +02:00
|
|
|
d86f_fdc->format_sector_id.byte_array[dev->datac] = dat & 0xff;
|
2018-03-19 01:02:04 +01:00
|
|
|
if (dev->datac == 3) {
|
|
|
|
|
fdc_stop_id_request(d86f_fdc);
|
2020-06-20 22:34:51 +02:00
|
|
|
d86f_handler[drive].set_sector(drive, side, d86f_fdc->format_sector_id.id.c, d86f_fdc->format_sector_id.id.h, d86f_fdc->format_sector_id.id.r, d86f_fdc->format_sector_id.id.n);
|
2017-07-26 00:16:54 +02:00
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
} else if (dev->datac == 4) {
|
|
|
|
|
if (! nop) {
|
|
|
|
|
for (i = 0; i < dtl; i++)
|
|
|
|
|
d86f_handler[drive].write_data(drive, side, i, dev->fill);
|
2017-07-26 00:16:54 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->sector_count++;
|
|
|
|
|
}
|
2017-07-26 00:16:54 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->datac++;
|
2017-07-26 00:16:54 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (dev->datac == 6) {
|
|
|
|
|
dev->datac = 0;
|
|
|
|
|
|
|
|
|
|
if (dev->sector_count < sc) {
|
|
|
|
|
/* Sector within allotted amount. */
|
|
|
|
|
fdc_request_next_sector_id(d86f_fdc);
|
|
|
|
|
} else {
|
|
|
|
|
dev->state = STATE_IDLE;
|
|
|
|
|
d86f_format_turbo_finish(drive, side, nop);
|
2017-07-26 00:16:54 +02:00
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
}
|
2017-07-26 00:16:54 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
int
|
|
|
|
|
d86f_sector_is_present(int drive, int side, uint8_t c, uint8_t h, uint8_t r, uint8_t n)
|
2018-03-15 00:02:19 +01:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
sector_t *s, *t;
|
2018-03-15 00:02:19 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (dev->last_side_sector[side]) {
|
|
|
|
|
s = dev->last_side_sector[side];
|
|
|
|
|
while (s) {
|
|
|
|
|
if ((s->c == c) && (s->h == h) && (s->r == r) && (s->n == n))
|
|
|
|
|
return 1;
|
|
|
|
|
if (! s->prev)
|
|
|
|
|
break;
|
|
|
|
|
t = s->prev;
|
|
|
|
|
s = t;
|
2018-03-15 00:02:19 +01:00
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
2018-03-15 00:02:19 +01:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
d86f_turbo_poll(int drive, int side)
|
2017-07-26 00:16:54 +02:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
|
|
|
|
|
if ((dev->state != STATE_IDLE) && (dev->state != STATE_SECTOR_NOT_FOUND) && ((dev->state & 0xF8) != 0xE8)) {
|
|
|
|
|
if (! d86f_can_read_address(drive)) {
|
|
|
|
|
dev->id_find.sync_marks = dev->id_find.bits_obtained = dev->id_find.bytes_obtained = dev->error_condition = 0;
|
|
|
|
|
fdc_noidam(d86f_fdc);
|
|
|
|
|
dev->state = STATE_IDLE;
|
|
|
|
|
return;
|
2017-07-26 10:15:35 +02:00
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
}
|
2017-07-26 10:15:35 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
switch(dev->state) {
|
|
|
|
|
case STATE_0D_SPIN_TO_INDEX:
|
|
|
|
|
dev->sector_count = 0;
|
|
|
|
|
dev->datac = 5;
|
|
|
|
|
/*FALLTHROUGH*/
|
|
|
|
|
|
|
|
|
|
case STATE_02_SPIN_TO_INDEX:
|
|
|
|
|
dev->state++;
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
case STATE_02_FIND_ID:
|
2019-12-05 21:36:28 +01:00
|
|
|
if (! d86f_sector_is_present(drive, side, fdc_get_read_track_sector(d86f_fdc).id.c, fdc_get_read_track_sector(d86f_fdc).id.h,
|
|
|
|
|
fdc_get_read_track_sector(d86f_fdc).id.r, fdc_get_read_track_sector(d86f_fdc).id.n)) {
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->id_find.sync_marks = dev->id_find.bits_obtained = dev->id_find.bytes_obtained = dev->error_condition = 0;
|
|
|
|
|
fdc_nosector(d86f_fdc);
|
|
|
|
|
dev->state = STATE_IDLE;
|
2017-07-26 00:16:54 +02:00
|
|
|
return;
|
2018-03-19 01:02:04 +01:00
|
|
|
}
|
|
|
|
|
dev->last_sector.id.c = fdc_get_read_track_sector(d86f_fdc).id.c;
|
|
|
|
|
dev->last_sector.id.h = fdc_get_read_track_sector(d86f_fdc).id.h;
|
|
|
|
|
dev->last_sector.id.r = fdc_get_read_track_sector(d86f_fdc).id.r;
|
|
|
|
|
dev->last_sector.id.n = fdc_get_read_track_sector(d86f_fdc).id.n;
|
|
|
|
|
d86f_handler[drive].set_sector(drive, side, dev->last_sector.id.c, dev->last_sector.id.h, dev->last_sector.id.r, dev->last_sector.id.n);
|
|
|
|
|
dev->turbo_pos = 0;
|
|
|
|
|
dev->state++;
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
case STATE_05_FIND_ID:
|
|
|
|
|
case STATE_09_FIND_ID:
|
|
|
|
|
case STATE_06_FIND_ID:
|
|
|
|
|
case STATE_0C_FIND_ID:
|
|
|
|
|
case STATE_11_FIND_ID:
|
|
|
|
|
case STATE_16_FIND_ID:
|
2019-12-05 21:36:28 +01:00
|
|
|
if (! d86f_sector_is_present(drive, side, dev->req_sector.id.c, dev->req_sector.id.h, dev->req_sector.id.r, dev->req_sector.id.n)) {
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->id_find.sync_marks = dev->id_find.bits_obtained = dev->id_find.bytes_obtained = dev->error_condition = 0;
|
|
|
|
|
fdc_nosector(d86f_fdc);
|
|
|
|
|
dev->state = STATE_IDLE;
|
2017-07-26 00:16:54 +02:00
|
|
|
return;
|
2019-12-05 21:36:28 +01:00
|
|
|
} else if (d86f_sector_flags(drive, side, dev->req_sector.id.c, dev->req_sector.id.h, dev->req_sector.id.r, dev->req_sector.id.n) & SECTOR_NO_ID) {
|
|
|
|
|
dev->id_find.sync_marks = dev->id_find.bits_obtained = dev->id_find.bytes_obtained = dev->error_condition = 0;
|
|
|
|
|
fdc_noidam(d86f_fdc);
|
|
|
|
|
dev->state = STATE_IDLE;
|
|
|
|
|
return;
|
2018-03-19 01:02:04 +01:00
|
|
|
}
|
|
|
|
|
dev->last_sector.id.c = dev->req_sector.id.c;
|
|
|
|
|
dev->last_sector.id.h = dev->req_sector.id.h;
|
|
|
|
|
dev->last_sector.id.r = dev->req_sector.id.r;
|
|
|
|
|
dev->last_sector.id.n = dev->req_sector.id.n;
|
|
|
|
|
d86f_handler[drive].set_sector(drive, side, dev->last_sector.id.c, dev->last_sector.id.h, dev->last_sector.id.r, dev->last_sector.id.n);
|
|
|
|
|
/*FALLTHROUGH*/
|
|
|
|
|
|
|
|
|
|
case STATE_0A_FIND_ID:
|
|
|
|
|
dev->turbo_pos = 0;
|
|
|
|
|
dev->state++;
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
case STATE_0A_READ_ID:
|
|
|
|
|
dev->id_find.sync_marks = dev->id_find.bits_obtained = dev->id_find.bytes_obtained = dev->error_condition = 0;
|
|
|
|
|
fdc_sectorid(d86f_fdc, dev->last_sector.id.c, dev->last_sector.id.h, dev->last_sector.id.r, dev->last_sector.id.n, 0, 0);
|
|
|
|
|
dev->state = STATE_IDLE;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case STATE_02_READ_ID:
|
|
|
|
|
case STATE_05_READ_ID:
|
|
|
|
|
case STATE_09_READ_ID:
|
|
|
|
|
case STATE_06_READ_ID:
|
|
|
|
|
case STATE_0C_READ_ID:
|
|
|
|
|
case STATE_11_READ_ID:
|
|
|
|
|
case STATE_16_READ_ID:
|
|
|
|
|
dev->state++;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case STATE_02_FIND_DATA:
|
|
|
|
|
case STATE_06_FIND_DATA:
|
|
|
|
|
case STATE_11_FIND_DATA:
|
|
|
|
|
case STATE_16_FIND_DATA:
|
|
|
|
|
case STATE_05_FIND_DATA:
|
|
|
|
|
case STATE_09_FIND_DATA:
|
|
|
|
|
case STATE_0C_FIND_DATA:
|
|
|
|
|
dev->state++;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case STATE_02_READ_DATA:
|
|
|
|
|
case STATE_06_READ_DATA:
|
|
|
|
|
case STATE_0C_READ_DATA:
|
|
|
|
|
case STATE_11_SCAN_DATA:
|
|
|
|
|
case STATE_16_VERIFY_DATA:
|
|
|
|
|
d86f_turbo_read(drive, side);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case STATE_05_WRITE_DATA:
|
|
|
|
|
case STATE_09_WRITE_DATA:
|
|
|
|
|
d86f_turbo_write(drive, side);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case STATE_0D_FORMAT_TRACK:
|
2020-06-28 04:46:32 +02:00
|
|
|
d86f_turbo_format(drive, side, (side && (d86f_get_sides(drive) != 2)));
|
2018-03-19 01:02:04 +01:00
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
case STATE_IDLE:
|
|
|
|
|
case STATE_SECTOR_NOT_FOUND:
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
2017-07-26 00:16:54 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
d86f_poll(int drive)
|
2016-11-02 22:39:07 +01:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
int mfm, side;
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
side = fdd_get_head(drive);
|
|
|
|
|
if (! fdd_is_double_sided(drive))
|
|
|
|
|
side = 0;
|
2017-05-05 02:43:34 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
mfm = fdc_is_mfm(d86f_fdc);
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if ((dev->state & 0xF8) == 0xE8) {
|
|
|
|
|
if (! d86f_can_format(drive))
|
|
|
|
|
dev->state = STATE_SECTOR_NOT_FOUND;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fdd_get_turbo(drive) && (dev->version == 0x0063)) {
|
|
|
|
|
d86f_turbo_poll(drive, side);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((dev->state != STATE_IDLE) && (dev->state != STATE_SECTOR_NOT_FOUND) && ((dev->state & 0xF8) != 0xE8)) {
|
|
|
|
|
if (! d86f_can_read_address(drive))
|
|
|
|
|
dev->state = STATE_SECTOR_NOT_FOUND;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((dev->state != STATE_02_SPIN_TO_INDEX) && (dev->state != STATE_0D_SPIN_TO_INDEX))
|
|
|
|
|
d86f_get_bit(drive, side ^ 1);
|
2016-09-27 03:16:57 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
switch(dev->state) {
|
|
|
|
|
case STATE_02_SPIN_TO_INDEX:
|
|
|
|
|
case STATE_0D_SPIN_TO_INDEX:
|
|
|
|
|
d86f_spin_to_index(drive, side);
|
2017-07-26 10:15:35 +02:00
|
|
|
return;
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
case STATE_02_FIND_ID:
|
|
|
|
|
case STATE_05_FIND_ID:
|
|
|
|
|
case STATE_09_FIND_ID:
|
|
|
|
|
case STATE_06_FIND_ID:
|
|
|
|
|
case STATE_0A_FIND_ID:
|
|
|
|
|
case STATE_0C_FIND_ID:
|
|
|
|
|
case STATE_11_FIND_ID:
|
|
|
|
|
case STATE_16_FIND_ID:
|
|
|
|
|
if (mfm)
|
2019-02-06 03:34:39 +01:00
|
|
|
d86f_find_address_mark_mfm(drive, side, &(dev->id_find), 0x5554, 0, 0, 0);
|
2018-03-19 01:02:04 +01:00
|
|
|
else
|
2019-02-06 03:34:39 +01:00
|
|
|
d86f_find_address_mark_fm(drive, side, &(dev->id_find), 0xF57E, 0, 0, 0);
|
2018-03-19 01:02:04 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case STATE_0A_READ_ID:
|
|
|
|
|
case STATE_02_READ_ID:
|
|
|
|
|
d86f_read_sector_id(drive, side, 0);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case STATE_05_READ_ID:
|
|
|
|
|
case STATE_09_READ_ID:
|
|
|
|
|
case STATE_06_READ_ID:
|
|
|
|
|
case STATE_0C_READ_ID:
|
|
|
|
|
case STATE_11_READ_ID:
|
|
|
|
|
case STATE_16_READ_ID:
|
|
|
|
|
d86f_read_sector_id(drive, side, 1);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case STATE_02_FIND_DATA:
|
|
|
|
|
if (mfm)
|
2019-02-06 03:34:39 +01:00
|
|
|
d86f_find_address_mark_mfm(drive, side, &(dev->data_find), 0x5545, 0x554A, 0x5554, 2);
|
2018-03-19 01:02:04 +01:00
|
|
|
else
|
2019-02-06 03:34:39 +01:00
|
|
|
d86f_find_address_mark_fm(drive, side, &(dev->data_find), 0xF56F, 0xF56A, 0xF57E, 2);
|
2018-03-19 01:02:04 +01:00
|
|
|
break;
|
2016-11-07 06:39:20 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
case STATE_06_FIND_DATA:
|
|
|
|
|
case STATE_11_FIND_DATA:
|
|
|
|
|
case STATE_16_FIND_DATA:
|
|
|
|
|
if (mfm)
|
2019-02-06 03:34:39 +01:00
|
|
|
d86f_find_address_mark_mfm(drive, side, &(dev->data_find), 0x5545, 0x554A, 0x5554, fdc_is_sk(d86f_fdc) | 2);
|
2018-03-19 01:02:04 +01:00
|
|
|
else
|
2019-02-06 03:34:39 +01:00
|
|
|
d86f_find_address_mark_fm(drive, side, &(dev->data_find), 0xF56F, 0xF56A, 0xF57E, fdc_is_sk(d86f_fdc) | 2);
|
2018-03-19 01:02:04 +01:00
|
|
|
break;
|
2016-09-22 21:22:56 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
case STATE_05_FIND_DATA:
|
|
|
|
|
case STATE_09_FIND_DATA:
|
|
|
|
|
if (mfm)
|
|
|
|
|
d86f_write_find_address_mark_mfm(drive, side, &(dev->data_find));
|
|
|
|
|
else
|
|
|
|
|
d86f_write_find_address_mark_fm(drive, side, &(dev->data_find));
|
|
|
|
|
break;
|
2016-11-10 21:16:24 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
case STATE_0C_FIND_DATA:
|
|
|
|
|
if (mfm)
|
2019-02-06 03:34:39 +01:00
|
|
|
d86f_find_address_mark_mfm(drive, side, &(dev->data_find), 0x554A, 0x5545, 0x5554, fdc_is_sk(d86f_fdc) | 2);
|
2018-03-19 01:02:04 +01:00
|
|
|
else
|
2019-02-06 03:34:39 +01:00
|
|
|
d86f_find_address_mark_fm(drive, side, &(dev->data_find), 0xF56A, 0xF56F, 0xF57E, fdc_is_sk(d86f_fdc) | 2);
|
2018-03-19 01:02:04 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case STATE_02_READ_DATA:
|
|
|
|
|
case STATE_06_READ_DATA:
|
|
|
|
|
case STATE_0C_READ_DATA:
|
|
|
|
|
case STATE_11_SCAN_DATA:
|
|
|
|
|
case STATE_16_VERIFY_DATA:
|
|
|
|
|
d86f_read_sector_data(drive, side);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case STATE_05_WRITE_DATA:
|
|
|
|
|
if (mfm)
|
|
|
|
|
d86f_write_sector_data(drive, side, mfm, 0x5545);
|
|
|
|
|
else
|
|
|
|
|
d86f_write_sector_data(drive, side, mfm, 0xF56F);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case STATE_09_WRITE_DATA:
|
|
|
|
|
if (mfm)
|
|
|
|
|
d86f_write_sector_data(drive, side, mfm, 0x554A);
|
|
|
|
|
else
|
|
|
|
|
d86f_write_sector_data(drive, side, mfm, 0xF56A);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case STATE_0D_FORMAT_TRACK:
|
|
|
|
|
if (! (dev->track_pos & 15))
|
2020-06-28 04:46:32 +02:00
|
|
|
d86f_format_track(drive, side, (!side || (d86f_get_sides(drive) == 2)) && (dev->version == D86FVER));
|
2018-03-19 01:02:04 +01:00
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
case STATE_IDLE:
|
|
|
|
|
case STATE_SECTOR_NOT_FOUND:
|
|
|
|
|
default:
|
|
|
|
|
d86f_get_bit(drive, side);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
d86f_advance_bit(drive, side);
|
|
|
|
|
|
|
|
|
|
if (d86f_wrong_densel(drive) && (dev->state != STATE_IDLE)) {
|
|
|
|
|
dev->state = STATE_IDLE;
|
|
|
|
|
fdc_noidam(d86f_fdc);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((dev->index_count == 2) && (dev->state != STATE_IDLE)) {
|
|
|
|
|
switch(dev->state) {
|
2016-11-02 22:39:07 +01:00
|
|
|
case STATE_0A_FIND_ID:
|
2018-03-19 01:02:04 +01:00
|
|
|
case STATE_SECTOR_NOT_FOUND:
|
|
|
|
|
dev->state = STATE_IDLE;
|
|
|
|
|
fdc_noidam(d86f_fdc);
|
2016-11-02 22:39:07 +01:00
|
|
|
break;
|
2018-03-19 01:02:04 +01:00
|
|
|
|
2016-11-02 22:39:07 +01:00
|
|
|
case STATE_02_FIND_DATA:
|
|
|
|
|
case STATE_06_FIND_DATA:
|
|
|
|
|
case STATE_11_FIND_DATA:
|
|
|
|
|
case STATE_16_FIND_DATA:
|
|
|
|
|
case STATE_05_FIND_DATA:
|
|
|
|
|
case STATE_09_FIND_DATA:
|
|
|
|
|
case STATE_0C_FIND_DATA:
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->state = STATE_IDLE;
|
|
|
|
|
fdc_nodataam(d86f_fdc);
|
2016-11-02 22:39:07 +01:00
|
|
|
break;
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
case STATE_02_SPIN_TO_INDEX:
|
2016-11-02 22:39:07 +01:00
|
|
|
case STATE_02_READ_DATA:
|
2018-03-19 01:02:04 +01:00
|
|
|
case STATE_05_WRITE_DATA:
|
2016-11-02 22:39:07 +01:00
|
|
|
case STATE_06_READ_DATA:
|
2018-03-19 01:02:04 +01:00
|
|
|
case STATE_09_WRITE_DATA:
|
2016-11-02 22:39:07 +01:00
|
|
|
case STATE_0C_READ_DATA:
|
2018-03-19 01:02:04 +01:00
|
|
|
case STATE_0D_SPIN_TO_INDEX:
|
|
|
|
|
case STATE_0D_FORMAT_TRACK:
|
2016-11-02 22:39:07 +01:00
|
|
|
case STATE_11_SCAN_DATA:
|
|
|
|
|
case STATE_16_VERIFY_DATA:
|
2018-03-19 01:02:04 +01:00
|
|
|
/* In these states, we should *NEVER* care about how many index pulses there have been. */
|
2016-11-02 22:39:07 +01:00
|
|
|
break;
|
2016-11-10 21:16:24 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
default:
|
|
|
|
|
dev->state = STATE_IDLE;
|
|
|
|
|
if (dev->id_found) {
|
|
|
|
|
if (dev->error_condition & 0x18) {
|
|
|
|
|
if ((dev->error_condition & 0x18) == 0x08)
|
|
|
|
|
fdc_badcylinder(d86f_fdc);
|
|
|
|
|
if ((dev->error_condition & 0x10) == 0x10)
|
|
|
|
|
fdc_wrongcylinder(d86f_fdc);
|
2016-12-23 03:16:24 +01:00
|
|
|
else
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc_nosector(d86f_fdc);
|
2018-07-15 01:41:53 +02:00
|
|
|
} else
|
|
|
|
|
fdc_nosector(d86f_fdc);
|
2019-12-05 21:36:28 +01:00
|
|
|
} else
|
2018-03-19 01:02:04 +01:00
|
|
|
fdc_noidam(d86f_fdc);
|
|
|
|
|
break;
|
2016-11-10 21:16:24 +01:00
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
}
|
2016-08-20 03:40:12 +02:00
|
|
|
}
|
|
|
|
|
|
2016-11-10 21:16:24 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
void
|
|
|
|
|
d86f_reset_index_hole_pos(int drive, int side)
|
2016-11-10 21:16:24 +01:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
2016-11-10 21:16:24 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->index_hole_pos[side] = 0;
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
uint16_t
|
|
|
|
|
d86f_prepare_pretrack(int drive, int side, int iso)
|
2016-11-02 22:39:07 +01:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
uint16_t i, pos;
|
|
|
|
|
int mfm;
|
|
|
|
|
int real_gap0_len;
|
|
|
|
|
int sync_len;
|
|
|
|
|
int real_gap1_len;
|
|
|
|
|
uint16_t gap_fill;
|
|
|
|
|
uint32_t raw_size;
|
|
|
|
|
uint16_t iam_fm = 0xFAF7;
|
|
|
|
|
uint16_t iam_mfm = 0x5255;
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
mfm = d86f_is_mfm(drive);
|
|
|
|
|
real_gap0_len = mfm ? 80 : 40;
|
|
|
|
|
sync_len = mfm ? 12 : 6;
|
|
|
|
|
real_gap1_len = mfm ? 50 : 26;
|
|
|
|
|
gap_fill = mfm ? 0x4E : 0xFF;
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
raw_size = d86f_handler[drive].get_raw_size(drive, side);
|
|
|
|
|
if (raw_size & 15)
|
|
|
|
|
raw_size = (raw_size >> 4) + 1;
|
|
|
|
|
else
|
|
|
|
|
raw_size = (raw_size >> 4);
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->index_hole_pos[side] = 0;
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_destroy_linked_lists(drive, side);
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
for (i = 0; i < raw_size; i++)
|
|
|
|
|
d86f_write_direct_common(drive, side, gap_fill, 0, i);
|
2018-03-15 00:02:19 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
pos = 0;
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (! iso) {
|
|
|
|
|
for (i = 0; i < real_gap0_len; i++) {
|
|
|
|
|
d86f_write_direct_common(drive, side, gap_fill, 0, pos);
|
2016-11-02 22:39:07 +01:00
|
|
|
pos = (pos + 1) % raw_size;
|
|
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
for (i = 0; i < sync_len; i++) {
|
|
|
|
|
d86f_write_direct_common(drive, side, 0, 0, pos);
|
2016-11-02 22:39:07 +01:00
|
|
|
pos = (pos + 1) % raw_size;
|
2016-08-20 03:40:12 +02:00
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
if (mfm) {
|
|
|
|
|
for (i = 0; i < 3; i++) {
|
|
|
|
|
d86f_write_direct_common(drive, side, 0x2452, 1, pos);
|
|
|
|
|
pos = (pos + 1) % raw_size;
|
|
|
|
|
}
|
2018-03-15 00:25:59 +01:00
|
|
|
}
|
2017-07-26 00:16:54 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_write_direct_common(drive, side, mfm ? iam_mfm : iam_fm, 1, pos);
|
|
|
|
|
pos = (pos + 1) % raw_size;
|
|
|
|
|
}
|
2016-08-20 03:40:12 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
for (i = 0; i < real_gap1_len; i++) {
|
|
|
|
|
d86f_write_direct_common(drive, side, gap_fill, 0, pos);
|
|
|
|
|
pos = (pos + 1) % raw_size;
|
|
|
|
|
}
|
2016-08-31 22:49:56 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
return pos;
|
|
|
|
|
}
|
2016-08-31 22:49:56 +02:00
|
|
|
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
uint16_t
|
2019-12-05 21:36:28 +01:00
|
|
|
d86f_prepare_sector(int drive, int side, int prev_pos, uint8_t *id_buf, uint8_t *data_buf, int data_len, int gap2, int gap3, int flags)
|
2018-03-19 01:02:04 +01:00
|
|
|
{
|
|
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
uint16_t pos;
|
|
|
|
|
int i;
|
|
|
|
|
sector_t *s;
|
|
|
|
|
|
|
|
|
|
int real_gap2_len = gap2;
|
|
|
|
|
int real_gap3_len = gap3;
|
|
|
|
|
int mfm;
|
|
|
|
|
int sync_len;
|
|
|
|
|
uint16_t gap_fill;
|
|
|
|
|
uint32_t raw_size;
|
|
|
|
|
uint16_t idam_fm = 0x7EF5;
|
|
|
|
|
uint16_t dataam_fm = 0x6FF5;
|
|
|
|
|
uint16_t datadam_fm = 0x6AF5;
|
|
|
|
|
uint16_t idam_mfm = 0x5455;
|
|
|
|
|
uint16_t dataam_mfm = 0x4555;
|
|
|
|
|
uint16_t datadam_mfm = 0x4A55;
|
|
|
|
|
|
|
|
|
|
if (fdd_get_turbo(drive) && (dev->version == 0x0063)) {
|
|
|
|
|
s = (sector_t *) malloc(sizeof(sector_t));
|
|
|
|
|
memset(s, 0, sizeof(sector_t));
|
|
|
|
|
s->c = id_buf[0];
|
|
|
|
|
s->h = id_buf[1];
|
|
|
|
|
s->r = id_buf[2];
|
|
|
|
|
s->n = id_buf[3];
|
2019-12-05 21:36:28 +01:00
|
|
|
s->flags = flags;
|
2018-03-19 01:02:04 +01:00
|
|
|
if (dev->last_side_sector[side])
|
|
|
|
|
s->prev = dev->last_side_sector[side];
|
|
|
|
|
dev->last_side_sector[side] = s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mfm = d86f_is_mfm(drive);
|
|
|
|
|
|
|
|
|
|
gap_fill = mfm ? 0x4E : 0xFF;
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
raw_size = d86f_handler[drive].get_raw_size(drive, side);
|
|
|
|
|
if (raw_size & 15)
|
|
|
|
|
raw_size = (raw_size >> 4) + 1;
|
|
|
|
|
else
|
|
|
|
|
raw_size = (raw_size >> 4);
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
pos = prev_pos;
|
|
|
|
|
|
|
|
|
|
sync_len = mfm ? 12 : 6;
|
|
|
|
|
|
2019-12-05 21:36:28 +01:00
|
|
|
if (!(flags & SECTOR_NO_ID)) {
|
|
|
|
|
for (i = 0; i < sync_len; i++) {
|
|
|
|
|
d86f_write_direct_common(drive, side, 0, 0, pos);
|
2016-11-02 22:39:07 +01:00
|
|
|
pos = (pos + 1) % raw_size;
|
2018-03-19 01:02:04 +01:00
|
|
|
}
|
2019-12-05 21:36:28 +01:00
|
|
|
|
|
|
|
|
dev->calc_crc.word = 0xffff;
|
|
|
|
|
if (mfm) {
|
|
|
|
|
for (i = 0; i < 3; i++) {
|
|
|
|
|
d86f_write_direct_common(drive, side, 0x8944, 1, pos);
|
|
|
|
|
pos = (pos + 1) % raw_size;
|
|
|
|
|
d86f_calccrc(dev, 0xA1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
d86f_write_direct_common(drive, side, mfm ? idam_mfm : idam_fm, 1, pos);
|
2018-03-19 01:02:04 +01:00
|
|
|
pos = (pos + 1) % raw_size;
|
2019-12-05 21:36:28 +01:00
|
|
|
d86f_calccrc(dev, 0xFE);
|
|
|
|
|
for (i = 0; i < 4; i++) {
|
|
|
|
|
d86f_write_direct_common(drive, side, id_buf[i], 0, pos);
|
|
|
|
|
pos = (pos + 1) % raw_size;
|
|
|
|
|
d86f_calccrc(dev, id_buf[i]);
|
|
|
|
|
}
|
|
|
|
|
for (i = 1; i >= 0; i--) {
|
|
|
|
|
d86f_write_direct_common(drive, side, dev->calc_crc.bytes[i], 0, pos);
|
|
|
|
|
pos = (pos + 1) % raw_size;
|
|
|
|
|
}
|
|
|
|
|
for (i = 0; i < real_gap2_len; i++) {
|
|
|
|
|
d86f_write_direct_common(drive, side, gap_fill, 0, pos);
|
2016-11-02 22:39:07 +01:00
|
|
|
pos = (pos + 1) % raw_size;
|
2018-03-19 01:02:04 +01:00
|
|
|
}
|
|
|
|
|
}
|
2019-12-05 21:36:28 +01:00
|
|
|
|
|
|
|
|
if (!(flags & SECTOR_NO_DATA)) {
|
|
|
|
|
for (i = 0; i < sync_len; i++) {
|
|
|
|
|
d86f_write_direct_common(drive, side, 0, 0, pos);
|
|
|
|
|
pos = (pos + 1) % raw_size;
|
|
|
|
|
}
|
|
|
|
|
dev->calc_crc.word = 0xffff;
|
|
|
|
|
if (mfm) {
|
|
|
|
|
for (i = 0; i < 3; i++) {
|
|
|
|
|
d86f_write_direct_common(drive, side, 0x8944, 1, pos);
|
|
|
|
|
pos = (pos + 1) % raw_size;
|
|
|
|
|
d86f_calccrc(dev, 0xA1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
d86f_write_direct_common(drive, side, mfm ? ((flags & SECTOR_DELETED_DATA) ? datadam_mfm : dataam_mfm) : ((flags & SECTOR_DELETED_DATA) ? datadam_fm : dataam_fm), 1, pos);
|
2018-03-19 01:02:04 +01:00
|
|
|
pos = (pos + 1) % raw_size;
|
2019-12-05 21:36:28 +01:00
|
|
|
d86f_calccrc(dev, (flags & SECTOR_DELETED_DATA) ? 0xF8 : 0xFB);
|
|
|
|
|
if (data_len > 0) {
|
|
|
|
|
for (i = 0; i < data_len; i++) {
|
|
|
|
|
d86f_write_direct_common(drive, side, data_buf[i], 0, pos);
|
|
|
|
|
pos = (pos + 1) % raw_size;
|
|
|
|
|
d86f_calccrc(dev, data_buf[i]);
|
|
|
|
|
}
|
|
|
|
|
if (!(flags & SECTOR_CRC_ERROR)) {
|
|
|
|
|
for (i = 1; i >= 0; i--) {
|
|
|
|
|
d86f_write_direct_common(drive, side, dev->calc_crc.bytes[i], 0, pos);
|
|
|
|
|
pos = (pos + 1) % raw_size;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for (i = 0; i < real_gap3_len; i++) {
|
|
|
|
|
d86f_write_direct_common(drive, side, gap_fill, 0, pos);
|
|
|
|
|
pos = (pos + 1) % raw_size;
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return pos;
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-22 21:22:56 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
/*
|
|
|
|
|
* Note on handling of tracks on thick track drives:
|
|
|
|
|
*
|
|
|
|
|
* - On seek, encoded data is constructed from both (track << 1) and
|
|
|
|
|
* ((track << 1) + 1);
|
|
|
|
|
*
|
|
|
|
|
* - Any bits that differ are treated as thus:
|
|
|
|
|
* - Both are regular but contents differ -> Output is fuzzy;
|
|
|
|
|
* - One is regular and one is fuzzy -> Output is fuzzy;
|
|
|
|
|
* - Both are fuzzy -> Output is fuzzy;
|
|
|
|
|
* - Both are physical holes -> Output is a physical hole;
|
2019-12-05 21:36:28 +01:00
|
|
|
* - One is regular and one is a physical hole -> Output is fuzzy,
|
2018-03-19 01:02:04 +01:00
|
|
|
* the hole half is handled appropriately on writeback;
|
2019-12-05 21:36:28 +01:00
|
|
|
* - One is fuzzy and one is a physical hole -> Output is fuzzy,
|
2018-03-19 01:02:04 +01:00
|
|
|
* the hole half is handled appropriately on writeback;
|
|
|
|
|
* - On write back, apart from the above notes, the final two tracks
|
|
|
|
|
* are written;
|
|
|
|
|
* - Destination ALWAYS has surface data even if the image does not.
|
|
|
|
|
*
|
|
|
|
|
* In case of a thin track drive, tracks are handled normally.
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
d86f_construct_encoded_buffer(int drive, int side)
|
|
|
|
|
{
|
|
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
uint32_t i = 0;
|
|
|
|
|
|
|
|
|
|
/* *_fuzm are fuzzy bit masks, *_holm are hole masks, dst_neim are masks is mask for bits that are neither fuzzy nor holes in both,
|
|
|
|
|
and src1_d and src2_d are filtered source data. */
|
|
|
|
|
uint16_t src1_fuzm, src2_fuzm, dst_fuzm, src1_holm, src2_holm, dst_holm, dst_neim, src1_d, src2_d;
|
|
|
|
|
uint32_t len;
|
|
|
|
|
uint16_t *dst = dev->track_encoded_data[side];
|
|
|
|
|
uint16_t *dst_s = dev->track_surface_data[side];
|
|
|
|
|
uint16_t *src1 = dev->thin_track_encoded_data[0][side];
|
|
|
|
|
uint16_t *src1_s = dev->thin_track_surface_data[0][side];
|
|
|
|
|
uint16_t *src2 = dev->thin_track_encoded_data[1][side];
|
|
|
|
|
uint16_t *src2_s = dev->thin_track_surface_data[1][side];
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
len = d86f_get_array_size(drive, side, 1);
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
for (i = 0; i < len; i++) {
|
|
|
|
|
/* The two bits differ. */
|
|
|
|
|
if (d86f_has_surface_desc(drive)) {
|
|
|
|
|
/* Source image has surface description data, so we have some more handling to do. */
|
|
|
|
|
src1_fuzm = src1[i] & src1_s[i];
|
|
|
|
|
src2_fuzm = src2[i] & src2_s[i];
|
|
|
|
|
dst_fuzm = src1_fuzm | src2_fuzm; /* The bits that remain set are fuzzy in either one or
|
|
|
|
|
the other or both. */
|
|
|
|
|
src1_holm = src1[i] | (src1_s[i] ^ 0xffff);
|
|
|
|
|
src2_holm = src2[i] | (src2_s[i] ^ 0xffff);
|
|
|
|
|
dst_holm = (src1_holm & src2_holm) ^ 0xffff; /* The bits that remain set are holes in both. */
|
|
|
|
|
dst_neim = (dst_fuzm | dst_holm) ^ 0xffff; /* The bits that remain set are those that are neither
|
2016-11-02 22:39:07 +01:00
|
|
|
fuzzy nor are holes in both. */
|
2018-03-19 01:02:04 +01:00
|
|
|
src1_d = src1[i] & dst_neim;
|
|
|
|
|
src2_d = src2[i] & dst_neim;
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
dst_s[i] = (dst_neim ^ 0xffff); /* The set bits are those that are either fuzzy or are
|
2016-11-02 22:39:07 +01:00
|
|
|
holes in both. */
|
2018-03-19 01:02:04 +01:00
|
|
|
dst[i] = (src1_d | src2_d); /* Initial data is remaining data from Source 1 and
|
2016-11-02 22:39:07 +01:00
|
|
|
Source 2. */
|
2018-03-19 01:02:04 +01:00
|
|
|
dst[i] |= dst_fuzm; /* Add to it the fuzzy bytes (holes have surface bit set
|
2016-11-02 22:39:07 +01:00
|
|
|
but data bit clear). */
|
2018-03-19 01:02:04 +01:00
|
|
|
} else {
|
|
|
|
|
/* No surface data, the handling is much simpler - a simple OR. */
|
|
|
|
|
dst[i] = src1[i] | src2[i];
|
|
|
|
|
dst_s[i] = 0;
|
2016-09-26 20:43:09 +02:00
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
}
|
2016-09-26 20:43:09 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
2016-11-02 22:39:07 +01:00
|
|
|
/* Decomposition is easier since we at most have to care about the holes. */
|
2018-03-19 01:02:04 +01:00
|
|
|
void
|
|
|
|
|
d86f_decompose_encoded_buffer(int drive, int side)
|
|
|
|
|
{
|
|
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
uint32_t i = 0;
|
|
|
|
|
uint16_t temp, temp2;
|
|
|
|
|
uint32_t len;
|
|
|
|
|
uint16_t *dst = dev->track_encoded_data[side];
|
|
|
|
|
uint16_t *src1 = dev->thin_track_encoded_data[0][side];
|
|
|
|
|
uint16_t *src1_s = dev->thin_track_surface_data[0][side];
|
|
|
|
|
uint16_t *src2 = dev->thin_track_encoded_data[1][side];
|
|
|
|
|
uint16_t *src2_s = dev->thin_track_surface_data[1][side];
|
2019-02-06 03:34:39 +01:00
|
|
|
dst = d86f_handler[drive].encoded_data(drive, side);
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
len = d86f_get_array_size(drive, side, 1);
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
for (i = 0; i < len; i++) {
|
|
|
|
|
if (d86f_has_surface_desc(drive)) {
|
|
|
|
|
/* Source image has surface description data, so we have some more handling to do.
|
|
|
|
|
We need hole masks for both buffers. Holes have data bit clear and surface bit set. */
|
|
|
|
|
temp = src1[i] & (src1_s[i] ^ 0xffff);
|
|
|
|
|
temp2 = src2[i] & (src2_s[i] ^ 0xffff);
|
|
|
|
|
src1[i] = dst[i] & temp;
|
|
|
|
|
src1_s[i] = temp ^ 0xffff;
|
|
|
|
|
src2[i] = dst[i] & temp2;
|
|
|
|
|
src2_s[i] = temp2 ^ 0xffff;
|
|
|
|
|
} else {
|
|
|
|
|
src1[i] = src2[i] = dst[i];
|
2016-09-26 20:43:09 +02:00
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
}
|
2016-09-26 20:43:09 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
int
|
|
|
|
|
d86f_track_header_size(int drive)
|
2016-11-03 22:07:34 +01:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
int temp = 6;
|
|
|
|
|
|
|
|
|
|
if (d86f_has_extra_bit_cells(drive))
|
|
|
|
|
temp += 4;
|
|
|
|
|
|
|
|
|
|
return temp;
|
2016-11-03 22:07:34 +01:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
d86f_read_track(int drive, int track, int thin_track, int side, uint16_t *da, uint16_t *sa)
|
2016-11-03 22:07:34 +01:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
int logical_track = 0;
|
|
|
|
|
int array_size = 0;
|
2016-11-03 22:07:34 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (d86f_get_sides(drive) == 2)
|
|
|
|
|
logical_track = ((track + thin_track) << 1) + side;
|
2016-11-03 22:07:34 +01:00
|
|
|
else
|
2018-03-19 01:02:04 +01:00
|
|
|
logical_track = track + thin_track;
|
|
|
|
|
|
|
|
|
|
if (dev->track_offset[logical_track]) {
|
|
|
|
|
if (! thin_track) {
|
2020-01-15 04:58:28 +01:00
|
|
|
if (fseek(dev->f, dev->track_offset[logical_track], SEEK_SET) == -1)
|
|
|
|
|
fatal("d86f_read_track(): Error seeking to offset dev->track_offset[logical_track]\n");
|
|
|
|
|
if (fread(&(dev->side_flags[side]), 1, 2, dev->f) != 2)
|
|
|
|
|
fatal("d86f_read_track(): Error reading side flags\n");
|
2018-03-19 01:02:04 +01:00
|
|
|
if (d86f_has_extra_bit_cells(drive)) {
|
2020-01-15 04:58:28 +01:00
|
|
|
if (fread(&(dev->extra_bit_cells[side]), 1, 4, dev->f) != 4)
|
|
|
|
|
fatal("d86f_read_track(): Error reading number of extra bit cells\n");
|
2019-02-06 03:34:39 +01:00
|
|
|
/* If RPM shift is 0% and direction is 1, do not adjust extra bit cells,
|
|
|
|
|
as that is the whole track length. */
|
|
|
|
|
if (d86f_get_rpm_mode(drive) || !d86f_get_speed_shift_dir(drive)) {
|
|
|
|
|
if (dev->extra_bit_cells[side] < -32768)
|
|
|
|
|
dev->extra_bit_cells[side] = -32768;
|
|
|
|
|
if (dev->extra_bit_cells[side] > 32768)
|
|
|
|
|
dev->extra_bit_cells[side] = 32768;
|
|
|
|
|
}
|
|
|
|
|
} else
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->extra_bit_cells[side] = 0;
|
|
|
|
|
fread(&(dev->index_hole_pos[side]), 4, 1, dev->f);
|
2019-02-06 03:34:39 +01:00
|
|
|
} else
|
2018-03-19 01:02:04 +01:00
|
|
|
fseek(dev->f, dev->track_offset[logical_track] + d86f_track_header_size(drive), SEEK_SET);
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
array_size = d86f_get_array_size(drive, side, 0);
|
2020-06-29 03:14:16 +02:00
|
|
|
fread(da, 1, array_size, dev->f);
|
2018-03-19 01:02:04 +01:00
|
|
|
if (d86f_has_surface_desc(drive))
|
|
|
|
|
fread(sa, 1, array_size, dev->f);
|
|
|
|
|
} else {
|
|
|
|
|
if (! thin_track) {
|
|
|
|
|
switch((dev->disk_flags >> 1) & 3) {
|
|
|
|
|
case 0:
|
|
|
|
|
default:
|
|
|
|
|
dev->side_flags[side] = 0x0A;
|
|
|
|
|
break;
|
2016-11-03 22:07:34 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
case 1:
|
|
|
|
|
dev->side_flags[side] = 0x00;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
case 3:
|
|
|
|
|
dev->side_flags[side] = 0x03;
|
|
|
|
|
break;
|
2016-11-03 22:07:34 +01:00
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->extra_bit_cells[side] = 0;
|
2016-11-03 22:07:34 +01:00
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
}
|
2016-11-03 22:07:34 +01:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
d86f_zero_track(int drive)
|
2018-01-17 18:43:36 +01:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
int sides, side;
|
|
|
|
|
sides = d86f_get_sides(drive);
|
2018-01-17 18:43:36 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
for (side = 0; side < sides; side++) {
|
|
|
|
|
if (d86f_has_surface_desc(drive))
|
|
|
|
|
memset(dev->track_surface_data[side], 0, 106096);
|
|
|
|
|
memset(dev->track_encoded_data[side], 0, 106096);
|
|
|
|
|
}
|
2018-01-17 18:43:36 +01:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
d86f_seek(int drive, int track)
|
2016-09-26 20:43:09 +02:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
int sides;
|
|
|
|
|
int side, thin_track;
|
|
|
|
|
sides = d86f_get_sides(drive);
|
2016-09-26 20:43:09 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
/* If the drive has thick tracks, shift the track number by 1. */
|
|
|
|
|
if (! fdd_doublestep_40(drive)) {
|
|
|
|
|
track <<= 1;
|
2016-09-26 20:43:09 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
for (thin_track = 0; thin_track < sides; thin_track++) {
|
|
|
|
|
for (side = 0; side < sides; side++) {
|
|
|
|
|
if (d86f_has_surface_desc(drive))
|
|
|
|
|
memset(dev->thin_track_surface_data[thin_track][side], 0, 106096);
|
|
|
|
|
memset(dev->thin_track_encoded_data[thin_track][side], 0, 106096);
|
2016-09-26 20:43:09 +02:00
|
|
|
}
|
|
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
}
|
2016-09-26 20:43:09 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_zero_track(drive);
|
2016-09-28 22:56:19 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->cur_track = track;
|
2016-09-28 22:56:19 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (! fdd_doublestep_40(drive)) {
|
|
|
|
|
for (side = 0; side < sides; side++) {
|
|
|
|
|
for (thin_track = 0; thin_track < 2; thin_track++)
|
|
|
|
|
d86f_read_track(drive, track, thin_track, side, dev->thin_track_encoded_data[thin_track][side], dev->thin_track_surface_data[thin_track][side]);
|
2016-11-03 22:07:34 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_construct_encoded_buffer(drive, side);
|
2016-09-28 22:56:19 +02:00
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
} else {
|
|
|
|
|
for (side = 0; side < sides; side++)
|
|
|
|
|
d86f_read_track(drive, track, 0, side, dev->track_encoded_data[side], dev->track_surface_data[side]);
|
|
|
|
|
}
|
2016-08-31 22:49:56 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->state = STATE_IDLE;
|
2016-09-03 18:07:46 +02:00
|
|
|
}
|
2016-08-20 03:40:12 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
d86f_write_track(int drive, FILE **f, int side, uint16_t *da0, uint16_t *sa0)
|
2016-09-03 18:07:46 +02:00
|
|
|
{
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
uint32_t array_size = d86f_get_array_size(drive, side, 0);
|
2018-03-19 01:02:04 +01:00
|
|
|
uint16_t side_flags = d86f_handler[drive].side_flags(drive);
|
|
|
|
|
uint32_t extra_bit_cells = d86f_handler[drive].extra_bit_cells(drive, side);
|
|
|
|
|
uint32_t index_hole_pos = d86f_handler[drive].index_hole_pos(drive, side);
|
2018-01-19 15:39:13 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
fwrite(&side_flags, 1, 2, *f);
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (d86f_has_extra_bit_cells(drive))
|
|
|
|
|
fwrite(&extra_bit_cells, 1, 4, *f);
|
2016-09-14 23:18:14 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
fwrite(&index_hole_pos, 1, 4, *f);
|
2016-11-03 22:07:34 +01:00
|
|
|
|
2020-06-29 03:14:16 +02:00
|
|
|
fwrite(da0, 1, array_size, *f);
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (d86f_has_surface_desc(drive))
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
fwrite(sa0, 1, array_size, *f);
|
2016-11-03 22:07:34 +01:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
int
|
|
|
|
|
d86f_get_track_table_size(int drive)
|
2016-11-03 22:07:34 +01:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
int temp = 2048;
|
2016-11-03 22:07:34 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (d86f_get_sides(drive) == 1)
|
|
|
|
|
temp >>= 1;
|
2016-09-22 21:22:56 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
return temp;
|
2016-09-22 21:22:56 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
d86f_set_cur_track(int drive, int track)
|
2016-09-03 18:07:46 +02:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
|
|
|
|
|
dev->cur_track = track;
|
2018-01-17 18:43:36 +01:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
d86f_write_tracks(int drive, FILE **f, uint32_t *track_table)
|
2018-01-17 18:43:36 +01:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
2018-09-14 15:35:41 +02:00
|
|
|
int sides, fdd_side;
|
2018-03-19 01:02:04 +01:00
|
|
|
int side, thin_track;
|
|
|
|
|
int logical_track = 0;
|
2018-09-14 15:35:41 +02:00
|
|
|
uint32_t *tbl;
|
|
|
|
|
tbl = dev->track_offset;
|
|
|
|
|
fdd_side = fdd_get_head(drive);
|
2018-03-19 01:02:04 +01:00
|
|
|
sides = d86f_get_sides(drive);
|
2016-10-05 05:37:07 +02:00
|
|
|
|
2020-06-29 00:53:51 +02:00
|
|
|
if (track_table != NULL)
|
2018-03-19 01:02:04 +01:00
|
|
|
tbl = track_table;
|
2016-11-02 22:39:07 +01:00
|
|
|
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
if (!fdd_doublestep_40(drive)) {
|
2019-02-06 03:34:39 +01:00
|
|
|
d86f_decompose_encoded_buffer(drive, 0);
|
|
|
|
|
if (sides == 2)
|
|
|
|
|
d86f_decompose_encoded_buffer(drive, 1);
|
|
|
|
|
|
|
|
|
|
for (thin_track = 0; thin_track < 2; thin_track++) {
|
|
|
|
|
for (side = 0; side < sides; side++) {
|
|
|
|
|
fdd_set_head(drive, side);
|
2018-03-19 01:02:04 +01:00
|
|
|
|
2018-01-19 15:39:13 +01:00
|
|
|
if (sides == 2)
|
2018-03-19 01:02:04 +01:00
|
|
|
logical_track = ((dev->cur_track + thin_track) << 1) + side;
|
2016-11-03 22:07:34 +01:00
|
|
|
else
|
2018-03-19 01:02:04 +01:00
|
|
|
logical_track = dev->cur_track + thin_track;
|
|
|
|
|
|
|
|
|
|
if (track_table && !tbl[logical_track]) {
|
2018-01-19 15:39:13 +01:00
|
|
|
fseek(*f, 0, SEEK_END);
|
2019-02-06 03:34:39 +01:00
|
|
|
tbl[logical_track] = ftell(*f);
|
2018-01-19 15:39:13 +01:00
|
|
|
}
|
2019-02-06 03:34:39 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (tbl[logical_track]) {
|
2018-01-19 15:39:13 +01:00
|
|
|
fseek(*f, tbl[logical_track], SEEK_SET);
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_write_track(drive, f, side, dev->thin_track_encoded_data[thin_track][side], dev->thin_track_surface_data[thin_track][side]);
|
2016-11-03 22:07:34 +01:00
|
|
|
}
|
2016-09-28 22:56:19 +02:00
|
|
|
}
|
2016-09-03 18:07:46 +02:00
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
} else {
|
|
|
|
|
for (side = 0; side < sides; side++) {
|
|
|
|
|
fdd_set_head(drive, side);
|
|
|
|
|
if (sides == 2)
|
|
|
|
|
logical_track = (dev->cur_track << 1) + side;
|
|
|
|
|
else
|
|
|
|
|
logical_track = dev->cur_track;
|
|
|
|
|
|
|
|
|
|
if (track_table && !tbl[logical_track]) {
|
|
|
|
|
fseek(*f, 0, SEEK_END);
|
2019-02-06 03:34:39 +01:00
|
|
|
tbl[logical_track] = ftell(*f);
|
2018-03-19 01:02:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (tbl[logical_track]) {
|
2020-01-15 04:58:28 +01:00
|
|
|
if (fseek(*f, tbl[logical_track], SEEK_SET) == -1)
|
|
|
|
|
fatal("d86f_write_tracks(): Error seeking to offset tbl[logical_track]\n");
|
2019-02-06 03:34:39 +01:00
|
|
|
d86f_write_track(drive, f, side, d86f_handler[drive].encoded_data(drive, side), dev->track_surface_data[side]);
|
2018-03-19 01:02:04 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-01-19 15:39:13 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
fdd_set_head(drive, fdd_side);
|
2018-01-17 18:43:36 +01:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
d86f_writeback(int drive)
|
2018-01-17 18:43:36 +01:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
uint8_t header[32];
|
2020-01-15 03:48:33 +01:00
|
|
|
int header_size, size;
|
2018-05-21 19:04:05 +02:00
|
|
|
#ifdef D86F_COMPRESS
|
2018-03-19 01:02:04 +01:00
|
|
|
uint32_t len;
|
|
|
|
|
int ret = 0;
|
|
|
|
|
FILE *cf;
|
2018-05-21 19:04:05 +02:00
|
|
|
#endif
|
2018-03-19 01:02:04 +01:00
|
|
|
header_size = d86f_header_size(drive);
|
2018-01-17 18:43:36 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (! dev->f) return;
|
2018-01-17 18:43:36 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
/* First write the track offsets table. */
|
2020-01-15 03:48:33 +01:00
|
|
|
if (fseek(dev->f, 0, SEEK_SET) == -1)
|
|
|
|
|
fatal("86F write_back(): Error seeking to the beginning of the file\n");
|
|
|
|
|
if (fread(header, 1, header_size, dev->f) != header_size)
|
|
|
|
|
fatal("86F write_back(): Error reading header size\n");
|
2018-01-17 18:43:36 +01:00
|
|
|
|
2020-01-15 03:48:33 +01:00
|
|
|
if (fseek(dev->f, 8, SEEK_SET) == -1)
|
2020-01-15 05:24:33 +01:00
|
|
|
fatal("86F write_back(): Error seeking\n");
|
2020-01-15 03:48:33 +01:00
|
|
|
size = d86f_get_track_table_size(drive);
|
|
|
|
|
if (fwrite(dev->track_offset, 1, size, dev->f) != size)
|
2020-01-15 05:24:33 +01:00
|
|
|
fatal("86F write_back(): Error writing data\n");
|
2018-01-17 18:43:36 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_write_tracks(drive, &dev->f, NULL);
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-05-21 19:04:05 +02:00
|
|
|
#ifdef D86F_COMPRESS
|
2018-03-19 01:02:04 +01:00
|
|
|
if (dev->is_compressed) {
|
|
|
|
|
/* The image is compressed. */
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
/* Open the original, compressed file. */
|
|
|
|
|
cf = plat_fopen(dev->original_file_name, L"wb");
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
/* Write the header to the original file. */
|
|
|
|
|
fwrite(header, 1, header_size, cf);
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
fseek(dev->f, 0, SEEK_END);
|
|
|
|
|
len = ftell(dev->f);
|
|
|
|
|
len -= header_size;
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
fseek(dev->f, header_size, SEEK_SET);
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
/* Compress data from the temporary uncompressed file to the original, compressed file. */
|
|
|
|
|
dev->filebuf = (uint8_t *) malloc(len);
|
|
|
|
|
dev->outbuf = (uint8_t *) malloc(len - 1);
|
|
|
|
|
fread(dev->filebuf, 1, len, dev->f);
|
|
|
|
|
ret = lzf_compress(dev->filebuf, len, dev->outbuf, len - 1);
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (! ret)
|
|
|
|
|
d86f_log("86F: Error compressing file\n");
|
2016-08-31 22:49:56 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
fwrite(dev->outbuf, 1, ret, cf);
|
|
|
|
|
free(dev->outbuf);
|
|
|
|
|
free(dev->filebuf);
|
|
|
|
|
}
|
2018-05-21 19:04:05 +02:00
|
|
|
#endif
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
2016-09-14 23:18:14 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
d86f_stop(int drive)
|
2016-11-02 22:39:07 +01:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
|
2018-08-12 07:47:03 +02:00
|
|
|
if (dev)
|
|
|
|
|
dev->state = STATE_IDLE;
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
2016-09-14 23:18:14 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
int
|
|
|
|
|
d86f_common_command(int drive, int sector, int track, int side, int rate, int sector_size)
|
2016-11-02 22:39:07 +01:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_log("d86f_common_command (drive %i): fdc_period=%i img_period=%i rate=%i sector=%i track=%i side=%i\n", drive, fdc_get_bitcell_period(d86f_fdc), d86f_get_bitcell_period(drive), rate, sector, track, side);
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->req_sector.id.c = track;
|
|
|
|
|
dev->req_sector.id.h = side;
|
2019-12-05 21:36:28 +01:00
|
|
|
if (sector == SECTOR_FIRST)
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->req_sector.id.r = 1;
|
2019-12-05 21:36:28 +01:00
|
|
|
else if (sector == SECTOR_NEXT)
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->req_sector.id.r++;
|
2019-12-05 21:36:28 +01:00
|
|
|
else
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->req_sector.id.r = sector;
|
|
|
|
|
dev->req_sector.id.n = sector_size;
|
2016-08-31 22:49:56 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (fdd_get_head(drive) && (d86f_get_sides(drive) == 1)) {
|
|
|
|
|
fdc_noidam(d86f_fdc);
|
|
|
|
|
dev->state = STATE_IDLE;
|
|
|
|
|
dev->index_count = 0;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dev->id_find.sync_marks = dev->id_find.bits_obtained = dev->id_find.bytes_obtained = 0;
|
|
|
|
|
dev->data_find.sync_marks = dev->data_find.bits_obtained = dev->data_find.bytes_obtained = 0;
|
|
|
|
|
dev->index_count = dev->error_condition = dev->satisfying_bytes = 0;
|
|
|
|
|
dev->id_found = 0;
|
|
|
|
|
dev->dma_over = 0;
|
2016-09-03 18:07:46 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
return 1;
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
2016-09-03 18:07:46 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
d86f_readsector(int drive, int sector, int track, int side, int rate, int sector_size)
|
2016-11-02 22:39:07 +01:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
int ret = 0;
|
2016-09-03 18:07:46 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
ret = d86f_common_command(drive, sector, track, side, rate, sector_size);
|
2018-07-15 01:41:53 +02:00
|
|
|
if (! ret)
|
|
|
|
|
return;
|
2016-09-22 21:22:56 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (sector == SECTOR_FIRST)
|
|
|
|
|
dev->state = STATE_02_SPIN_TO_INDEX;
|
|
|
|
|
else if (sector == SECTOR_NEXT)
|
|
|
|
|
dev->state = STATE_02_FIND_ID;
|
|
|
|
|
else
|
|
|
|
|
dev->state = fdc_is_deleted(d86f_fdc) ? STATE_0C_FIND_ID : (fdc_is_verify(d86f_fdc) ? STATE_16_FIND_ID : STATE_06_FIND_ID);
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
2016-09-22 21:22:56 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
d86f_writesector(int drive, int sector, int track, int side, int rate, int sector_size)
|
2016-11-02 22:39:07 +01:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
int ret = 0;
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (writeprot[drive]) {
|
|
|
|
|
fdc_writeprotect(d86f_fdc);
|
|
|
|
|
dev->state = STATE_IDLE;
|
|
|
|
|
dev->index_count = 0;
|
|
|
|
|
return;
|
|
|
|
|
}
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
ret = d86f_common_command(drive, sector, track, side, rate, sector_size);
|
|
|
|
|
if (! ret) return;
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->state = fdc_is_deleted(d86f_fdc) ? STATE_09_FIND_ID : STATE_05_FIND_ID;
|
2016-09-03 18:07:46 +02:00
|
|
|
}
|
2016-08-31 22:49:56 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
d86f_comparesector(int drive, int sector, int track, int side, int rate, int sector_size)
|
2016-09-03 18:07:46 +02:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
int ret = 0;
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
ret = d86f_common_command(drive, sector, track, side, rate, sector_size);
|
|
|
|
|
if (! ret) return;
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->state = STATE_11_FIND_ID;
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
2016-09-14 23:18:14 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
d86f_readaddress(int drive, int side, int rate)
|
2016-11-02 22:39:07 +01:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
|
|
|
|
|
if (fdd_get_head(drive) && (d86f_get_sides(drive) == 1)) {
|
|
|
|
|
fdc_noidam(d86f_fdc);
|
|
|
|
|
dev->state = STATE_IDLE;
|
|
|
|
|
dev->index_count = 0;
|
|
|
|
|
return;
|
|
|
|
|
}
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->id_find.sync_marks = dev->id_find.bits_obtained = dev->id_find.bytes_obtained = 0;
|
|
|
|
|
dev->data_find.sync_marks = dev->data_find.bits_obtained = dev->data_find.bytes_obtained = 0;
|
|
|
|
|
dev->index_count = dev->error_condition = dev->satisfying_bytes = 0;
|
|
|
|
|
dev->id_found = 0;
|
|
|
|
|
dev->dma_over = 0;
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->state = STATE_0A_FIND_ID;
|
2016-09-03 18:07:46 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
d86f_add_track(int drive, int track, int side)
|
2016-09-03 18:07:46 +02:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
uint32_t array_size;
|
|
|
|
|
int logical_track;
|
2016-11-03 22:07:34 +01:00
|
|
|
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
array_size = d86f_get_array_size(drive, side, 0);
|
2016-08-31 22:49:56 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (d86f_get_sides(drive) == 2) {
|
|
|
|
|
logical_track = (track << 1) + side;
|
|
|
|
|
} else {
|
|
|
|
|
if (side)
|
|
|
|
|
return;
|
|
|
|
|
logical_track = track;
|
|
|
|
|
}
|
2016-11-03 22:07:34 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (! dev->track_offset[logical_track]) {
|
|
|
|
|
/* Track is absent from the file, let's add it. */
|
|
|
|
|
dev->track_offset[logical_track] = dev->file_size;
|
2016-09-17 20:22:02 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->file_size += (array_size + 6);
|
|
|
|
|
if (d86f_has_extra_bit_cells(drive))
|
|
|
|
|
dev->file_size += 4;
|
|
|
|
|
if (d86f_has_surface_desc(drive))
|
|
|
|
|
dev->file_size += array_size;
|
|
|
|
|
}
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
2016-09-17 20:22:02 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
d86f_common_format(int drive, int side, int rate, uint8_t fill, int proxy)
|
2016-11-02 22:39:07 +01:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
uint32_t i = 0;
|
|
|
|
|
uint16_t temp, temp2;
|
|
|
|
|
uint32_t array_size;
|
2016-09-03 18:07:46 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (writeprot[drive]) {
|
|
|
|
|
fdc_writeprotect(d86f_fdc);
|
|
|
|
|
dev->state = STATE_IDLE;
|
|
|
|
|
dev->index_count = 0;
|
|
|
|
|
return;
|
|
|
|
|
}
|
2016-08-31 22:49:56 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (! d86f_can_format(drive)) {
|
|
|
|
|
fdc_cannotformat(d86f_fdc);
|
|
|
|
|
dev->state = STATE_IDLE;
|
|
|
|
|
dev->index_count = 0;
|
|
|
|
|
return;
|
|
|
|
|
}
|
2016-09-14 23:18:14 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (!side || (d86f_get_sides(drive) == 2)) {
|
|
|
|
|
if (! proxy) {
|
|
|
|
|
d86f_reset_index_hole_pos(drive, side);
|
2016-09-28 22:56:19 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (dev->cur_track > 256) {
|
|
|
|
|
fdc_writeprotect(d86f_fdc);
|
|
|
|
|
dev->state = STATE_IDLE;
|
|
|
|
|
dev->index_count = 0;
|
|
|
|
|
return;
|
|
|
|
|
}
|
2017-05-05 01:49:42 +02:00
|
|
|
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
array_size = d86f_get_array_size(drive, side, 0);
|
2016-09-28 22:56:19 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (d86f_has_surface_desc(drive)) {
|
|
|
|
|
/* Preserve the physical holes but get rid of the fuzzy bytes. */
|
|
|
|
|
for (i = 0; i < array_size; i++) {
|
|
|
|
|
temp = dev->track_encoded_data[side][i] ^ 0xffff;
|
|
|
|
|
temp2 = dev->track_surface_data[side][i];
|
|
|
|
|
temp &= temp2;
|
|
|
|
|
dev->track_surface_data[side][i] = temp;
|
2017-05-05 01:49:42 +02:00
|
|
|
}
|
2016-09-28 22:56:19 +02:00
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
/* Zero the data buffer. */
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
memset(dev->track_encoded_data[side], 0, array_size);
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
d86f_add_track(drive, dev->cur_track, side);
|
|
|
|
|
if (! fdd_doublestep_40(drive))
|
|
|
|
|
d86f_add_track(drive, dev->cur_track + 1, side);
|
2016-09-28 22:56:19 +02:00
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
}
|
2016-09-28 22:56:19 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->fill = fill;
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (! proxy) {
|
|
|
|
|
dev->side_flags[side] = 0;
|
|
|
|
|
dev->side_flags[side] |= (fdd_getrpm(real_drive(d86f_fdc, drive)) == 360) ? 0x20 : 0;
|
|
|
|
|
dev->side_flags[side] |= fdc_get_bit_rate(d86f_fdc);
|
|
|
|
|
dev->side_flags[side] |= fdc_is_mfm(d86f_fdc) ? 8 : 0;
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->index_hole_pos[side] = 0;
|
|
|
|
|
}
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->id_find.sync_marks = dev->id_find.bits_obtained = dev->id_find.bytes_obtained = 0;
|
|
|
|
|
dev->data_find.sync_marks = dev->data_find.bits_obtained = dev->data_find.bytes_obtained = 0;
|
|
|
|
|
dev->index_count = dev->error_condition = dev->satisfying_bytes = dev->sector_count = 0;
|
|
|
|
|
dev->dma_over = 0;
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2020-06-28 04:46:32 +02:00
|
|
|
dev->state = STATE_0D_SPIN_TO_INDEX;
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
d86f_proxy_format(int drive, int side, int rate, uint8_t fill)
|
2016-11-02 22:39:07 +01:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_common_format(drive, side, rate, fill, 1);
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
d86f_format(int drive, int side, int rate, uint8_t fill)
|
2016-11-02 22:39:07 +01:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_common_format(drive, side, rate, fill, 0);
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
d86f_common_handlers(int drive)
|
2016-11-02 22:39:07 +01:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
drives[drive].readsector = d86f_readsector;
|
|
|
|
|
drives[drive].writesector = d86f_writesector;
|
|
|
|
|
drives[drive].comparesector =d86f_comparesector;
|
|
|
|
|
drives[drive].readaddress = d86f_readaddress;
|
|
|
|
|
drives[drive].byteperiod = d86f_byteperiod;
|
|
|
|
|
drives[drive].poll = d86f_poll;
|
|
|
|
|
drives[drive].format = d86f_proxy_format;
|
|
|
|
|
drives[drive].stop = d86f_stop;
|
2016-09-28 22:56:19 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
int
|
2021-03-14 20:35:01 +01:00
|
|
|
d86f_export(int drive, char *fn)
|
2018-01-19 15:39:13 +01:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
uint32_t tt[512];
|
|
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
d86f_t *temp86;
|
|
|
|
|
FILE *f;
|
|
|
|
|
int tracks = 86;
|
|
|
|
|
int i;
|
|
|
|
|
int inc = 1;
|
|
|
|
|
uint32_t magic = 0x46423638;
|
2019-02-06 03:34:39 +01:00
|
|
|
uint16_t version = 0x020C;
|
2018-03-19 01:02:04 +01:00
|
|
|
uint16_t disk_flags = d86f_handler[drive].disk_flags(drive);
|
2018-01-19 15:39:13 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
memset(tt, 0, 512 * sizeof(uint32_t));
|
2018-01-19 15:39:13 +01:00
|
|
|
|
2021-03-14 20:35:01 +01:00
|
|
|
f = plat_fopen(fn, "wb");
|
2018-03-19 01:02:04 +01:00
|
|
|
if (!f)
|
|
|
|
|
return 0;
|
2018-03-05 23:35:01 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
/* Allocate a temporary drive for conversion. */
|
|
|
|
|
temp86 = (d86f_t *)malloc(sizeof(d86f_t));
|
|
|
|
|
memcpy(temp86, dev, sizeof(d86f_t));
|
2018-01-19 15:39:13 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
fwrite(&magic, 4, 1, f);
|
|
|
|
|
fwrite(&version, 2, 1, f);
|
|
|
|
|
fwrite(&disk_flags, 2, 1, f);
|
2018-01-19 15:39:13 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
fwrite(tt, 1, ((d86f_get_sides(drive) == 2) ? 2048 : 1024), f);
|
2018-01-19 15:39:13 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
/* In the case of a thick track drive, always increment track
|
|
|
|
|
by two, since two tracks are going to get output at once. */
|
|
|
|
|
if (!fdd_doublestep_40(drive))
|
|
|
|
|
inc = 2;
|
2018-01-19 15:39:13 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
for (i = 0; i < tracks; i += inc) {
|
|
|
|
|
if (inc == 2)
|
|
|
|
|
fdd_do_seek(drive, i >> 1);
|
|
|
|
|
else
|
|
|
|
|
fdd_do_seek(drive, i);
|
|
|
|
|
dev->cur_track = i;
|
|
|
|
|
d86f_write_tracks(drive, &f, tt);
|
|
|
|
|
}
|
2018-01-19 15:39:13 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
fclose(f);
|
2018-01-19 15:39:13 +01:00
|
|
|
|
2021-03-14 20:35:01 +01:00
|
|
|
f = plat_fopen(fn, "rb+");
|
2018-01-19 15:39:13 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
fseek(f, 8, SEEK_SET);
|
|
|
|
|
fwrite(tt, 1, ((d86f_get_sides(drive) == 2) ? 2048 : 1024), f);
|
2018-01-19 15:39:13 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
fclose(f);
|
2018-01-19 15:39:13 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
fdd_do_seek(drive, fdd_current_track(drive));
|
2018-01-19 15:39:13 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
/* Restore the drive from temp. */
|
|
|
|
|
memcpy(dev, temp86, sizeof(d86f_t));
|
|
|
|
|
free(temp86);
|
2018-01-19 15:39:13 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
return 1;
|
|
|
|
|
}
|
2018-01-19 15:39:13 +01:00
|
|
|
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
void
|
2021-03-14 20:35:01 +01:00
|
|
|
d86f_load(int drive, char *fn)
|
2018-03-19 01:02:04 +01:00
|
|
|
{
|
|
|
|
|
d86f_t *dev = d86f[drive];
|
|
|
|
|
uint32_t magic = 0;
|
|
|
|
|
uint32_t len = 0;
|
2018-03-19 01:36:56 +01:00
|
|
|
int i = 0, j = 0;
|
2018-05-21 19:04:05 +02:00
|
|
|
#ifdef D86F_COMPRESS
|
2021-03-14 20:35:01 +01:00
|
|
|
char temp_file_name[2048];
|
2018-05-21 19:04:05 +02:00
|
|
|
uint16_t temp = 0;
|
2018-03-19 01:02:04 +01:00
|
|
|
FILE *tf;
|
2018-05-21 19:04:05 +02:00
|
|
|
#endif
|
2018-01-19 15:39:13 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_unregister(drive);
|
2018-01-19 15:39:13 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
writeprot[drive] = 0;
|
2018-01-19 15:39:13 +01:00
|
|
|
|
2021-03-14 20:35:01 +01:00
|
|
|
dev->f = plat_fopen(fn, "rb+");
|
2018-03-19 01:02:04 +01:00
|
|
|
if (! dev->f) {
|
2021-03-14 20:35:01 +01:00
|
|
|
dev->f = plat_fopen(fn, "rb");
|
2018-03-19 01:02:04 +01:00
|
|
|
if (! dev->f) {
|
|
|
|
|
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
|
|
|
|
free(dev);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
writeprot[drive] = 1;
|
|
|
|
|
}
|
2018-01-19 15:39:13 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (ui_writeprot[drive]) {
|
|
|
|
|
writeprot[drive] = 1;
|
|
|
|
|
}
|
|
|
|
|
fwriteprot[drive] = writeprot[drive];
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
fseek(dev->f, 0, SEEK_END);
|
|
|
|
|
len = ftell(dev->f);
|
|
|
|
|
fseek(dev->f, 0, SEEK_SET);
|
2016-10-05 00:47:50 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
fread(&magic, 4, 1, dev->f);
|
2016-09-28 22:56:19 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (len < 16) {
|
|
|
|
|
/* File is WAY too small, abort. */
|
|
|
|
|
fclose(dev->f);
|
|
|
|
|
dev->f = NULL;
|
|
|
|
|
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
|
|
|
|
free(dev);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((magic != 0x46423638) && (magic != 0x66623638)) {
|
|
|
|
|
/* File is not of the valid format, abort. */
|
|
|
|
|
d86f_log("86F: Unrecognized magic bytes: %08X\n", magic);
|
|
|
|
|
fclose(dev->f);
|
|
|
|
|
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
|
|
|
|
free(dev);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-15 03:48:33 +01:00
|
|
|
if (fread(&(dev->version), 1, 2, dev->f) != 2)
|
|
|
|
|
fatal("d86f_load(): Error reading format version\n");
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (dev->version != D86FVER) {
|
|
|
|
|
/* File is not of a recognized format version, abort. */
|
|
|
|
|
if (dev->version == 0x0063) {
|
|
|
|
|
d86f_log("86F: File has emulator-internal version 0.99, this version is not valid in a file\n");
|
|
|
|
|
} else if ((dev->version >= 0x0100) && (dev->version < D86FVER)) {
|
|
|
|
|
d86f_log("86F: No longer supported development file version: %i.%02i\n", dev->version >> 8, dev->version & 0xff);
|
|
|
|
|
} else {
|
|
|
|
|
d86f_log("86F: Unrecognized file version: %i.%02i\n", dev->version >> 8, dev->version & 0xff);
|
|
|
|
|
}
|
|
|
|
|
fclose(dev->f);
|
|
|
|
|
dev->f = NULL;
|
|
|
|
|
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
|
|
|
|
free(dev);
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
d86f_log("86F: Recognized file version: %i.%02i\n", dev->version >> 8, dev->version & 0xff);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fread(&(dev->disk_flags), 2, 1, dev->f);
|
2018-03-19 01:36:56 +01:00
|
|
|
|
|
|
|
|
if (d86f_has_surface_desc(drive)) {
|
|
|
|
|
for (i = 0; i < 2; i++)
|
|
|
|
|
dev->track_surface_data[i] = (uint16_t *) malloc(53048 * sizeof(uint16_t));
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 2; i++) {
|
|
|
|
|
for (j = 0; j < 2; j++)
|
|
|
|
|
dev->thin_track_surface_data[i][j] = (uint16_t *) malloc(53048 * sizeof(uint16_t));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-21 19:04:05 +02:00
|
|
|
#ifdef D86F_COMPRESS
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->is_compressed = (magic == 0x66623638) ? 1 : 0;
|
|
|
|
|
if ((len < 51052) && !dev->is_compressed) {
|
2018-05-21 19:04:05 +02:00
|
|
|
#else
|
|
|
|
|
if (len < 51052) {
|
|
|
|
|
#endif
|
2018-03-19 01:02:04 +01:00
|
|
|
/* File too small, abort. */
|
|
|
|
|
fclose(dev->f);
|
|
|
|
|
dev->f = NULL;
|
|
|
|
|
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
|
|
|
|
free(dev);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2016-09-28 22:56:19 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
#ifdef DO_CRC64
|
|
|
|
|
fseek(dev->f, 8, SEEK_SET);
|
|
|
|
|
fread(&read_crc64, 1, 8, dev->f);
|
2016-09-28 22:56:19 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
fseek(dev->f, 0, SEEK_SET);
|
2016-10-05 00:47:50 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
crc64 = 0xffffffffffffffff;
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->filebuf = malloc(len);
|
|
|
|
|
fread(dev->filebuf, 1, len, dev->f);
|
|
|
|
|
*(uint64_t *) &(dev->filebuf[8]) = 0xffffffffffffffff;
|
|
|
|
|
crc64 = (uint64_t) crc64speed(0, dev->filebuf, len);
|
|
|
|
|
free(dev->filebuf);
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (crc64 != read_crc64) {
|
|
|
|
|
d86f_log("86F: CRC64 error\n");
|
|
|
|
|
fclose(dev->f);
|
|
|
|
|
dev->f = NULL;
|
|
|
|
|
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
|
|
|
|
free(dev);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-05-21 19:04:05 +02:00
|
|
|
#ifdef D86F_COMPRESS
|
2018-03-19 01:02:04 +01:00
|
|
|
if (dev->is_compressed) {
|
2021-03-14 20:35:01 +01:00
|
|
|
memcpy(temp_file_name, drive ? nvr_path("TEMP$$$1.$$$") : nvr_path("TEMP$$$0.$$$"), 256);
|
|
|
|
|
memcpy(dev->original_file_name, fn, strlen(fn) + 1);
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
fclose(dev->f);
|
|
|
|
|
dev->f = NULL;
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2021-03-14 20:35:01 +01:00
|
|
|
dev->f = plat_fopen(temp_file_name, "wb");
|
2018-03-19 01:02:04 +01:00
|
|
|
if (! dev->f) {
|
|
|
|
|
d86f_log("86F: Unable to create temporary decompressed file\n");
|
2017-09-04 01:52:29 -04:00
|
|
|
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
2018-03-19 01:02:04 +01:00
|
|
|
free(dev);
|
2016-11-02 22:39:07 +01:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-14 20:35:01 +01:00
|
|
|
tf = plat_fopen(fn, "rb");
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
for (i = 0; i < 8; i++) {
|
|
|
|
|
fread(&temp, 1, 2, tf);
|
|
|
|
|
fwrite(&temp, 1, 2, dev->f);
|
|
|
|
|
}
|
2016-09-28 22:56:19 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->filebuf = (uint8_t *) malloc(len);
|
|
|
|
|
dev->outbuf = (uint8_t *) malloc(67108864);
|
|
|
|
|
fread(dev->filebuf, 1, len, tf);
|
|
|
|
|
temp = lzf_decompress(dev->filebuf, len, dev->outbuf, 67108864);
|
|
|
|
|
if (temp) {
|
|
|
|
|
fwrite(dev->outbuf, 1, temp, dev->f);
|
|
|
|
|
}
|
|
|
|
|
free(dev->outbuf);
|
|
|
|
|
free(dev->filebuf);
|
2016-09-28 22:56:19 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
fclose(tf);
|
|
|
|
|
fclose(dev->f);
|
|
|
|
|
dev->f = NULL;
|
2016-09-28 22:56:19 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (! temp) {
|
|
|
|
|
d86f_log("86F: Error decompressing file\n");
|
|
|
|
|
plat_remove(temp_file_name);
|
2017-09-04 01:52:29 -04:00
|
|
|
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
2018-03-19 01:02:04 +01:00
|
|
|
free(dev);
|
2016-09-28 22:56:19 +02:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-14 20:35:01 +01:00
|
|
|
dev->f = plat_fopen(temp_file_name, "rb+");
|
2018-03-19 01:02:04 +01:00
|
|
|
}
|
2018-05-21 19:04:05 +02:00
|
|
|
#endif
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (dev->disk_flags & 0x100) {
|
|
|
|
|
/* Zoned disk. */
|
|
|
|
|
d86f_log("86F: Disk is zoned (Apple or Sony)\n");
|
|
|
|
|
fclose(dev->f);
|
|
|
|
|
dev->f = NULL;
|
2018-05-21 19:04:05 +02:00
|
|
|
#ifdef D86F_COMPRESS
|
|
|
|
|
if (dev->is_compressed)
|
2018-03-19 01:02:04 +01:00
|
|
|
plat_remove(temp_file_name);
|
2018-05-21 19:04:05 +02:00
|
|
|
#endif
|
2018-03-19 01:02:04 +01:00
|
|
|
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
|
|
|
|
free(dev);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (dev->disk_flags & 0x600) {
|
|
|
|
|
/* Zone type is not 0 but the disk is fixed-RPM. */
|
|
|
|
|
d86f_log("86F: Disk is fixed-RPM but zone type is not 0\n");
|
|
|
|
|
fclose(dev->f);
|
|
|
|
|
dev->f = NULL;
|
2018-05-21 19:04:05 +02:00
|
|
|
#ifdef D86F_COMPRESS
|
2018-03-19 01:02:04 +01:00
|
|
|
if (dev->is_compressed)
|
|
|
|
|
plat_remove(temp_file_name);
|
2018-05-21 19:04:05 +02:00
|
|
|
#endif
|
2018-03-19 01:02:04 +01:00
|
|
|
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
|
|
|
|
free(dev);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (!writeprot[drive]) {
|
|
|
|
|
writeprot[drive] = (dev->disk_flags & 0x10) ? 1 : 0;
|
|
|
|
|
fwriteprot[drive] = writeprot[drive];
|
|
|
|
|
}
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (writeprot[drive]) {
|
|
|
|
|
fclose(dev->f);
|
|
|
|
|
dev->f = NULL;
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-05-21 19:04:05 +02:00
|
|
|
#ifdef D86F_COMPRESS
|
2018-03-19 01:02:04 +01:00
|
|
|
if (dev->is_compressed)
|
2021-03-14 20:35:01 +01:00
|
|
|
dev->f = plat_fopen(temp_file_name, "rb");
|
2018-05-21 19:04:05 +02:00
|
|
|
else
|
|
|
|
|
#endif
|
2021-03-14 20:35:01 +01:00
|
|
|
dev->f = plat_fopen(fn, "rb");
|
2018-03-19 01:02:04 +01:00
|
|
|
}
|
2016-09-28 22:56:19 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
/* OK, set the drive data, other code needs it. */
|
|
|
|
|
d86f[drive] = dev;
|
2016-09-28 22:56:19 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
fseek(dev->f, 8, SEEK_SET);
|
2016-09-28 22:56:19 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
fread(dev->track_offset, 1, d86f_get_track_table_size(drive), dev->f);
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (! (dev->track_offset[0])) {
|
|
|
|
|
/* File has no track 0 side 0, abort. */
|
|
|
|
|
d86f_log("86F: No Track 0 side 0\n");
|
|
|
|
|
fclose(dev->f);
|
|
|
|
|
dev->f = NULL;
|
|
|
|
|
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
|
|
|
|
free(dev);
|
|
|
|
|
d86f[drive] = NULL;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((d86f_get_sides(drive) == 2) && !(dev->track_offset[1])) {
|
|
|
|
|
/* File is 2-sided but has no track 0 side 1, abort. */
|
|
|
|
|
d86f_log("86F: No Track 0 side 1\n");
|
|
|
|
|
fclose(dev->f);
|
|
|
|
|
dev->f = NULL;
|
|
|
|
|
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
|
|
|
|
free(dev);
|
|
|
|
|
d86f[drive] = NULL;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Load track 0 flags as default. */
|
2020-01-15 03:04:59 +01:00
|
|
|
if (fseek(dev->f, dev->track_offset[0], SEEK_SET) == -1)
|
|
|
|
|
fatal("d86f_load(): Track 0: Error seeking to the beginning of the file\n");
|
|
|
|
|
if (fread(&(dev->side_flags[0]), 1, 2, dev->f) != 2)
|
|
|
|
|
fatal("d86f_load(): Track 0: Error reading side flags\n");
|
2018-03-19 01:02:04 +01:00
|
|
|
if (dev->disk_flags & 0x80) {
|
2020-01-15 03:04:59 +01:00
|
|
|
if (fread(&(dev->extra_bit_cells[0]), 1, 4, dev->f) != 4)
|
|
|
|
|
fatal("d86f_load(): Track 0: Error reading the amount of extra bit cells\n");
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
if ((dev->disk_flags & 0x1060) != 0x1000) {
|
|
|
|
|
if (dev->extra_bit_cells[0] < -32768) dev->extra_bit_cells[0] = -32768;
|
|
|
|
|
if (dev->extra_bit_cells[0] > 32768) dev->extra_bit_cells[0] = 32768;
|
|
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
} else {
|
|
|
|
|
dev->extra_bit_cells[0] = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (d86f_get_sides(drive) == 2) {
|
2020-01-15 03:04:59 +01:00
|
|
|
if (fseek(dev->f, dev->track_offset[1], SEEK_SET) == -1)
|
|
|
|
|
fatal("d86f_load(): Track 1: Error seeking to the beginning of the file\n");
|
|
|
|
|
if (fread(&(dev->side_flags[1]), 1, 2, dev->f) != 2)
|
|
|
|
|
fatal("d86f_load(): Track 1: Error reading side flags\n");
|
2018-03-19 01:02:04 +01:00
|
|
|
if (dev->disk_flags & 0x80) {
|
2020-01-15 03:04:59 +01:00
|
|
|
if (fread(&(dev->extra_bit_cells[1]), 1, 4, dev->f) != 4)
|
|
|
|
|
fatal("d86f_load(): Track 4: Error reading the amount of extra bit cells\n");
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
if ((dev->disk_flags & 0x1060) != 0x1000) {
|
|
|
|
|
if (dev->extra_bit_cells[1] < -32768) dev->extra_bit_cells[1] = -32768;
|
|
|
|
|
if (dev->extra_bit_cells[1] > 32768) dev->extra_bit_cells[1] = 32768;
|
|
|
|
|
}
|
2018-03-19 01:02:04 +01:00
|
|
|
} else {
|
2020-06-11 12:52:50 +02:00
|
|
|
dev->extra_bit_cells[1] = 0;
|
2018-03-19 01:02:04 +01:00
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
switch ((dev->disk_flags >> 1) >> 3) {
|
|
|
|
|
case 0:
|
|
|
|
|
default:
|
|
|
|
|
dev->side_flags[1] = 0x0a;
|
|
|
|
|
break;
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
case 1:
|
|
|
|
|
dev->side_flags[1] = 0x00;
|
|
|
|
|
break;
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
case 2:
|
|
|
|
|
case 3:
|
|
|
|
|
dev->side_flags[1] = 0x03;
|
|
|
|
|
break;
|
2016-09-28 22:56:19 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
dev->extra_bit_cells[1] = 0;
|
|
|
|
|
}
|
2016-09-28 22:56:19 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
fseek(dev->f, 0, SEEK_END);
|
|
|
|
|
dev->file_size = ftell(dev->f);
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
fseek(dev->f, 0, SEEK_SET);
|
2016-09-28 22:56:19 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_register_86f(drive);
|
2016-09-28 22:56:19 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
drives[drive].seek = d86f_seek;
|
|
|
|
|
d86f_common_handlers(drive);
|
|
|
|
|
drives[drive].format = d86f_format;
|
|
|
|
|
|
2018-05-21 19:04:05 +02:00
|
|
|
#ifdef D86F_COMPRESS
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_log("86F: Disk is %scompressed and does%s have surface description data\n",
|
|
|
|
|
dev->is_compressed ? "" : "not ",
|
|
|
|
|
d86f_has_surface_desc(drive) ? "" : " not");
|
2018-05-21 19:04:05 +02:00
|
|
|
#else
|
|
|
|
|
d86f_log("86F: Disk does%s have surface description data\n",
|
|
|
|
|
d86f_has_surface_desc(drive) ? "" : " not");
|
|
|
|
|
#endif
|
2018-03-19 01:02:04 +01:00
|
|
|
}
|
2016-11-03 22:07:34 +01:00
|
|
|
|
2016-09-28 22:56:19 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
void
|
|
|
|
|
d86f_init(void)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
2016-08-31 22:49:56 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
setup_crc(0x1021);
|
2016-08-31 22:49:56 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
for (i = 0; i < FDD_NUM; i++)
|
|
|
|
|
d86f[i] = NULL;
|
|
|
|
|
}
|
2016-09-28 22:56:19 +02:00
|
|
|
|
2016-08-31 22:49:56 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
void
|
|
|
|
|
d86f_set_fdc(void *fdc)
|
|
|
|
|
{
|
|
|
|
|
d86f_fdc = (fdc_t *) fdc;
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
2016-08-31 22:49:56 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
d86f_close(int drive)
|
2016-11-02 22:39:07 +01:00
|
|
|
{
|
2018-03-19 01:36:56 +01:00
|
|
|
int i, j;
|
|
|
|
|
|
2021-03-14 20:35:01 +01:00
|
|
|
char temp_file_name[2048];
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
2018-03-15 00:02:19 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
/* Make sure the drive is alive. */
|
|
|
|
|
if (dev == NULL) return;
|
2016-08-31 22:49:56 +02:00
|
|
|
|
2021-03-14 20:35:01 +01:00
|
|
|
memcpy(temp_file_name, drive ? nvr_path("TEMP$$$1.$$$") : nvr_path("TEMP$$$0.$$$"), 26);
|
2018-03-19 01:02:04 +01:00
|
|
|
|
2018-03-19 01:36:56 +01:00
|
|
|
if (d86f_has_surface_desc(drive)) {
|
|
|
|
|
for (i = 0; i < 2; i++) {
|
|
|
|
|
if (dev->track_surface_data[i]) {
|
|
|
|
|
free(dev->track_surface_data[i]);
|
|
|
|
|
dev->track_surface_data[i] = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 2; i++) {
|
|
|
|
|
for (j = 0; j < 2; j++) {
|
|
|
|
|
if (dev->thin_track_surface_data[i][j]) {
|
|
|
|
|
free(dev->thin_track_surface_data[i][j]);
|
|
|
|
|
dev->thin_track_surface_data[i][j] = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (dev->f) {
|
|
|
|
|
fclose(dev->f);
|
|
|
|
|
dev->f = NULL;
|
|
|
|
|
}
|
2018-05-21 19:04:05 +02:00
|
|
|
#ifdef D86F_COMPRESS
|
2018-03-19 01:02:04 +01:00
|
|
|
if (dev->is_compressed)
|
|
|
|
|
plat_remove(temp_file_name);
|
2018-05-21 19:04:05 +02:00
|
|
|
#endif
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
2016-10-09 22:18:03 +02:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
/* When an FDD is mounted, set up the D86F data structures. */
|
|
|
|
|
void
|
|
|
|
|
d86f_setup(int drive)
|
2018-01-17 18:43:36 +01:00
|
|
|
{
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev;
|
|
|
|
|
|
|
|
|
|
/* Allocate a drive structure. */
|
|
|
|
|
dev = (d86f_t *)malloc(sizeof(d86f_t));
|
|
|
|
|
memset(dev, 0x00, sizeof(d86f_t));
|
|
|
|
|
dev->state = STATE_IDLE;
|
|
|
|
|
|
|
|
|
|
dev->last_side_sector[0] = NULL;
|
|
|
|
|
dev->last_side_sector[1] = NULL;
|
|
|
|
|
|
|
|
|
|
/* Set the drive as active. */
|
|
|
|
|
d86f[drive] = dev;
|
2018-01-17 18:43:36 +01:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
|
|
|
|
|
/* If an FDD is unmounted, unlink the D86F data structures. */
|
|
|
|
|
void
|
|
|
|
|
d86f_destroy(int drive)
|
2016-11-02 22:39:07 +01:00
|
|
|
{
|
2018-03-19 01:36:56 +01:00
|
|
|
int i, j;
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_t *dev = d86f[drive];
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (dev == NULL) return;
|
2016-11-02 22:39:07 +01:00
|
|
|
|
2018-03-19 01:36:56 +01:00
|
|
|
if (d86f_has_surface_desc(drive)) {
|
|
|
|
|
for (i = 0; i < 2; i++) {
|
|
|
|
|
if (dev->track_surface_data[i]) {
|
|
|
|
|
free(dev->track_surface_data[i]);
|
|
|
|
|
dev->track_surface_data[i] = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 2; i++) {
|
|
|
|
|
for (j = 0; j < 2; j++) {
|
|
|
|
|
if (dev->thin_track_surface_data[i][j]) {
|
|
|
|
|
free(dev->thin_track_surface_data[i][j]);
|
|
|
|
|
dev->thin_track_surface_data[i][j] = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
d86f_destroy_linked_lists(drive, 0);
|
|
|
|
|
d86f_destroy_linked_lists(drive, 1);
|
|
|
|
|
|
|
|
|
|
free(d86f[drive]);
|
|
|
|
|
d86f[drive] = NULL;
|
2019-12-05 21:36:28 +01:00
|
|
|
|
|
|
|
|
d86f_handler[drive].read_data = NULL;
|
2016-08-20 03:40:12 +02:00
|
|
|
}
|