Merge branch 'master' into tandy-shake

This commit is contained in:
pixel-jupiter
2025-09-30 15:41:02 +03:00
399 changed files with 26924 additions and 18317 deletions

View File

@@ -79,6 +79,17 @@
#define BCD16(x) ((((x) / 1000) << 12) | (((x) / 100) << 8) | BCD8(x))
#define BCD32(x) ((((x) / 10000000) << 28) | (((x) / 1000000) << 24) | (((x) / 100000) << 20) | (((x) / 10000) << 16) | BCD16(x))
#define AS_U8(x) (*((uint8_t *) &(x)))
#define AS_U16(x) (*((uint16_t *) &(x)))
#define AS_U32(x) (*((uint32_t *) &(x)))
#define AS_U64(x) (*((uint64_t *) &(x)))
#define AS_I8(x) (*((int8_t *) &(x)))
#define AS_I16(x) (*((int16_t *) &(x)))
#define AS_I32(x) (*((int32_t *) &(x)))
#define AS_I64(x) (*((int64_t *) &(x)))
#define AS_FLOAT(x) (*((float *) &(x)))
#define AS_DOUBLE(x) (*((double *) &(x)))
#if defined(__GNUC__) || defined(__clang__)
# define UNLIKELY(x) __builtin_expect((x), 0)
# define LIKELY(x) __builtin_expect((x), 1)
@@ -208,6 +219,7 @@ extern int monitor_edid; /* (C) Which EDID to use. 0=default,
extern char monitor_edid_path[1024]; /* (C) Path to custom EDID */
extern int color_scheme; /* (C) Color scheme of UI (Windows-only) */
extern int fdd_sounds_enabled; /* (C) Enable floppy drive sounds */
#ifndef USE_NEW_DYNAREC
extern FILE *stdlog; /* file to log output to */

View File

@@ -8,8 +8,6 @@
*
* Definitions for the ACPI emulation.
*
*
*
* Authors: Miran Grca, <mgrca8@gmail.com>
*
* Copyright 2020-2025 Miran Grca.

View File

@@ -214,6 +214,10 @@ extern const device_t via_vt8231_device;
/* VLSI */
extern const device_t vl82c480_device;
extern const device_t vl82c486_device;
extern const device_t vl82c59x_device;
extern const device_t vl82c59x_compaq_device;
extern const device_t vl82c59x_wildcat_device;
extern const device_t vl82c59x_wildcat_compaq_device;
extern const device_t vlsi_scamp_device;
/* WD */
@@ -228,6 +232,10 @@ extern const device_t nec_mate_unk_device;
extern const device_t phoenix_486_jumper_device;
extern const device_t phoenix_486_jumper_pci_device;
extern const device_t phoenix_486_jumper_pci_pb600_device;
extern const device_t ast_readout_device;
extern const device_t ast_nvr_device;
extern const device_t radisys_config_device;

View File

@@ -14,10 +14,12 @@
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
* Toni Riikonen, <riikonen.toni@gmail.com>
*
* Copyright 2008-2020 Sarah Walker.
* Copyright 2016-2020 Miran Grca.
* Copyright 2018-2020 Fred N. van Kempen.
* Copyright 2025 Toni Riikonen.
*/
#ifndef EMU_FDC_H
#define EMU_FDC_H
@@ -251,6 +253,7 @@ extern uint8_t fdc_read(uint16_t addr, void *priv);
extern void fdc_reset(void *priv);
extern uint8_t fdc_get_current_drive(void);
extern void fdc_seek_complete_interrupt(fdc_t *fdc, int drive);
#ifdef EMU_DEVICE_H
extern const device_t fdc_xt_device;

View File

