Merge remote-tracking branch 'origin/master' into feature/machine_and_kb

This commit is contained in:
OBattler
2021-09-17 23:32:05 +02:00
4 changed files with 132 additions and 9 deletions

View File

@@ -83,8 +83,10 @@ find_package(SDL2 REQUIRED)
include_directories(${SDL2_INCLUDE_DIRS})
if(MINGW)
target_link_libraries(86Box SDL2::SDL2-static)
else()
elseif(WIN32)
target_link_libraries(86Box SDL2::SDL2)
else()
target_link_libraries(86Box ${SDL2_LIBRARIES})
endif()
find_package(PNG REQUIRED)

View File

@@ -4314,6 +4314,56 @@ static inline void FP_LOAD_REG_D(int reg, int *host_reg1, int *host_reg2)
*host_reg1 = REG_EBX;
}
static inline int64_t x87_fround16_64(double b)
{
int16_t a, c;
switch ((cpu_state.npxc >> 10) & 3)
{
case 0: /*Nearest*/
a = (int16_t)floor(b);
c = (int16_t)floor(b + 1.0);
if ((b - a) < (c - b))
return (int64_t) a;
else if ((b - a) > (c - b))
return (int64_t) c;
else
return (a & 1) ? c : a;
case 1: /*Down*/
return (int64_t)((int16_t)floor(b));
case 2: /*Up*/
return (int64_t)((int16_t)ceil(b));
case 3: /*Chop*/
return (int64_t)((int16_t)b);
}
return 0;
}
static inline int64_t x87_fround32_64(double b)
{
int32_t a, c;
switch ((cpu_state.npxc >> 10) & 3)
{
case 0: /*Nearest*/
a = (int32_t)floor(b);
c = (int32_t)floor(b + 1.0);
if ((b - a) < (c - b))
return (int64_t) a;
else if ((b - a) > (c - b))
return (int64_t) c;
else
return (a & 1) ? c : a;
case 1: /*Down*/
return (int64_t)((int32_t)floor(b));
case 2: /*Up*/
return (int64_t)((int32_t)ceil(b));
case 3: /*Chop*/
return (int64_t)((int32_t)b);
}
return 0;
}
static inline int64_t x87_fround(double b)
{
int64_t a, c;

View File

@@ -1498,10 +1498,15 @@ uint8_t
d86f_get_data(int drive, int base)
{
d86f_t *dev = d86f[drive];
int data;
int data, byte_count;
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 (fdd_get_turbo(drive) && (dev->version == 0x0063))
byte_count = dev->turbo_pos;
else
byte_count = dev->data_find.bytes_obtained;
if (byte_count < (d86f_get_data_len(drive) + base)) {
data = fdc_getdata(d86f_fdc, byte_count == (d86f_get_data_len(drive) + base - 1));
if ((data & DMA_OVER) || (data == -1)) {
dev->dma_over++;
if (data == -1)
@@ -1577,7 +1582,7 @@ d86f_read_sector_data(int drive, int side)
} else {
if (dev->data_find.bytes_obtained < d86f_get_data_len(drive)) {
if (dev->state != STATE_16_VERIFY_DATA) {
read_status = fdc_data(d86f_fdc, data, dev->data_find.bytes_obtained == ((d86f_get_data_len(drive)) - 1));
read_status = fdc_data(d86f_fdc, data, dev->data_find.bytes_obtained == (d86f_get_data_len(drive) - 1));
if (read_status == -1)
dev->dma_over++;
}
@@ -2130,23 +2135,24 @@ d86f_turbo_read(int drive, int side)
dat = d86f_handler[drive].read_data(drive, side, dev->turbo_pos);
else
dat = (random_generate() & 0xff);
dev->turbo_pos++;
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->turbo_pos < (128UL << dev->req_sector.id.n)) {
if (dev->state != STATE_16_VERIFY_DATA) {
read_status = fdc_data(d86f_fdc, dat, dev->data_find.bytes_obtained == ((128UL << dev->last_sector.id.n) - 1));
read_status = fdc_data(d86f_fdc, dat, dev->turbo_pos == ((128UL << dev->req_sector.id.n) - 1));
if (read_status == -1)
dev->dma_over++;
}
}
}
if (dev->turbo_pos >= (128 << dev->last_sector.id.n)) {
dev->turbo_pos++;
if (dev->turbo_pos >= (128UL << dev->req_sector.id.n)) {
dev->data_find.sync_marks = dev->data_find.bits_obtained = dev->data_find.bytes_obtained = 0;
if ((flags & SECTOR_CRC_ERROR) && (dev->state != STATE_02_READ_DATA)) {
#ifdef ENABLE_D86F_LOG