Merge branch '86Box:master' into master

This commit is contained in:
starfrost
2025-03-21 01:00:39 +00:00
committed by GitHub
9 changed files with 47 additions and 7 deletions

View File

@@ -32,6 +32,7 @@
#include <wchar.h>
#include <stdatomic.h>
#include <unistd.h>
#include <math.h>
#ifndef _WIN32
# include <pwd.h>
@@ -233,6 +234,8 @@ extern int CPUID;
extern int output;
int atfullspeed;
extern double exp_pow_table[0x800];
char exe_path[2048]; /* path (dir) of executable */
char usr_path[1024]; /* path (dir) of user data */
char cfg_path[1024]; /* full path of config file */
@@ -1086,6 +1089,11 @@ pc_init_modules(void)
machine_status_init();
for (c = 0; c <= 0x7ff; c++) {
int64_t exp = c - 1023; /* 1023 = BIAS64 */
exp_pow_table[c] = pow(2.0, (double) exp);
}
if (do_nothing) {
do_nothing = 0;
exit(-1);

View File

@@ -3011,6 +3011,19 @@ save_other_removable_devices(void)
else
ini_section_set_string(cat, temp, zip_drives[c].image_path);
}
for (int i = 0; i < MAX_PREV_IMAGES; i++) {
sprintf(temp, "zip_%02i_image_history_%02i", c + 1, i + 1);
if ((zip_drives[c].image_history[i] == 0) || strlen(zip_drives[c].image_history[i]) == 0)
ini_section_delete_var(cat, temp);
else {
path_normalize(zip_drives[c].image_history[i]);
if (!strnicmp(zip_drives[c].image_history[i], usr_path, strlen(usr_path)))
ini_section_set_string(cat, temp, &zip_drives[c].image_history[i][strlen(usr_path)]);
else
ini_section_set_string(cat, temp, zip_drives[c].image_history[i]);
}
}
}
for (c = 0; c < MO_NUM; c++) {
@@ -3054,6 +3067,19 @@ save_other_removable_devices(void)
else
ini_section_set_string(cat, temp, mo_drives[c].image_path);
}
for (int i = 0; i < MAX_PREV_IMAGES; i++) {
sprintf(temp, "mo_%02i_image_history_%02i", c + 1, i + 1);
if ((mo_drives[c].image_history[i] == 0) || strlen(mo_drives[c].image_history[i]) == 0)
ini_section_delete_var(cat, temp);
else {
path_normalize(mo_drives[c].image_history[i]);
if (!strnicmp(mo_drives[c].image_history[i], usr_path, strlen(usr_path)))
ini_section_set_string(cat, temp, &mo_drives[c].image_history[i][strlen(usr_path)]);
else
ini_section_set_string(cat, temp, mo_drives[c].image_history[i]);
}
}
}
ini_delete_section_if_empty(config, cat);

View File

@@ -287,6 +287,9 @@ uint8_t reg_30 = 0x00;
uint8_t arr[24] = { 0 };
uint8_t rcr[8] = { 0 };
/* Table for FXTRACT. */
double exp_pow_table[0x800];
static int cyrix_addr;
static void cpu_write(uint16_t addr, uint8_t val, void *priv);

View File

@@ -36,6 +36,8 @@ extern void fpu_log(const char *fmt, ...);
# endif
#endif
extern double exp_pow_table[0x800];
static int rounding_modes[4] = { FE_TONEAREST, FE_DOWNWARD, FE_UPWARD, FE_TOWARDZERO };
#define ST(x) cpu_state.ST[((cpu_state.TOP + (x)) & 7)]

View File

@@ -46,7 +46,7 @@ opFXTRACT(UNUSED(uint32_t fetchdat))
test.eind.d = ST(0);
exp80 = test.eind.ll & 0x7ff0000000000000LL;
exp80final = (exp80 >> 52) - BIAS64;
mant = test.eind.d / (pow(2.0, (double) exp80final));
mant = test.eind.d / exp_pow_table[exp80 >> 52];
ST(0) = (double) exp80final;
FP_TAG_VALID;
x87_push(mant);

View File

@@ -1363,6 +1363,7 @@ mo_command(scsi_common_t *sc, const uint8_t *cdb)
mo_buf_alloc(dev, dev->packet_len);
const int ret = mo_blocks(dev, &alloc_length, 0);
alloc_length = dev->requested_blocks * dev->drv->sector_size;
if (ret > 0) {
dev->requested_blocks = max_len;

View File

@@ -1386,10 +1386,8 @@ zip_command(scsi_common_t *sc, const uint8_t *cdb)
dev->packet_len = max_len * alloc_length;
zip_buf_alloc(dev, dev->packet_len);
int ret = 0;
if (dev->sector_len > 0)
ret = zip_blocks(dev, &alloc_length, 0);
const int ret = zip_blocks(dev, &alloc_length, 0);
alloc_length = dev->requested_blocks * 512;
if (ret > 0) {
dev->requested_blocks = max_len;

View File

@@ -2370,7 +2370,7 @@ mem_mapping_recalc(uint64_t base, uint64_t size)
for (i_c = i_s; i_c <= i_e; i_c += i_a) {
for (c = (start + i_c); c < (end + i_c); c += MEM_GRANULARITY_SIZE) {
/* CPU */
n = !!in_smm;
n = (!!in_smm) || (is_cxsmm && (ccr1 & CCR1_SMAC));
wp = _mem_wp[c >> MEM_GRANULARITY_BITS];
if (map->exec && mem_mapping_access_allowed(map->flags,

View File

@@ -1095,7 +1095,9 @@ scsi_disk_command(scsi_common_t *sc, const uint8_t *cdb)
dev->drv->seek_pos = dev->sector_pos;
dev->drv->seek_len = dev->sector_len;
ret = scsi_disk_blocks(dev, &alloc_length, 1, 0);
ret = scsi_disk_blocks(dev, &alloc_length, 1, 0);
alloc_length = dev->requested_blocks * 512;
if (ret > 0) {
dev->requested_blocks = max_len;
dev->packet_len = alloc_length;