@@ -11,10 +11,12 @@
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
* Toni Riikonen, <riikonen.toni@gmail.com>
*
* Copyright 2008-2025 Sarah Walker.
* Copyright 2016-2025 Miran Grca.
* Copyright 2018-2025 Fred N. van Kempen.
* Copyright 2025 Toni Riikonen.
*/
#ifndef EMU_FDD_H
#define EMU_FDD_H
@@ -23,6 +25,13 @@
#define FLOPPY_IMAGE_HISTORY 10
#define SEEK_RECALIBRATE -999
/* Per-drive audio profiles */
#define FDD_AUDIO_PROFILE_NONE 0
#define FDD_AUDIO_PROFILE_MITSUMI 1
#define FDD_AUDIO_PROFILE_PANASONIC 2
#define FDD_AUDIO_PROFILE_TEAC 3
#define FDD_AUDIO_PROFILE_MAX 4
#ifdef __cplusplus
extern "C" {
#endif
@@ -53,6 +62,10 @@ extern int fdd_get_check_bpb(int drive);
extern void fdd_set_type(int drive, int type);
extern int fdd_get_type(int drive);
/* New audio profile accessors */
extern void fdd_set_audio_profile(int drive, int profile);
extern int fdd_get_audio_profile(int drive);
extern int fdd_get_flags(int drive);
extern int fdd_get_densel(int drive);

View File

@@ -0,0 +1,86 @@
/*
* 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.
*
* This file is part of the 86Box distribution.
*
* Definitions for the floppy drive audio emulation.
*
* Authors: Toni Riikonen, <riikonen.toni@gmail.com>
*
* Copyright 2025 Toni Riikonen.
*/
#ifndef EMU_FDD_AUDIO_H
#define EMU_FDD_AUDIO_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef DISABLE_FDD_AUDIO
/* Motor sound states */
typedef enum {
MOTOR_STATE_STOPPED = 0,
MOTOR_STATE_STARTING,
MOTOR_STATE_RUNNING,
MOTOR_STATE_STOPPING
} motor_state_t;
/* WAV header structure */
typedef struct {
char riff[4];
uint32_t size;
char wave[4];
char fmt[4];
uint32_t fmt_size;
uint16_t audio_format;
uint16_t num_channels;
uint32_t sample_rate;
uint32_t byte_rate;
uint16_t block_align;
uint16_t bits_per_sample;
char data[4];
uint32_t data_size;
} wav_header_t;
/* Fade duration: 75ms at 48kHz = 3600 samples */
#define FADE_DURATION_MS 75
#define FADE_SAMPLES (48000 * FADE_DURATION_MS / 1000)
#else
typedef enum {
MOTOR_STATE_STOPPED = 0
} motor_state_t;
#endif /* DISABLE_FDD_AUDIO */
/* FDD audio initialization and cleanup */
extern void fdd_audio_init(void);
extern void fdd_audio_close(void);
/* Motor control for audio */
extern void fdd_audio_set_motor_enable(int drive, int motor_enable);
/* Single sector movement audio */
extern void fdd_audio_play_single_track_step(int drive, int from_track, int to_track);
/* Multi-track seek audio */
extern void fdd_audio_play_multi_track_seek(int drive, int from_track, int to_track);
/* Audio callback function */
extern void fdd_audio_callback(int16_t *buffer, int length);
/* State name helper function */
extern const char *fdd_audio_motor_state_name(motor_state_t state);
#ifdef __cplusplus
}
#endif
#endif /*EMU_FDD_AUDIO_H*/

View File

@@ -5,7 +5,7 @@
/* fc=150Hz */
static inline float
adgold_highpass_iir(int c, int i, float NewSample)
adgold_highpass_iir(int i, float NewSample)
{
float ACoef[NCoef + 1] = {
0.98657437157334349000,
@@ -19,28 +19,28 @@ adgold_highpass_iir(int c, int i, float NewSample)
0.97261396931534050000
};
static float y[2][2][NCoef + 1]; /* output samples */
static float x[2][2][NCoef + 1]; /* input samples */
static float y[2][NCoef + 1]; /* output samples */
static float x[2][NCoef + 1]; /* input samples */
int n;
/* shift the old samples */
for (n = NCoef; n > 0; n--) {
x[c][i][n] = x[c][i][n - 1];
y[c][i][n] = y[c][i][n - 1];
x[i][n] = x[i][n - 1];
y[i][n] = y[i][n - 1];
}
/* Calculate the new output */
x[c][i][0] = NewSample;
y[c][i][0] = ACoef[0] * x[c][i][0];
x[i][0] = NewSample;
y[i][0] = ACoef[0] * x[i][0];
for (n = 1; n <= NCoef; n++)
y[c][i][0] += ACoef[n] * x[c][i][n] - BCoef[n] * y[c][i][n];
y[i][0] += ACoef[n] * x[i][n] - BCoef[n] * y[i][n];
return y[c][i][0];
return y[i][0];
}
/* fc=150Hz */
static inline float
adgold_lowpass_iir(int c, int i, float NewSample)
adgold_lowpass_iir(int i, float NewSample)
{
float ACoef[NCoef + 1] = {
0.00009159473951071446,
@@ -54,23 +54,23 @@ adgold_lowpass_iir(int c, int i, float NewSample)
0.97261396931306277000
};
static float y[2][2][NCoef + 1]; /* output samples */
static float x[2][2][NCoef + 1]; /* input samples */
static float y[2][NCoef + 1]; /* output samples */
static float x[2][NCoef + 1]; /* input samples */
int n;
/* shift the old samples */
for (n = NCoef; n > 0; n--) {
x[c][i][n] = x[c][i][n - 1];
y[c][i][n] = y[c][i][n - 1];
x[i][n] = x[i][n - 1];
y[i][n] = y[i][n - 1];
}
/* Calculate the new output */
x[c][i][0] = NewSample;
y[c][i][0] = ACoef[0] * x[c][i][0];
x[i][0] = NewSample;
y[i][0] = ACoef[0] * x[i][0];
for (n = 1; n <= NCoef; n++)
y[c][i][0] += ACoef[n] * x[c][i][n] - BCoef[n] * y[c][i][n];
y[i][0] += ACoef[n] * x[i][n] - BCoef[n] * y[i][n];
return y[c][i][0];
return y[i][0];
}
/* fc=56Hz */

View File

@@ -76,6 +76,7 @@ extern const device_t ide_cmd640_pci_device; /* CMD PCI-640B
extern const device_t ide_cmd640_pci_legacy_only_device; /* CMD PCI-640B PCI (Legacy Mode Only) */
extern const device_t ide_cmd640_pci_single_channel_device; /* CMD PCI-640B PCI (Only primary channel) */
extern const device_t ide_cmd640_pci_single_channel_sec_device; /* CMD PCI-640B PCI (Only secondary channel) */
extern const device_t ide_cmd640_pci_single_channel_legacy_only_device; /* CMD PCI-640B PCI (Legacy Mode Only/Only primary channel) */
extern const device_t ide_cmd646_device; /* CMD PCI-646 */
extern const device_t ide_cmd646_legacy_only_device; /* CMD PCI-646 (Legacy Mode Only) */
extern const device_t ide_cmd646_single_channel_device; /* CMD PCI-646 (Only primary channel) */
@@ -89,6 +90,7 @@ extern const device_t ide_opti611_vlb_sec_device; /* OPTi 82c611/6
extern const device_t ide_rz1000_pci_device; /* PC Technology RZ-1000 PCI */
extern const device_t ide_rz1000_pci_single_channel_device; /* PC Technology RZ-1000 PCI (Only primary channel) */
extern const device_t ide_rz1001_pci_device; /* PC Technology RZ-1001 PCI */
extern const device_t ide_um8673f_device; /* UMC UM8673F */
extern const device_t ide_um8886af_device; /* UMC UM8886AF */

View File

@@ -28,7 +28,8 @@ enum {
ISAPNP_CARD_DISABLE = 0,
ISAPNP_CARD_ENABLE = 1,
ISAPNP_CARD_FORCE_CONFIG = 2, /* cheat code for UMC UM8669F */
ISAPNP_CARD_NO_KEY = 3 /* cheat code for Crystal CS423x */
ISAPNP_CARD_NO_KEY = 3, /* cheat code for Crystal CS423x */
ISAPNP_CARD_FORCE_SLEEP = 4 /* cheat code for Yamaha YMF-71x */
};
typedef struct isapnp_device_config_t {
@@ -56,19 +57,24 @@ typedef struct isapnp_device_config_t {
extern const uint8_t isapnp_init_key[32];
void *isapnp_add_card(uint8_t *rom, uint16_t rom_size,
void (*config_changed)(uint8_t ld, isapnp_device_config_t *config, void *priv),
void (*csn_changed)(uint8_t csn, void *priv),
uint8_t (*read_vendor_reg)(uint8_t ld, uint8_t reg, void *priv),
void (*write_vendor_reg)(uint8_t ld, uint8_t reg, uint8_t val, void *priv),
void *priv);
void isapnp_update_card_rom(void *priv, uint8_t *rom, uint16_t rom_size);
void isapnp_enable_card(void *priv, uint8_t enable);
void isapnp_set_csn(void *priv, uint8_t csn);
uint8_t isapnp_read_reg(void *priv, uint8_t ldn, uint8_t reg);
void isapnp_write_reg(void *priv, uint8_t ldn, uint8_t reg, uint8_t val);
void isapnp_set_device_defaults(void *priv, uint8_t ldn, const isapnp_device_config_t *config);
void isapnp_reset_card(void *priv);
void isapnp_reset_device(void *priv, uint8_t ld);
extern void *isapnp_add_card(uint8_t *rom, uint16_t rom_size,
void (*config_changed)(uint8_t ld, isapnp_device_config_t *config, void *priv),
void (*csn_changed)(uint8_t csn, void *priv),
uint8_t (*read_vendor_reg)(uint8_t ld, uint8_t reg, void *priv),
void (*write_vendor_reg)(uint8_t ld, uint8_t reg, uint8_t val, void *priv),
void *priv);
extern void isapnp_update_card_rom(void *priv, uint8_t *rom, uint16_t rom_size);
extern void isapnp_enable_card(void *priv, uint8_t enable);
extern void isapnp_set_csn(void *priv, uint8_t csn);
extern uint8_t isapnp_read_reg(void *priv, uint8_t ldn, uint8_t reg);
extern void isapnp_write_reg(void *priv, uint8_t ldn, uint8_t reg, uint8_t val);
extern void isapnp_set_device_defaults(void *priv, uint8_t ldn, const isapnp_device_config_t *config);
extern void isapnp_reset_card(void *priv);
extern void isapnp_reset_device(void *priv, uint8_t ld);
extern void isapnp_set_rt(void *priv, uint8_t is_rt);
extern void isapnp_set_normal(void *priv, uint8_t normal);
extern void isapnp_activate(void *priv, uint16_t base, uint8_t irq, int active);
extern void isapnp_set_single_ld(void *priv);
extern uint8_t *isapnp_get_csnsav(void *priv);
#endif /*EMU_ISAPNP_H*/

View File

@@ -301,6 +301,8 @@ enum {
MACHINE_CHIPSET_VLSI_VL82C480,
MACHINE_CHIPSET_VLSI_VL82C481,
MACHINE_CHIPSET_VLSI_VL82C486,
MACHINE_CHIPSET_VLSI_SUPERCORE,
MACHINE_CHIPSET_VLSI_WILDCAT,
MACHINE_CHIPSET_WD76C10,
MACHINE_CHIPSET_ZYMOS_POACH,
MACHINE_CHIPSET_MAX
@@ -890,6 +892,9 @@ extern int machine_at_ecs50x_init(const machine_t *);
/* OPTi 597 */
extern int machine_at_pci56001_init(const machine_t *);
/* VLSI SuperCore */
extern int machine_at_celebris5xx_init(const machine_t *);
/* m_at_socket5.c */
/* i430NX */
extern int machine_at_p54np4_init(const machine_t *);
@@ -930,6 +935,15 @@ extern int machine_at_torino_init(const machine_t *);
/* UMC 889x */
extern int machine_at_hot539_init(const machine_t *);
/* VLSI SuperCore */
extern int machine_at_bravoms586_init(const machine_t *);
extern int machine_at_g586vpmc_init(const machine_t *);
extern int machine_at_m54si_init(const machine_t *);
extern int machine_at_pb600_init(const machine_t *);
/* VLSI Wildcat */
extern int machine_at_globalyst620_init(const machine_t *);
/* m_at_socket7_3v.c */
/* i430FX */
#ifdef EMU_DEVICE_H
@@ -976,6 +990,9 @@ extern int machine_at_ap5s_init(const machine_t *);
extern int machine_at_pc140_6260_init(const machine_t *);
extern int machine_at_ms5124_init(const machine_t *);
/* VLSI Wildcat */
extern int machine_at_zeoswildcat_init(const machine_t *);
/* m_at_socket7.c */
/* i430HX */
extern int machine_at_acerm3a_init(const machine_t *);
@@ -1072,7 +1089,10 @@ extern int machine_at_p5a_init(const machine_t *);
extern int machine_at_m579_init(const machine_t *);
extern int machine_at_gwlucas_init(const machine_t *);
extern int machine_at_5aa_init(const machine_t *);
extern int machine_at_5ax_init(const machine_t *);
#ifdef EMU_DEVICE_H
extern const device_t g5x_device;
#endif
extern int machine_at_g5x_init(const machine_t *);
/* VIA MVP3 */
extern int machine_at_ax59pro_init(const machine_t *);
@@ -1117,6 +1137,9 @@ extern int machine_at_p65up5_cpknd_init(const machine_t *);
extern int machine_at_kn97_init(const machine_t *);
/* i440LX */
#ifdef EMU_DEVICE_H
extern const device_t lx6_device;
#endif
extern int machine_at_lx6_init(const machine_t *);
extern int machine_at_optiplexgxa_init(const machine_t *);
extern int machine_at_spitfire_init(const machine_t *);
@@ -1134,7 +1157,10 @@ extern int machine_at_bx6_init(const machine_t *);
extern int machine_at_ax6bc_init(const machine_t *);
extern int machine_at_p2bls_init(const machine_t *);
extern int machine_at_p3bf_init(const machine_t *);
extern int machine_at_686bx_init(const machine_t *);
#ifdef EMU_DEVICE_H
extern const device_t ga686_device;
#endif
extern int machine_at_ga686_init(const machine_t *);
#ifdef EMU_DEVICE_H
extern const device_t ms6119_device;
#endif

View File

@@ -8,7 +8,6 @@
*
* Fast, high-frequency, guest CPU-independent timer for Riva emulation.
*
*
* Authors: Connor Hyde, <mario64crashed@gmail.com> I need a better email address ;^)
*
* Copyright 2024-2025 starfrost

View File

@@ -150,6 +150,7 @@ extern void plat_get_temp_dir(char *outbuf, uint8_t len);
extern void plat_get_vmm_dir(char *outbuf, size_t len);
extern void plat_init_rom_paths(void);
extern int plat_dir_check(char *path);
extern int plat_file_check(const char *path);
extern int plat_dir_create(char *path);
extern void *plat_mmap(size_t size, uint8_t executable);
extern void plat_munmap(void *ptr, size_t size);

View File

@@ -59,7 +59,7 @@ extern void rom_writel(uint32_t addr, uint32_t val, void *priv);
extern void rom_get_full_path(char *dest, const char *fn);
extern FILE *rom_fopen(const char *fn, char *mode);
extern int rom_getfile(char *fn, char *s, int size);
extern int rom_getfile(const char *fn, char *s, int size);
extern int rom_present(const char *fn);
extern int rom_load_linear_oddeven(const char *fn, uint32_t addr, int sz,

View File

@@ -66,10 +66,10 @@ typedef struct ad1848_t {
uint8_t enable : 1;
uint8_t irq : 4;
uint8_t dma : 3;
uint8_t adpcm_ref;
int8_t adpcm_step;
int adpcm_predictor[2];
int16_t adpcm_step_index[2];
int freq;
int adpcm_data;
uint8_t adpcm_data;
int adpcm_pos;
uint8_t dma_ff;

View File

@@ -49,6 +49,9 @@ enum fm_type {
FM_MAX = 26
};
#define FM_TYPE_MASK 255
#define FM_FORCE_48K 256
enum fm_driver {
FM_DRV_NUKED = 0,
FM_DRV_YMFM = 1,
@@ -65,9 +68,11 @@ typedef struct fm_drv_t {
void (*generate)(void *priv, int32_t *data, uint32_t num_samples); /* daughterboard only. */
} fm_drv_t;
extern uint8_t fm_driver_get_ex(int chip_id, fm_drv_t *drv, int is_48k);
extern uint8_t fm_driver_get(int chip_id, fm_drv_t *drv);
extern const fm_drv_t nuked_opl_drv;
extern const fm_drv_t nuked_opl_drv_48k;
extern const fm_drv_t ymfm_drv;
extern const fm_drv_t esfmu_opl_drv;
extern const fm_drv_t ymfm_opl2board_drv;

View File

@@ -147,7 +147,7 @@ struct _opl3_chip {
typedef struct {
opl3_chip opl;
int8_t flags;
int8_t pad;
int8_t is_48k;
uint16_t port;
uint8_t status;
@@ -159,6 +159,8 @@ typedef struct {
int pos;
int32_t buffer[MUSICBUFLEN * 2];
int32_t *(*update)(void *priv);
} nuked_drv_t;
enum {

View File

@@ -103,12 +103,16 @@ extern void sound_card_reset(void);
extern void sound_cd_thread_end(void);
extern void sound_cd_thread_reset(void);
extern void sound_fdd_thread_init(void);
extern void sound_fdd_thread_end(void);
extern void closeal(void);
extern void inital(void);
extern void givealbuffer(const void *buf);
extern void givealbuffer_music(const void *buf);
extern void givealbuffer_wt(const void *buf);
extern void givealbuffer_cd(const void *buf);
extern void givealbuffer_fdd(const void *buf, const uint32_t size);
#define sb_vibra16c_onboard_relocate_base sb_vibra16s_onboard_relocate_base
#define sb_vibra16cl_onboard_relocate_base sb_vibra16s_onboard_relocate_base
@@ -240,6 +244,9 @@ extern const device_t ncr_business_audio_device;
/* Yamaha YMF-7xx */
extern const device_t ymf701_device;
extern const device_t ymf715_onboard_device;
extern const device_t ymf718_device;
extern const device_t ymf719_device;
#ifdef USE_LIBSERIALPORT
/* External Audio device OPL2Board (Host Connected hardware)*/

20
src/include/86box/vfio.h Normal file
View File

@@ -0,0 +1,20 @@
/*
* 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.
*
* This file is part of the 86Box distribution.
*
* Definitions for Virtual Function I/O PCI passthrough.
*
* Authors: RichardG, <richardg867@gmail.com>
*
* Copyright 2021-2025 RichardG.
*/
#if !defined(EMU_VFIO_H) && defined(USE_VFIO)
# define EMU_VFIO_H
extern void vfio_init(void);
#endif