Merge branch 'master' into fullscreenstaticonqt

This commit is contained in:
Miran Grča
2023-11-08 07:08:51 +01:00
committed by GitHub
1296 changed files with 451357 additions and 336123 deletions

View File

@@ -1,193 +1,230 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Main include file for the application.
* Main include file for the application.
*
*
*
* Authors: Miran Grca, <mgrca8@gmail.com>
*f Fred N. van Kempen, <decwiz@yahoo.com>
* Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2016-2020 Miran Grca.
* Copyright 2017-2020 Fred N. van Kempen.
* Copyright 2021 Laci bá'
* Copyright 2016-2020 Miran Grca.
* Copyright 2017-2020 Fred N. van Kempen.
* Copyright 2021 Laci bá'
*/
#ifndef EMU_86BOX_H
# define EMU_86BOX_H
#define EMU_86BOX_H
/* Configuration values. */
#define SERIAL_MAX 4
#define PARALLEL_MAX 4
#define SCREEN_RES_X 640
#define SCREEN_RES_Y 480
#define SERIAL_MAX 4
#define PARALLEL_MAX 4
#define SCREEN_RES_X 640
#define SCREEN_RES_Y 480
/* Filename and pathname info. */
#define CONFIG_FILE "86box.cfg"
#define CONFIG_FILE "86box.cfg"
#define NVR_PATH "nvr"
#define SCREENSHOT_PATH "screenshots"
/* Recently used images */
#define MAX_PREV_IMAGES 4
#define MAX_IMAGE_PATH_LEN 256
/* Default language 0xFFFF = from system, 0x409 = en-US */
#define DEFAULT_LANGUAGE 0x0409
#define POSTCARDS_NUM 4
#define POSTCARD_MASK (POSTCARDS_NUM - 1)
#ifdef MIN
#undef MIN
# undef MIN
#endif
#ifdef MAX
#undef MAX
# undef MAX
#endif
#ifdef ABS
# undef ABS
#endif
#ifdef ABSD
# undef ABSD
#endif
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(x) ((x) > 0 ? (x) : -(x))
#define BCD8(x) ((((x) / 10) << 4) | ((x) % 10))
#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 MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(x) ((x) > 0 ? (x) : -(x))
#define ABSD(x) ((x) > 0.0 ? (x) : -(x))
#define BCD8(x) ((((x) / 10) << 4) | ((x) % 10))
#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))
#if defined(__GNUC__) || defined(__clang__)
# define UNLIKELY(x) __builtin_expect((x), 0)
# define LIKELY(x) __builtin_expect((x), 1)
#else
# define UNLIKELY(x) (x)
# define LIKELY(x) (x)
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* Global variables. */
extern uint32_t lang_sys; /* (-) system language code */
extern uint32_t lang_sys; /* (-) system language code */
extern int dump_on_exit; /* (O) dump regs on exit*/
extern int do_dump_config; /* (O) dump cfg after load */
extern int start_in_fullscreen; /* (O) start in fullscreen */
extern int dump_on_exit; /* (O) dump regs on exit*/
extern int start_in_fullscreen; /* (O) start in fullscreen */
#ifdef _WIN32
extern int force_debug; /* (O) force debug output */
extern int force_debug; /* (O) force debug output */
#endif
#ifdef USE_WX
extern int video_fps; /* (O) render speed in fps */
extern int video_fps; /* (O) render speed in fps */
#endif
extern int settings_only; /* (O) show only the settings dialog */
extern int confirm_exit_cmdl; /* (O) do not ask for confirmation on quit if set to 0 */
extern int settings_only; /* (O) show only the settings dialog */
extern int confirm_exit_cmdl; /* (O) do not ask for confirmation on quit if set to 0 */
#ifdef _WIN32
extern uint64_t unique_id;
extern uint64_t source_hwnd;
extern uint64_t unique_id;
extern uint64_t source_hwnd;
#endif
extern char rom_path[1024]; /* (O) full path to ROMs */
extern char log_path[1024]; /* (O) full path of logfile */
extern char vm_name[1024]; /* (O) display name of the VM */
#ifdef USE_INSTRUMENT
extern uint8_t instru_enabled;
extern uint64_t instru_run_ms;
#endif
extern char rom_path[1024]; /* (O) full path to ROMs */
extern char log_path[1024]; /* (O) full path of logfile */
extern char vm_name[1024]; /* (O) display name of the VM */
#define window_x monitor_settings[0].mon_window_x
#define window_y monitor_settings[0].mon_window_y
#define window_w monitor_settings[0].mon_window_w
#define window_h monitor_settings[0].mon_window_h
extern int window_remember;
extern int vid_resize; /* (C) allow resizing */
extern int invert_display; /* (C) invert the display */
extern int suppress_overscan; /* (C) suppress overscans */
extern uint32_t lang_id; /* (C) language code identifier */
extern char icon_set[256]; /* (C) iconset identifier */
extern int scale; /* (C) screen scale factor */
extern int dpi_scale; /* (C) DPI scaling of the emulated screen */
extern int vid_api; /* (C) video renderer */
extern int vid_cga_contrast; /* (C) video */
extern int video_fullscreen; /* (C) video */
extern int video_fullscreen_first; /* (C) video */
extern int video_fullscreen_scale; /* (C) video */
extern int enable_overscan; /* (C) video */
extern int force_43; /* (C) video */
extern int video_filter_method; /* (C) video */
extern int video_vsync; /* (C) video */
extern int video_framerate; /* (C) video */
extern int gfxcard[2]; /* (C) graphics/video card */
extern char video_shader[512]; /* (C) video */
extern int bugger_enabled; /* (C) enable ISAbugger */
extern int postcard_enabled; /* (C) enable POST card */
extern int isamem_type[]; /* (C) enable ISA mem cards */
extern int isartc_type; /* (C) enable ISA RTC card */
extern int sound_is_float; /* (C) sound uses FP values */
extern int voodoo_enabled; /* (C) video option */
extern int ibm8514_standalone_enabled; /* (C) video option */
extern int xga_standalone_enabled; /* (C) video option */
extern uint32_t mem_size; /* (C) memory size (Installed on system board) */
extern uint32_t isa_mem_size; /* (C) memory size (ISA Memory Cards) */
extern int cpu; /* (C) cpu type */
extern int cpu_use_dynarec; /* (C) cpu uses/needs Dyna */
extern int fpu_type; /* (C) fpu type */
extern int fpu_softfloat; /* (C) fpu uses softfloat */
extern int time_sync; /* (C) enable time sync */
extern int hdd_format_type; /* (C) hard disk file format */
extern int confirm_reset; /* (C) enable reset confirmation */
extern int confirm_exit; /* (C) enable exit confirmation */
extern int confirm_save; /* (C) enable save confirmation */
extern int enable_discord; /* (C) enable Discord integration */
extern int window_w, window_h, /* (C) window size and */
window_x, window_y, /* position info */
window_remember,
vid_resize, /* (C) allow resizing */
invert_display, /* (C) invert the display */
suppress_overscan; /* (C) suppress overscans */
extern uint32_t lang_id; /* (C) language code identifier */
extern char icon_set[256]; /* (C) iconset identifier */
extern int scale; /* (C) screen scale factor */
extern int dpi_scale; /* (C) DPI scaling of the emulated screen */
extern int vid_api; /* (C) video renderer */
extern int vid_cga_contrast, /* (C) video */
video_fullscreen, /* (C) video */
video_fullscreen_first, /* (C) video */
video_fullscreen_scale, /* (C) video */
enable_overscan, /* (C) video */
force_43, /* (C) video */
video_filter_method, /* (C) video */
video_vsync, /* (C) video */
video_framerate, /* (C) video */
gfxcard; /* (C) graphics/video card */
extern char video_shader[512]; /* (C) video */
extern int serial_enabled[], /* (C) enable serial ports */
bugger_enabled, /* (C) enable ISAbugger */
postcard_enabled, /* (C) enable POST card */
isamem_type[], /* (C) enable ISA mem cards */
isartc_type; /* (C) enable ISA RTC card */
extern int sound_is_float, /* (C) sound uses FP values */
GAMEBLASTER, /* (C) sound option */
GUS, GUSMAX, /* (C) sound option */
SSI2001, /* (C) sound option */
voodoo_enabled; /* (C) video option */
extern uint32_t mem_size; /* (C) memory size (Installed on system board) */
extern uint32_t isa_mem_size; /* (C) memory size (ISA Memory Cards) */
extern int cpu, /* (C) cpu type */
cpu_use_dynarec, /* (C) cpu uses/needs Dyna */
fpu_type; /* (C) fpu type */
extern int time_sync; /* (C) enable time sync */
extern int network_type; /* (C) net provider type */
extern int network_card; /* (C) net interface num */
extern char network_host[522]; /* (C) host network intf */
extern int hdd_format_type; /* (C) hard disk file format */
extern int confirm_reset, /* (C) enable reset confirmation */
confirm_exit, /* (C) enable exit confirmation */
confirm_save; /* (C) enable save confirmation */
extern int enable_discord; /* (C) enable Discord integration */
extern int enable_crashdump; /* (C) enable crash dump */
extern int fixed_size_x;
extern int fixed_size_y;
extern int do_auto_pause; /* (C) Auto-pause the emulator on focus loss */
extern int auto_paused;
extern double mouse_sensitivity; /* (C) Mouse sensitivity scale */
#ifdef _Atomic
extern _Atomic double mouse_x_error; /* Mouse error accumulator - Y */
extern _Atomic double mouse_y_error; /* Mouse error accumulator - Y */
#endif
extern int pit_mode; /* (C) force setting PIT mode */
extern int fm_driver; /* (C) select FM sound driver */
extern int is_pentium; /* TODO: Move back to cpu/cpu.h when it's figured out,
how to remove that hack from the ET4000/W32p. */
extern int fixed_size_x, fixed_size_y;
/* Keyboard variables for future key combination redefinition. */
extern uint16_t key_prefix_1_1;
extern uint16_t key_prefix_1_2;
extern uint16_t key_prefix_2_1;
extern uint16_t key_prefix_2_2;
extern uint16_t key_uncapture_1;
extern uint16_t key_uncapture_2;
extern char exe_path[2048]; /* path (dir) of executable */
extern char usr_path[1024]; /* path (dir) of user data */
extern char cfg_path[1024]; /* full path of config file */
extern char exe_path[2048]; /* path (dir) of executable */
extern char usr_path[1024]; /* path (dir) of user data */
extern char cfg_path[1024]; /* full path of config file */
extern int open_dir_usr_path; /* default file open dialog directory of usr_path */
#ifndef USE_NEW_DYNAREC
extern FILE *stdlog; /* file to log output to */
extern FILE *stdlog; /* file to log output to */
#endif
extern int scrnsz_x, /* current screen size, X */
scrnsz_y; /* current screen size, Y */
extern int efscrnsz_y;
extern int config_changed; /* config has changed */
extern int config_changed; /* config has changed */
/* Function prototypes. */
#ifdef HAVE_STDARG_H
extern void pclog_ex(const char *fmt, va_list);
extern void fatal_ex(const char *fmt, va_list);
extern void pclog_ex(const char *fmt, va_list);
extern void fatal_ex(const char *fmt, va_list);
#endif
extern void pclog_toggle_suppr(void);
extern void pclog(const char *fmt, ...);
extern void fatal(const char *fmt, ...);
extern void set_screen_size(int x, int y);
extern void reset_screen_size(void);
extern void set_screen_size_natural(void);
extern void update_mouse_msg();
extern void pclog_toggle_suppr(void);
extern void pclog(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
extern void fatal(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
extern void set_screen_size(int x, int y);
extern void set_screen_size_monitor(int x, int y, int monitor_index);
extern void reset_screen_size(void);
extern void reset_screen_size_monitor(int monitor_index);
extern void set_screen_size_natural(void);
extern void update_mouse_msg(void);
#if 0
extern void pc_reload(wchar_t *fn);
extern void pc_reload(wchar_t *fn);
#endif
extern int pc_init_modules(void);
extern int pc_init(int argc, char *argv[]);
extern void pc_close(void *threadid);
extern void pc_reset_hard_close(void);
extern void pc_reset_hard_init(void);
extern void pc_reset_hard(void);
extern void pc_full_speed(void);
extern void pc_speed_changed(void);
extern void pc_send_cad(void);
extern void pc_send_cae(void);
extern void pc_send_cab(void);
extern void pc_run(void);
extern void pc_start(void);
extern void pc_onesec(void);
extern int pc_init_modules(void);
extern int pc_init(int argc, char *argv[]);
extern void pc_close(void *threadid);
extern void pc_reset_hard_close(void);
extern void pc_reset_hard_init(void);
extern void pc_reset_hard(void);
extern void pc_full_speed(void);
extern void pc_speed_changed(void);
extern void pc_send_cad(void);
extern void pc_send_cae(void);
extern void pc_send_cab(void);
extern void pc_run(void);
extern void pc_start(void);
extern void pc_onesec(void);
extern uint16_t get_last_addr(void);
extern uint16_t get_last_addr(void);
/* This is for external subtraction of cycles;
should be in cpu.c but I put it here to avoid
having to include cpu.c everywhere. */
extern void sub_cycles(int c);
extern void resub_cycles(int old_cycles);
having to include cpu.h everywhere. */
extern void sub_cycles(int c);
extern void resub_cycles(int old_cycles);
extern double isa_timing;
extern int io_delay, framecountx;
extern void ack_pause(void);
extern void do_pause(int p);
extern volatile int cpu_thread_run;
extern double isa_timing;
extern int io_delay;
extern int framecountx;
extern volatile int cpu_thread_run;
extern uint8_t postcard_codes[POSTCARDS_NUM];
#ifdef __cplusplus
}
#endif
#endif /*EMU_86BOX_H*/
#endif /*EMU_86BOX_H*/

View File

@@ -1,139 +1,171 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Definitions for the ACPI emulation.
* Definitions for the ACPI emulation.
*
*
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Authors: Miran Grca, <mgrca8@gmail.com>
*
* Copyright 2020 Miran Grca.
* Copyright 2020 Miran Grca.
*/
#ifndef ACPI_H
# define ACPI_H
#define ACPI_H
#ifdef __cplusplus
#include <atomic>
using atomic_int = std::atomic_int;
extern "C" {
#else
#include <stdatomic.h>
#endif
#define ACPI_TIMER_FREQ 3579545
#define PM_FREQ ACPI_TIMER_FREQ
#define ACPI_TIMER_FREQ 3579545
#define PM_FREQ ACPI_TIMER_FREQ
#define RSM_STS (1 << 15)
#define PWRBTN_STS (1 << 8)
#define GBL_STS (1 << 5)
#define BM_STS (1 << 4)
#define TMROF_STS (1 << 0)
#define RSM_STS (1 << 15)
#define PWRBTN_STS (1 << 8)
#define GBL_STS (1 << 5)
#define BM_STS (1 << 4)
#define TMROF_STS (1 << 0)
#define RTC_EN (1 << 10)
#define PWRBTN_EN (1 << 8)
#define GBL_EN (1 << 5)
#define TMROF_EN (1 << 0)
#define RTC_EN (1 << 10)
#define PWRBTN_EN (1 << 8)
#define GBL_EN (1 << 5)
#define TMROF_EN (1 << 0)
#define SCI_EN (1 << 0)
#define SUS_EN (1 << 13)
#define SCI_EN (1 << 0)
#define SUS_EN (1 << 13)
#define SUS_POWER_OFF (1 << 0)
#define SUS_SUSPEND (1 << 1)
#define SUS_NVR (1 << 2)
#define SUS_RESET_CPU (1 << 3)
#define SUS_RESET_CACHE (1 << 4)
#define SUS_RESET_PCI (1 << 5)
#define SUS_POWER_OFF (1 << 0)
#define SUS_SUSPEND (1 << 1)
#define SUS_NVR (1 << 2)
#define SUS_RESET_CPU (1 << 3)
#define SUS_RESET_CACHE (1 << 4)
#define SUS_RESET_PCI (1 << 5)
#define ACPI_ENABLE 0xf1
#define ACPI_DISABLE 0xf0
#define ACPI_ENABLE 0xf1
#define ACPI_DISABLE 0xf0
#define VEN_ALI 0x010b9
#define VEN_INTEL 0x08086
#define VEN_SIS 0x01039
#define VEN_SMC 0x01055
#define VEN_VIA 0x01106
#define VEN_VIA_596B 0x11106
#define VEN_ALI 0x010b9
#define VEN_INTEL 0x08086
#define VEN_SIS 0x01039
#define VEN_SMC 0x01055
#define VEN_VIA 0x01106
#define VEN_VIA_596B 0x11106
typedef struct
{
uint8_t acpitst, auxen, auxsts, plvl2, plvl3,
smicmd, gpio_dir,
gpio_val, muxcntrl, ali_soft_smi,
timer32, smireg,
gpireg[3], gporeg[4],
extiotrapsts, extiotrapen;
uint16_t pmsts, pmen,
pmcntrl, gpsts, gpsts1,
gpen, gpen1, gpscien,
gpcntrl, gplvl, gpmux,
gpsel, gpsmien, pscntrl,
gpscists;
int smi_lock, smi_active;
uint32_t pcntrl, p2cntrl, glbsts,
devsts, glben,
glbctl, devctl,
padsts, paden,
gptren, gptimer, timer_val,
gpo_val, gpi_val,
extsmi_val, pad0;
uint64_t tmr_overflow_time;
typedef struct acpi_regs_t {
uint8_t acpitst;
uint8_t auxen;
uint8_t auxsts;
uint8_t plvl2;
uint8_t plvl3;
uint8_t smicmd;
uint8_t gpio_dir;
uint8_t gpio_val;
uint8_t muxcntrl;
uint8_t ali_soft_smi;
uint8_t timer32;
uint8_t smireg;
uint8_t gpireg[3];
uint8_t gporeg[4];
uint8_t extiotrapsts;
uint8_t extiotrapen;
uint16_t pmsts;
uint16_t pmen;
uint16_t pmcntrl;
uint16_t gpsts;
uint16_t gpsts1;
uint16_t gpen;
uint16_t gpen1;
uint16_t gpscien;
uint16_t gpcntrl;
uint16_t gplvl;
uint16_t gpmux;
uint16_t gpsel;
uint16_t gpsmien;
uint16_t pscntrl;
uint16_t gpscists;
int smi_lock;
int smi_active;
uint32_t pcntrl;
uint32_t p2cntrl;
uint32_t glbsts;
uint32_t devsts;
uint32_t glben;
uint32_t glbctl;
uint32_t devctl;
uint32_t padsts;
uint32_t paden;
uint32_t gptren;
uint32_t gptimer;
uint32_t gpo_val;
uint32_t gpi_val;
uint32_t extsmi_val;
uint32_t pad0;
} acpi_regs_t;
typedef struct
{
acpi_regs_t regs;
uint8_t gpireg2_default, pad[3],
gporeg_default[4],
suspend_types[8];
uint16_t io_base, aux_io_base;
int vendor,
slot, irq_mode,
irq_pin, irq_line,
mirq_is_level;
pc_timer_t timer, resume_timer;
nvr_t *nvr;
apm_t *apm;
void *i2c,
(*trap_update)(void *priv), *trap_priv;
typedef struct acpi_t {
acpi_regs_t regs;
uint8_t gpireg2_default;
uint8_t irq_state;
uint8_t pad[2];
uint8_t gporeg_default[4];
uint8_t suspend_types[8];
uint16_t io_base;
uint16_t aux_io_base;
int vendor;
int slot;
int irq_mode;
int irq_pin;
int irq_line;
int mirq_is_level;
pc_timer_t timer;
pc_timer_t resume_timer;
pc_timer_t pwrbtn_timer;
nvr_t *nvr;
apm_t *apm;
void *i2c;
void (*trap_update)(void *priv);
void *trap_priv;
} acpi_t;
/* Global variables. */
extern int acpi_rtc_status;
extern const device_t acpi_ali_device;
extern const device_t acpi_intel_device;
extern const device_t acpi_sis_device;
extern const device_t acpi_smc_device;
extern const device_t acpi_via_device;
extern const device_t acpi_via_596b_device;
extern int acpi_rtc_status;
extern atomic_int acpi_pwrbut_pressed;
extern int acpi_enabled;
extern const device_t acpi_ali_device;
extern const device_t acpi_intel_device;
extern const device_t acpi_smc_device;
extern const device_t acpi_via_device;
extern const device_t acpi_via_596b_device;
/* Functions */
extern void acpi_update_irq(acpi_t *dev);
extern void acpi_raise_smi(void *priv, int do_smi);
extern void acpi_update_io_mapping(acpi_t *dev, uint32_t base, int chipset_en);
extern void acpi_update_aux_io_mapping(acpi_t *dev, uint32_t base, int chipset_en);
extern void acpi_init_gporeg(acpi_t *dev, uint8_t val0, uint8_t val1, uint8_t val2, uint8_t val3);
extern void acpi_set_timer32(acpi_t *dev, uint8_t timer32);
extern void acpi_set_slot(acpi_t *dev, int slot);
extern void acpi_set_irq_mode(acpi_t *dev, int irq_mode);
extern void acpi_set_irq_pin(acpi_t *dev, int irq_pin);
extern void acpi_set_irq_line(acpi_t *dev, int irq_line);
extern void acpi_set_mirq_is_level(acpi_t *dev, int mirq_is_level);
extern void acpi_set_gpireg2_default(acpi_t *dev, uint8_t gpireg2_default);
extern void acpi_set_nvr(acpi_t *dev, nvr_t *nvr);
extern void acpi_set_trap_update(acpi_t *dev, void (*update)(void *priv), void *priv);
extern uint8_t acpi_ali_soft_smi_status_read(acpi_t *dev);
extern void acpi_ali_soft_smi_status_write(acpi_t *dev, uint8_t soft_smi);
extern void acpi_update_irq(acpi_t *dev);
extern void acpi_raise_smi(void *priv, int do_smi);
extern void acpi_update_io_mapping(acpi_t *dev, uint32_t base, int chipset_en);
extern void acpi_update_aux_io_mapping(acpi_t *dev, uint32_t base, int chipset_en);
extern void acpi_init_gporeg(acpi_t *dev, uint8_t val0, uint8_t val1, uint8_t val2, uint8_t val3);
extern void acpi_set_timer32(acpi_t *dev, uint8_t timer32);
extern void acpi_set_slot(acpi_t *dev, int slot);
extern void acpi_set_irq_mode(acpi_t *dev, int irq_mode);
extern void acpi_set_irq_pin(acpi_t *dev, int irq_pin);
extern void acpi_set_irq_line(acpi_t *dev, int irq_line);
extern void acpi_set_mirq_is_level(acpi_t *dev, int mirq_is_level);
extern void acpi_set_gpireg2_default(acpi_t *dev, uint8_t gpireg2_default);
extern void acpi_set_nvr(acpi_t *dev, nvr_t *nvr);
extern void acpi_set_trap_update(acpi_t *dev, void (*update)(void *priv), void *priv);
extern uint8_t acpi_ali_soft_smi_status_read(acpi_t *dev);
extern void acpi_ali_soft_smi_status_write(acpi_t *dev, uint8_t soft_smi);
#ifdef __cplusplus
}
#endif
#endif /*ACPI_H*/
#endif /*ACPI_H*/

View File

@@ -0,0 +1,38 @@
/*
* 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.
*
* AGP Graphics Address Remapping Table remapping emulation.
*
*
*
* Authors: RichardG, <richardg867@gmail.com>
*
* Copyright 2021 RichardG.
*/
#ifndef EMU_AGPGART_H
#define EMU_AGPGART_H
typedef struct agpgart_s {
int aperture_enable;
uint32_t aperture_base;
uint32_t aperture_size;
uint32_t aperture_mask;
uint32_t gart_base;
mem_mapping_t aperture_mapping;
} agpgart_t;
extern void agpgart_set_aperture(agpgart_t *dev, uint32_t base, uint32_t size, int enable);
extern void agpgart_set_gart(agpgart_t *dev, uint32_t base);
#ifdef EMU_DEVICE_H
/* AGP GART */
extern const device_t agpgart_device;
#endif
#endif /*EMU_AGPGART_H*/

View File

@@ -1,47 +1,43 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Definitions for the Advanced Power Management emulation.
* Definitions for the Advanced Power Management emulation.
*
*
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Authors: Miran Grca, <mgrca8@gmail.com>
*
* Copyright 2019 Miran Grca.
* Copyright 2019 Miran Grca.
*/
#ifndef APM_H
# define APM_H
#define APM_H
#ifdef __cplusplus
extern "C" {
#endif
typedef struct
{
uint8_t cmd,
stat, do_smi;
typedef struct apm_t {
uint8_t cmd;
uint8_t stat;
uint8_t do_smi;
} apm_t;
/* Global variables. */
extern const device_t apm_device;
extern const device_t apm_pci_device;
extern const device_t apm_pci_acpi_device;
extern const device_t apm_device;
extern const device_t apm_pci_device;
extern const device_t apm_pci_acpi_device;
/* Functions. */
extern void apm_set_do_smi(apm_t *dev, uint8_t do_smi);
extern void apm_set_do_smi(apm_t *dev, uint8_t do_smi);
#ifdef __cplusplus
}
#endif
#endif /*APM_H*/
#endif /*APM_H*/

View File

@@ -1,20 +1,20 @@
/*
* VARCem Virtual ARchaeological Computer EMulator.
* An emulator of (mostly) x86-based PC systems and devices,
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
* spanning the era between 1981 and 1995.
* 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 VARCem Project.
* This file is part of the 86Box distribution.
*
* Various definitions for portable byte-swapping.
* Various definitions for portable byte-swapping.
*
*
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* neozeed,
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* neozeed,
*
* Copyright 2017,2018 Fred N. van Kempen.
* Copyright 2016-2018 neozeed.
* Copyright 2017-2018 Fred N. van Kempen.
* Copyright 2016-2018 neozeed.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -34,116 +34,158 @@
* Boston, MA 02111-1307
* USA.
*/
#ifndef BSWAP_H
#define BSWAP_H
#include <stdint.h>
#ifdef HAVE_BYTESWAP_H
#include <byteswap.h>
# include <byteswap.h>
#else
# define bswap_16(x) \
( \
((uint16_t)( \
(((uint16_t)(x) & (uint16_t)0x00ffU) << 8) | \
(((uint16_t)(x) & (uint16_t)0xff00U) >> 8) )) \
)
( \
((uint16_t)( \
(((uint16_t)(x) & (uint16_t)0x00ffU) << 8) | \
(((uint16_t)(x) & (uint16_t)0xff00U) >> 8) )) \
)
# define bswap_32(x) \
( \
((uint32_t)( \
(((uint32_t)(x) & (uint32_t)0x000000ffUL) << 24) | \
(((uint32_t)(x) & (uint32_t)0x0000ff00UL) << 8) | \
(((uint32_t)(x) & (uint32_t)0x00ff0000UL) >> 8) | \
(((uint32_t)(x) & (uint32_t)0xff000000UL) >> 24) )) \
)
( \
((uint32_t)( \
(((uint32_t)(x) & (uint32_t)0x000000ffUL) << 24) | \
(((uint32_t)(x) & (uint32_t)0x0000ff00UL) << 8) | \
(((uint32_t)(x) & (uint32_t)0x00ff0000UL) >> 8) | \
(((uint32_t)(x) & (uint32_t)0xff000000UL) >> 24) )) \
)
# define bswap_64(x) \
( \
((uint64_t)( \
(uint64_t)(((uint64_t)(x) & (uint64_t)0x00000000000000ffULL) << 56) | \
(uint64_t)(((uint64_t)(x) & (uint64_t)0x000000000000ff00ULL) << 40) | \
(uint64_t)(((uint64_t)(x) & (uint64_t)0x0000000000ff0000ULL) << 24) | \
(uint64_t)(((uint64_t)(x) & (uint64_t)0x00000000ff000000ULL) << 8) | \
(uint64_t)(((uint64_t)(x) & (uint64_t)0x000000ff00000000ULL) >> 8) | \
(uint64_t)(((uint64_t)(x) & (uint64_t)0x0000ff0000000000ULL) >> 24) | \
(uint64_t)(((uint64_t)(x) & (uint64_t)0x00ff000000000000ULL) >> 40) | \
(uint64_t)(((uint64_t)(x) & (uint64_t)0xff00000000000000ULL) >> 56) )) \
)
#endif /*HAVE_BYTESWAP_H*/
( \
((uint64_t)( \
(uint64_t)(((uint64_t)(x) & (uint64_t)0x00000000000000ffULL) << 56) | \
(uint64_t)(((uint64_t)(x) & (uint64_t)0x000000000000ff00ULL) << 40) | \
(uint64_t)(((uint64_t)(x) & (uint64_t)0x0000000000ff0000ULL) << 24) | \
(uint64_t)(((uint64_t)(x) & (uint64_t)0x00000000ff000000ULL) << 8) | \
(uint64_t)(((uint64_t)(x) & (uint64_t)0x000000ff00000000ULL) >> 8) | \
(uint64_t)(((uint64_t)(x) & (uint64_t)0x0000ff0000000000ULL) >> 24) | \
(uint64_t)(((uint64_t)(x) & (uint64_t)0x00ff000000000000ULL) >> 40) | \
(uint64_t)(((uint64_t)(x) & (uint64_t)0xff00000000000000ULL) >> 56) )) \
)
#endif /*HAVE_BYTESWAP_H*/
#if __GNUC__ >= 10
#if defined __has_builtin && __has_builtin(__builtin_bswap16)
#define bswap16(x) __builtin_bswap16(x)
#else
static __inline uint16_t bswap16(uint16_t x)
{
return bswap_16(x);
}
# endif
#else
static __inline uint16_t
bswap16(uint16_t x)
{
return bswap_16(x);
}
#endif
static __inline uint32_t bswap32(uint32_t x)
#if __GNUC__ >= 10
# if defined __has_builtin && __has_builtin(__builtin_bswap32)
# define bswap32(x) __builtin_bswap32(x)
# else
static __inline uint32_t
bswap32(uint32_t x)
{
return bswap_32(x);
}
# endif
#else
static __inline uint32_t
bswap32(uint32_t x)
{
return bswap_32(x);
}
#endif
static __inline uint64_t bswap64(uint64_t x)
#if __GNUC__ >= 10
# if defined __has_builtin && __has_builtin(__builtin_bswap64)
# define bswap64(x) __builtin_bswap64(x)
# else
static __inline uint64_t
bswap64(uint64_t x)
{
return bswap_64(x);
}
# endif
#else
static __inline uint64_t
bswap64(uint64_t x)
{
return bswap_64(x);
}
#endif
static __inline void bswap16s(uint16_t *s)
static __inline void
bswap16s(uint16_t *s)
{
*s = bswap16(*s);
}
static __inline void bswap32s(uint32_t *s)
static __inline void
bswap32s(uint32_t *s)
{
*s = bswap32(*s);
}
static __inline void bswap64s(uint64_t *s)
static __inline void
bswap64s(uint64_t *s)
{
*s = bswap64(*s);
}
#if defined(WORDS_BIGENDIAN)
# define be_bswap(v, size) (v)
# define le_bswap(v, size) bswap ## size(v)
# define be_bswaps(v, size)
# define le_bswaps(p, size) *p = bswap ## size(*p);
# define be_bswap(v, size) (v)
# define le_bswap(v, size) bswap##size(v)
# define be_bswaps(v, size)
# define le_bswaps(p, size) *p = bswap##size(*p);
#else
# define le_bswap(v, size) (v)
# define be_bswap(v, size) bswap ## size(v)
# define le_bswaps(v, size)
# define be_bswaps(p, size) *p = bswap ## size(*p);
# define le_bswap(v, size) (v)
# define be_bswap(v, size) bswap##size(v)
# define le_bswaps(v, size)
# define be_bswaps(p, size) *p = bswap##size(*p);
#endif
#define CPU_CONVERT(endian, size, type)\
static __inline type endian ## size ## _to_cpu(type v)\
{\
return endian ## _bswap(v, size);\
}\
\
static __inline type cpu_to_ ## endian ## size(type v)\
{\
return endian ## _bswap(v, size);\
}\
\
static __inline void endian ## size ## _to_cpus(type *p)\
{\
endian ## _bswaps(p, size)\
}\
\
static __inline void cpu_to_ ## endian ## size ## s(type *p)\
{\
endian ## _bswaps(p, size)\
}\
\
static __inline type endian ## size ## _to_cpup(const type *p)\
{\
return endian ## size ## _to_cpu(*p);\
}\
\
static __inline void cpu_to_ ## endian ## size ## w(type *p, type v)\
{\
*p = cpu_to_ ## endian ## size(v);\
}
#define CPU_CONVERT(endian, size, type) \
static __inline type endian##size##_to_cpu(type v) \
{ \
return endian##_bswap(v, size); \
} \
\
static __inline type cpu_to_##endian##size(type v) \
{ \
return endian##_bswap(v, size); \
} \
\
static __inline void endian##size##_to_cpus(type *p) \
{ \
endian##_bswaps(p, size) \
} \
\
static __inline void cpu_to_##endian##size##s(type *p) \
{ \
endian##_bswaps(p, size) \
} \
\
static __inline type endian##size##_to_cpup(const type *p) \
{ \
return endian##size##_to_cpu(*p); \
} \
\
static __inline void cpu_to_##endian##size##w(type *p, type v) \
{ \
*p = cpu_to_##endian##size(v); \
}
CPU_CONVERT(be, 16, uint16_t)
CPU_CONVERT(be, 32, uint32_t)
@@ -157,27 +199,29 @@ CPU_CONVERT(le, 64, uint64_t)
#if defined(__i386__) || defined(__powerpc__)
#define cpu_to_le16wu(p, v) cpu_to_le16w(p, v)
#define cpu_to_le32wu(p, v) cpu_to_le32w(p, v)
#define le16_to_cpupu(p) le16_to_cpup(p)
#define le32_to_cpupu(p) le32_to_cpup(p)
# define cpu_to_le16wu(p, v) cpu_to_le16w(p, v)
# define cpu_to_le32wu(p, v) cpu_to_le32w(p, v)
# define le16_to_cpupu(p) le16_to_cpup(p)
# define le32_to_cpupu(p) le32_to_cpup(p)
#define cpu_to_be16wu(p, v) cpu_to_be16w(p, v)
#define cpu_to_be32wu(p, v) cpu_to_be32w(p, v)
# define cpu_to_be16wu(p, v) cpu_to_be16w(p, v)
# define cpu_to_be32wu(p, v) cpu_to_be32w(p, v)
#else
static __inline void cpu_to_le16wu(uint16_t *p, uint16_t v)
static __inline void
cpu_to_le16wu(uint16_t *p, uint16_t v)
{
uint8_t *p1 = (uint8_t *)p;
uint8_t *p1 = (uint8_t *) p;
p1[0] = v & 0xff;
p1[1] = v >> 8;
}
static __inline void cpu_to_le32wu(uint32_t *p, uint32_t v)
static __inline void
cpu_to_le32wu(uint32_t *p, uint32_t v)
{
uint8_t *p1 = (uint8_t *)p;
uint8_t *p1 = (uint8_t *) p;
p1[0] = v;
p1[1] = v >> 8;
@@ -185,29 +229,33 @@ static __inline void cpu_to_le32wu(uint32_t *p, uint32_t v)
p1[3] = v >> 24;
}
static __inline uint16_t le16_to_cpupu(const uint16_t *p)
static __inline uint16_t
le16_to_cpupu(const uint16_t *p)
{
const uint8_t *p1 = (const uint8_t *)p;
const uint8_t *p1 = (const uint8_t *) p;
return p1[0] | (p1[1] << 8);
}
static __inline uint32_t le32_to_cpupu(const uint32_t *p)
static __inline uint32_t
le32_to_cpupu(const uint32_t *p)
{
const uint8_t *p1 = (const uint8_t *)p;
const uint8_t *p1 = (const uint8_t *) p;
return p1[0] | (p1[1] << 8) | (p1[2] << 16) | (p1[3] << 24);
}
static __inline void cpu_to_be16wu(uint16_t *p, uint16_t v)
static __inline void
cpu_to_be16wu(uint16_t *p, uint16_t v)
{
uint8_t *p1 = (uint8_t *)p;
uint8_t *p1 = (uint8_t *) p;
p1[0] = v >> 8;
p1[1] = v & 0xff;
}
static __inline void cpu_to_be32wu(uint32_t *p, uint32_t v)
static __inline void
cpu_to_be32wu(uint32_t *p, uint32_t v)
{
uint8_t *p1 = (uint8_t *)p;
uint8_t *p1 = (uint8_t *) p;
p1[0] = v >> 24;
p1[1] = v >> 16;
@@ -218,9 +266,9 @@ static __inline void cpu_to_be32wu(uint32_t *p, uint32_t v)
#endif
#ifdef WORDS_BIGENDIAN
#define cpu_to_32wu cpu_to_be32wu
# define cpu_to_32wu cpu_to_be32wu
#else
#define cpu_to_32wu cpu_to_le32wu
# define cpu_to_32wu cpu_to_le32wu
#endif
#undef le_bswap
@@ -228,4 +276,4 @@ static __inline void cpu_to_be32wu(uint32_t *p, uint32_t v)
#undef le_bswaps
#undef be_bswaps
#endif /* BSWAP_H */
#endif /*BSWAP_H*/

View File

@@ -1,34 +1,32 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Implementation of the ISA Bus (de)Bugger expansion card
* sold as a DIY kit in the late 1980's in The Netherlands.
* This card was a assemble-yourself 8bit ISA addon card for
* PC and AT systems that had several tools to aid in low-
* level debugging (mostly for faulty BIOSes, bootloaders
* and system kernels...)
* Implementation of the ISA Bus (de)Bugger expansion card
* sold as a DIY kit in the late 1980's in The Netherlands.
* This card was a assemble-yourself 8bit ISA addon card for
* PC and AT systems that had several tools to aid in low-
* level debugging (mostly for faulty BIOSes, bootloaders
* and system kernels...)
*
* Definitions for the BUGGER card.
* Definitions for the BUGGER card.
*
*
*
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 1989-2018 Fred N. van Kempen.
* Copyright 1989-2018 Fred N. van Kempen.
*/
#ifndef BUGGER_H
# define BUGGER_H
#define BUGGER_H
/* I/O port range used. */
#define BUGGER_ADDR 0x007a
#define BUGGER_ADDRLEN 4
#define BUGGER_ADDR 0x007a
#define BUGGER_ADDRLEN 4
#ifdef __cplusplus
extern "C" {
@@ -37,12 +35,10 @@ extern "C" {
/* Global variables. */
extern const device_t bugger_device;
/* Functions. */
#ifdef __cplusplus
}
#endif
#endif /*BUGGER_H*/
#endif /*BUGGER_H*/

View File

@@ -1,40 +1,35 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Definitions for the PCjr cartridge emulation.
* Definitions for the PCjr cartridge emulation.
*
*
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Authors: Miran Grca, <mgrca8@gmail.com>
*
* Copyright 2021 Miran Grca.
* Copyright 2021 Miran Grca.
*/
#ifndef EMU_CARTRIDGE_H
# define EMU_CARTRIDGE_H
#define EMU_CARTRIDGE_H
#ifdef __cplusplus
extern "C" {
#endif
extern char cart_fns[2][512];
extern char cart_fns[2][512];
extern void cart_load(int drive, char *fn);
extern void cart_close(int drive);
extern void cart_reset(void);
extern void cart_load(int drive, char *fn);
extern void cart_close(int drive);
extern void cart_reset(void);
#ifdef __cplusplus
}
#endif
#endif /*EMU_CARTRIDGE_H*/
#endif /*EMU_CARTRIDGE_H*/

View File

@@ -19,155 +19,151 @@
* Public License for more details. *
*****************************************************************************/
#ifndef PCE_IBMPC_CASSETTE_H
#define PCE_IBMPC_CASSETTE_H 1
#include <stdio.h>
typedef struct pc_cassette_t {
char save;
char pcm;
typedef struct {
char save;
char pcm;
unsigned char motor;
unsigned char motor;
unsigned long position;
unsigned long position;
unsigned long position_save;
unsigned long position_load;
unsigned long position_save;
unsigned long position_load;
unsigned char data_out;
unsigned char data_inp;
unsigned char data_out;
unsigned char data_inp;
int pcm_out_vol;
int pcm_out_val;
int pcm_out_vol;
int pcm_out_val;
unsigned cas_out_cnt;
unsigned char cas_out_buf;
unsigned cas_out_cnt;
unsigned char cas_out_buf;
unsigned cas_inp_cnt;
unsigned char cas_inp_buf;
unsigned char cas_inp_bit;
unsigned cas_inp_cnt;
unsigned char cas_inp_buf;
unsigned char cas_inp_bit;
int pcm_inp_fir[3];
int pcm_inp_fir[3];
unsigned long clk;
unsigned long clk;
unsigned long clk_pcm;
unsigned long clk_pcm;
unsigned long clk_out;
unsigned long clk_inp;
unsigned long clk_out;
unsigned long clk_inp;
unsigned long srate;
unsigned long srate;
char close;
char *fname;
FILE *fp;
pc_timer_t timer;
char close;
char *fname;
FILE *fp;
pc_timer_t timer;
} pc_cassette_t;
void pc_cas_init(pc_cassette_t *cas);
void pc_cas_free(pc_cassette_t *cas);
void pc_cas_init (pc_cassette_t *cas);
void pc_cas_free (pc_cassette_t *cas);
pc_cassette_t *pc_cas_new (void);
void pc_cas_del (pc_cassette_t *cas);
pc_cassette_t *pc_cas_new(void);
void pc_cas_del(pc_cassette_t *cas);
/*!***************************************************************************
* @short Set the cassette file
* @return True on error, false otherwise
*****************************************************************************/
int pc_cas_set_fname (pc_cassette_t *cas, const char *fname);
int pc_cas_set_fname(pc_cassette_t *cas, const char *fname);
/*!***************************************************************************
* @short Get the cassette mode
* @return True if in save mode, false if in load mode
*****************************************************************************/
int pc_cas_get_mode (const pc_cassette_t *cas);
int pc_cas_get_mode(const pc_cassette_t *cas);
/*!***************************************************************************
* @short Set the cassette mode
* @param save If true set save mode, otherwise set load mode
*****************************************************************************/
void pc_cas_set_mode (pc_cassette_t *cas, int save);
void pc_cas_set_mode(pc_cassette_t *cas, int save);
/*!***************************************************************************
* @short Get the cassette pcm mode
* @return True if in pcm mode, false if in binary mode
*****************************************************************************/
int pc_cas_get_pcm (const pc_cassette_t *cas);
int pc_cas_get_pcm(const pc_cassette_t *cas);
/*!***************************************************************************
* @short Set the cassette pcm mode
* @param pcm If true set pcm mode, otherwise set binary mode
*****************************************************************************/
void pc_cas_set_pcm (pc_cassette_t *cas, int pcm);
void pc_cas_set_pcm(pc_cassette_t *cas, int pcm);
/*!***************************************************************************
* @short Get the pcm sample rate
* @return The sample rate in Hz
*****************************************************************************/
unsigned long pc_cas_get_srate (const pc_cassette_t *cas);
unsigned long pc_cas_get_srate(const pc_cassette_t *cas);
/*!***************************************************************************
* @short Set the pcm sample rate
* @param pcm The sample rate in Hz
*****************************************************************************/
void pc_cas_set_srate (pc_cassette_t *cas, unsigned long srate);
void pc_cas_set_srate(pc_cassette_t *cas, unsigned long srate);
/*!***************************************************************************
* @short Rewind the cassette
*****************************************************************************/
void pc_cas_rewind (pc_cassette_t *cas);
void pc_cas_rewind(pc_cassette_t *cas);
/*!***************************************************************************
* @short Fast forward to the end of the cassette
*****************************************************************************/
void pc_cas_append (pc_cassette_t *cas);
void pc_cas_append(pc_cassette_t *cas);
/*!***************************************************************************
* @short Get the current load/save position
*****************************************************************************/
unsigned long pc_cas_get_position (const pc_cassette_t *cas);
unsigned long pc_cas_get_position(const pc_cassette_t *cas);
/*!***************************************************************************
* @short Set the current load/save position
*****************************************************************************/
int pc_cas_set_position (pc_cassette_t *cas, unsigned long pos);
int pc_cas_set_position(pc_cassette_t *cas, unsigned long pos);
/*!***************************************************************************
* @short Set the cassette motor status
*****************************************************************************/
void pc_cas_set_motor (pc_cassette_t *cas, unsigned char val);
void pc_cas_set_motor(pc_cassette_t *cas, unsigned char val);
/*!***************************************************************************
* @short Get the current input from the cassette
*****************************************************************************/
unsigned char pc_cas_get_inp (const pc_cassette_t *cas);
unsigned char pc_cas_get_inp(const pc_cassette_t *cas);
/*!***************************************************************************
* @short Set the current output to the cassette
*****************************************************************************/
void pc_cas_set_out (pc_cassette_t *cas, unsigned char val);
void pc_cas_set_out(pc_cassette_t *cas, unsigned char val);
void pc_cas_print_state (const pc_cassette_t *cas);
void pc_cas_print_state(const pc_cassette_t *cas);
void pc_cas_clock (pc_cassette_t *cas, unsigned long cnt);
void pc_cas_advance (pc_cassette_t *cas);
void pc_cas_clock(pc_cassette_t *cas, unsigned long cnt);
void pc_cas_advance(pc_cassette_t *cas);
extern pc_cassette_t *cassette;
extern pc_cassette_t * cassette;
extern char cassette_fname[512];
extern char cassette_mode[512];
extern unsigned long cassette_pos;
extern unsigned long cassette_srate;
extern int cassette_enable;
extern int cassette_append;
extern int cassette_pcm;
extern int cassette_ui_writeprot;
extern char cassette_fname[512];
extern char cassette_mode[512];
extern unsigned long cassette_pos, cassette_srate;
extern int cassette_enable;
extern int cassette_append, cassette_pcm;
extern int cassette_ui_writeprot;
extern const device_t cassette_device;
extern const device_t cassette_device;
#endif
#endif /*PCE_IBMPC_CASSETTE_H*/

View File

@@ -1,182 +1,328 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Generic CD-ROM drive core header.
* Generic CD-ROM drive core header.
*
* Authors: Miran Grca, <mgrca8@gmail.com>
*
*
* Author: Miran Grca, <mgrca8@gmail.com>
*
* Copyright 2016-2019 Miran Grca.
* Copyright 2016-2019 Miran Grca.
*/
#ifndef EMU_CDROM_H
#define EMU_CDROM_H
#define CDROM_NUM 8
#define CDROM_NUM 4
#define CD_STATUS_EMPTY 0
#define CD_STATUS_DATA_ONLY 1
#define CD_STATUS_PAUSED 2
#define CD_STATUS_PLAYING 3
#define CD_STATUS_STOPPED 4
#define CD_STATUS_PLAYING_COMPLETED 5
#define CD_STATUS_EMPTY 0
#define CD_STATUS_DATA_ONLY 1
#define CD_STATUS_PAUSED 2
#define CD_STATUS_PLAYING 3
#define CD_STATUS_STOPPED 4
#define CD_STATUS_PLAYING_COMPLETED 5
/* Medium changed flag. */
#define CD_STATUS_MEDIUM_CHANGED 0x80
#define CD_STATUS_MEDIUM_CHANGED 0x80
#define CD_TRACK_AUDIO 0x08
#define CD_TRACK_MODE2 0x04
#define CD_TRACK_AUDIO 0x08
#define CD_TRACK_MODE2 0x04
#define CD_READ_DATA 0
#define CD_READ_AUDIO 1
#define CD_READ_RAW 2
#define CD_READ_DATA 0
#define CD_READ_AUDIO 1
#define CD_READ_RAW 2
#define CD_TOC_NORMAL 0
#define CD_TOC_SESSION 1
#define CD_TOC_RAW 2
#define CD_TOC_NORMAL 0
#define CD_TOC_SESSION 1
#define CD_TOC_RAW 2
#define BUF_SIZE 32768
#define CD_IMAGE_HISTORY 4
#define CDROM_IMAGE 200
#define BUF_SIZE 32768
#define CDROM_IMAGE 200
/* This is so that if/when this is changed to something else,
changing this one define will be enough. */
#define CDROM_EMPTY !dev->host_drive
#ifdef __cplusplus
extern "C" {
#endif
enum {
CDROM_BUS_DISABLED = 0,
CDROM_BUS_ATAPI = 5,
CDROM_BUS_SCSI,
CDROM_BUS_USB
CDROM_BUS_ATAPI = 5,
CDROM_BUS_SCSI = 6,
CDROM_BUS_MITSUMI = 7,
CDROM_BUS_USB = 8
};
enum
{
CDROM_TYPE_86BOX_100,
CDROM_TYPE_AZT_CDA46802I_115,
CDROM_TYPE_BTC_BCD36XH_U10,
CDROM_TYPE_GOLDSTAR_CRD_8160B_314,
CDROM_TYPE_HITACHI_CDR_8130_0020,
CDROM_TYPE_KENWOOD_UCR_421_208E,
CDROM_TYPE_MATSHITA_587_7S13,
CDROM_TYPE_MATSHITA_588_LS15,
CDROM_TYPE_MATSHITA_571_10e,
CDROM_TYPE_MATSHITA_572_10j,
CDROM_TYPE_MITSUMI_FX4820T_D02A,
CDROM_TYPE_NEC_260_100,
CDROM_TYPE_NEC_260_101,
CDROM_TYPE_NEC_273_420,
CDROM_TYPE_NEC_280_105,
CDROM_TYPE_NEC_280_308,
CDROM_TYPE_PHILIPS_PCA403CD_U31P,
CDROM_TYPE_SONY_CDU76_10i,
CDROM_TYPE_SONY_CDU311_30h,
CDROM_TYPE_TOSHIBA_5302TA_0305,
CDROM_TYPE_TOSHIBA_5702B_TA70,
CDROM_TYPE_CHINON_CDS431_H42,
CDROM_TYPE_DEC_RRD45_0436,
CDROM_TYPE_MATSHITA_501_10b,
CDROM_TYPE_NEC_25_10a,
CDROM_TYPE_NEC_38_103,
CDROM_TYPE_NEC_75_103,
CDROM_TYPE_NEC_77_106,
CDROM_TYPE_NEC_211_100,
CDROM_TYPE_NEC_464_105,
CDROM_TYPE_SONY_CDU541_10i,
CDROM_TYPE_SONY_CDU561_18k,
CDROM_TYPE_SONY_CDU76S_100,
CDROM_TYPE_PHILIPS_CDD2600_107,
CDROM_TYPE_PIONEER_DRM604X_2403,
CDROM_TYPE_PLEXTOR_PX32TS_103,
CDROM_TYPE_TEAC_CD50_100,
CDROM_TYPE_TEAC_R55S_10R,
CDROM_TYPE_TEXEL_DMXX24_100,
CDROM_TYPE_TOSHIBA_XM_3433,
CDROM_TYPE_TOSHIBA_XM3201B_3232,
CDROM_TYPE_TOSHIBA_XM3301TA_0272,
CDROM_TYPE_TOSHIBA_XM5701TA_3136,
CDROM_TYPE_TOSHIBA_SDM1401_1008,
CDROM_TYPES_NUM
};
#define KNOWN_CDROM_DRIVE_TYPES CDROM_TYPES_NUM
#define BUS_TYPE_IDE CDROM_BUS_ATAPI
#define BUS_TYPE_SCSI CDROM_BUS_SCSI
#define BUS_TYPE_BOTH -2
#define BUS_TYPE_NONE -1
static const struct
{
const char vendor[9];
const char model[17];
const char revision[5];
const char *name;
const char *internal_name;
const int bus_type;
} cdrom_drive_types[] = {
{ "86BOX", "CD-ROM", "1.00", "86BOX CD-ROM 1.00", "86BOX_CD-ROM_1.00", BUS_TYPE_BOTH },
{ "AZT", "CDA46802I", "1.15", "AZT CDA46802I 1.15", "AZT_CDA46802I_1.15", BUS_TYPE_IDE },
{ "BTC", "CD-ROM BCD36XH", "U1.0", "BTC CD-ROM BCD36XH U1.0", "BTC_CD-ROM_BCD36XH_U1.0", BUS_TYPE_IDE },
{ "GOLDSTAR", "CRD-8160B", "3.14", "GOLDSTAR CRD-8160B 3.14", "GOLDSTAR_CRD-8160B_3.14", BUS_TYPE_IDE },
{ "HITACHI", "CDR-8130", "0020", "HITACHI CDR-8130 0020", "HITACHI_CDR-8130_0020", BUS_TYPE_IDE },
{ "KENWOOD", "CD-ROM UCR-421", "208E", "KENWOOD CD-ROM UCR-421 208E", "KENWOOD_CD-ROM_UCR-421_208E", BUS_TYPE_IDE },
{ "MATSHITA", "CD-ROM CR-587", "7S13", "MATSHITA CD-ROM CR-587 7S13", "MATSHITA_CD-ROM_CR-587_7S13", BUS_TYPE_IDE },
{ "MATSHITA", "CD-ROM CR-588", "LS15", "MATSHITA CD-ROM CR-588 LS15", "MATSHITA_CD-ROM_CR-588_LS15", BUS_TYPE_IDE },
{ "MATSHITA", "CR-571", "1.0e", "MATSHITA CR-571 1.0e", "MATSHITA_CR-571_1.0e", BUS_TYPE_IDE },
{ "MATSHITA", "CR-572", "1.0j", "MATSHITA CR-572 1.0j", "MATSHITA_CR-572_1.0j", BUS_TYPE_IDE },
{ "MITSUMI", "CRMC-FX4820T", "D02A", "MITSUMI CRMC-FX4820T D02A", "MITSUMI_CRMC-FX4820T_D02A", BUS_TYPE_IDE },
{ "NEC", "CD-ROM DRIVE:260", "1.00", "NEC CD-ROM DRIVE:260 1.00", "NEC_CD-ROM_DRIVE260_1.00", BUS_TYPE_IDE },
{ "NEC", "CD-ROM DRIVE:260", "1.01", "NEC CD-ROM DRIVE:260 1.01", "NEC_CD-ROM_DRIVE260_1.01", BUS_TYPE_IDE },
{ "NEC", "CD-ROM DRIVE:273", "4.20", "NEC CD-ROM DRIVE:273 4.20", "NEC_CD-ROM_DRIVE273_4.20", BUS_TYPE_IDE },
{ "NEC", "CD-ROM DRIVE:280", "1.05", "NEC CD-ROM DRIVE:280 1.05", "NEC_CD-ROM_DRIVE280_1.05", BUS_TYPE_IDE },
{ "NEC", "CD-ROM DRIVE:280", "3.08", "NEC CD-ROM DRIVE:280 3.08", "NEC_CD-ROM_DRIVE280_3.08", BUS_TYPE_IDE },
{ "PHILIPS", "CD-ROM PCA403CD", "U31P", "PHILIPS CD-ROM PCA403CD U31P", "PHILIPS_CD-ROM_PCA403CD_U31P", BUS_TYPE_IDE },
{ "SONY", "CD-ROM CDU76", "1.0i", "SONY CD-ROM CDU76 1.0i", "SONY_CD-ROM_CDU76_1.0i", BUS_TYPE_IDE },
{ "SONY", "CD-ROM CDU311", "3.0h", "SONY CD-ROM CDU311 3.0h", "SONY_CD-ROM_CDU311_3.0h", BUS_TYPE_IDE },
{ "TOSHIBA", "CD-ROM XM-5302TA", "0305", "TOSHIBA CD-ROM XM-5302TA 0305", "TOSHIBA_CD-ROM_XM-5302TA_0305", BUS_TYPE_IDE },
{ "TOSHIBA", "CD-ROM XM-5702B", "TA70", "TOSHIBA CD-ROM XM-5702B TA70", "TOSHIBA_CD-ROM_XM-5702B_TA70", BUS_TYPE_IDE },
{ "CHINON", "CD-ROM CDS-431", "H42 ", "CHINON CD-ROM CDS-431 H42", "CHINON_CD-ROM_CDS-431_H42", BUS_TYPE_SCSI },
{ "DEC", "RRD45 (C) DEC", "0436", "DEC RRD45 0436", "DEC_RRD45_0436", BUS_TYPE_SCSI },
{ "MATSHITA", "CD-ROM CR-501", "1.0b", "MATSHITA CD-ROM CR-501 1.0b", "MATSHITA_CD-ROM_CR-501_1.0b", BUS_TYPE_SCSI },
{ "NEC", "CD-ROM DRIVE:25", "1.0a", "NEC CD-ROM DRIVE:25 1.0a", "NEC_CD-ROM_DRIVE25_1.0a", BUS_TYPE_SCSI },
{ "NEC", "CD-ROM DRIVE:38", "1.00", "NEC CD-ROM DRIVE:38 1.00", "NEC_CD-ROM_DRIVE38_1.00", BUS_TYPE_SCSI },
{ "NEC", "CD-ROM DRIVE:75", "1.03", "NEC CD-ROM DRIVE:75 1.03", "NEC_CD-ROM_DRIVE75_1.03", BUS_TYPE_SCSI },
{ "NEC", "CD-ROM DRIVE:77", "1.06", "NEC CD-ROM DRIVE:77 1.06", "NEC_CD-ROM_DRIVE77_1.06", BUS_TYPE_SCSI },
{ "NEC", "CD-ROM DRIVE:211", "1.00", "NEC CD-ROM DRIVE:211 1.00", "NEC_CD-ROM_DRIVE211_1.00", BUS_TYPE_SCSI },
{ "NEC", "CD-ROM DRIVE:464", "1.05", "NEC CD-ROM DRIVE:464 1.05", "NEC_CD-ROM_DRIVE464_1.05", BUS_TYPE_SCSI },
{ "SONY", "CD-ROM CDU-541", "1.0i", "SONY CD-ROM CDU-541 1.0i", "SONY_CD-ROM_CDU-541_1.0i", BUS_TYPE_SCSI },
{ "SONY", "CD-ROM CDU-561", "1.8k", "SONY CD-ROM CDU-561 1.8k", "SONY_CD-ROM_CDU-561_1.8k", BUS_TYPE_SCSI },
{ "SONY", "CD-ROM CDU-76S", "1.00", "SONY CD-ROM CDU-76S 1.00", "SONY_CD-ROM_CDU-76S_1.00", BUS_TYPE_SCSI },
{ "PHILIPS", "CDD2600", "1.07", "PHILIPS CDD2600 1.07", "PHILIPS_CDD2600_1.07", BUS_TYPE_SCSI },
{ "PIONEER", "CD-ROM DRM-604X", "2403", "PIONEER CD-ROM DRM-604X 2403", "PIONEER_CD-ROM_DRM-604X_2403", BUS_TYPE_SCSI },
{ "PLEXTOR", "CD-ROM PX-32TS", "1.03", "PLEXTOR CD-ROM PX-32TS 1.03", "PLEXTOR_CD-ROM_PX-32TS_1.03", BUS_TYPE_SCSI },
{ "TEAC", "CD 50", "1.00", "TEAC CD 50 1.00", "TEAC_CD_50_1.00", BUS_TYPE_SCSI },
{ "TEAC", "CD-ROM R55S", "1.0R", "TEAC CD-ROM R55S 1.0R", "TEAC_CD-ROM_R55S_1.0R", BUS_TYPE_SCSI },
{ "TEXEL", "CD-ROM DM-XX24", "1.00", "TEXEL CD-ROM DM-XX24 1.00", "TEXEL_CD-ROM_DM-XX24_1.00", BUS_TYPE_SCSI },
{ "TOSHIBA", "CD-ROM DRIVE:XM", "3433", "TOSHIBA CD-ROM DRIVE:XM 3433", "TOSHIBA_CD-ROM_DRIVEXM_3433", BUS_TYPE_SCSI },
{ "TOSHIBA", "CD-ROM XM-3201B", "3232", "TOSHIBA CD-ROM XM-3201B 3232", "TOSHIBA_CD-ROM_XM-3201B_3232", BUS_TYPE_SCSI },
{ "TOSHIBA", "CD-ROM XM-3301TA", "0272", "TOSHIBA CD-ROM XM-3301TA 0272", "TOSHIBA_CD-ROM_XM-3301TA_0272", BUS_TYPE_SCSI },
{ "TOSHIBA", "CD-ROM XM-5701TA", "3136", "TOSHIBA CD-ROM XM-5701TA 3136", "TOSHIBA_CD-ROM_XM-5701TA_3136", BUS_TYPE_SCSI },
{ "TOSHIBA", "DVD-ROM SD-M1401", "1008", "TOSHIBA DVD-ROM SD-M1401 1008", "TOSHIBA_DVD-ROM_SD-M1401_1008", BUS_TYPE_SCSI },
{ "", "", "", "", "", BUS_TYPE_NONE },
};
/* To shut up the GCC compilers. */
struct cdrom;
typedef struct {
uint8_t attr, track,
index,
abs_m, abs_s, abs_f,
rel_m, rel_s, rel_f;
typedef struct subchannel_t {
uint8_t attr;
uint8_t track;
uint8_t index;
uint8_t abs_m;
uint8_t abs_s;
uint8_t abs_f;
uint8_t rel_m;
uint8_t rel_s;
uint8_t rel_f;
} subchannel_t;
typedef struct {
int number;
uint8_t attr, m, s, f;
typedef struct track_info_t {
int number;
uint8_t attr;
uint8_t m;
uint8_t s;
uint8_t f;
} track_info_t;
/* Define the various CD-ROM drive operations (ops). */
typedef struct {
void (*get_tracks)(struct cdrom *dev, int *first, int *last);
void (*get_track_info)(struct cdrom *dev, uint32_t track, int end, track_info_t *ti);
void (*get_subchannel)(struct cdrom *dev, uint32_t lba, subchannel_t *subc);
int (*is_track_pre)(struct cdrom *dev, uint32_t lba);
int (*sector_size)(struct cdrom *dev, uint32_t lba);
int (*read_sector)(struct cdrom *dev, int type, uint8_t *b, uint32_t lba);
int (*track_type)(struct cdrom *dev, uint32_t lba);
void (*exit)(struct cdrom *dev);
typedef struct cdrom_ops_t {
void (*get_tracks)(struct cdrom *dev, int *first, int *last);
void (*get_track_info)(struct cdrom *dev, uint32_t track, int end, track_info_t *ti);
void (*get_subchannel)(struct cdrom *dev, uint32_t lba, subchannel_t *subc);
int (*is_track_pre)(struct cdrom *dev, uint32_t lba);
int (*sector_size)(struct cdrom *dev, uint32_t lba);
int (*read_sector)(struct cdrom *dev, int type, uint8_t *b, uint32_t lba);
int (*track_type)(struct cdrom *dev, uint32_t lba);
void (*exit)(struct cdrom *dev);
} cdrom_ops_t;
typedef struct cdrom {
uint8_t id;
union {
uint8_t res, res0, /* Reserved for other ID's. */
res1,
ide_channel, scsi_device_id;
uint8_t res;
uint8_t res0; /* Reserved for other ID's. */
uint8_t res1;
uint8_t ide_channel;
uint8_t scsi_device_id;
};
uint8_t bus_type, /* 0 = ATAPI, 1 = SCSI */
bus_mode, /* Bit 0 = PIO suported;
Bit 1 = DMA supportd. */
cd_status, /* Struct variable reserved for
media status. */
speed, cur_speed;
uint8_t bus_type; /* 0 = ATAPI, 1 = SCSI */
uint8_t bus_mode; /* Bit 0 = PIO suported;
Bit 1 = DMA supportd. */
uint8_t cd_status; /* Struct variable reserved for
media status. */
uint8_t speed;
uint8_t cur_speed;
FILE* img_fp;
int is_dir;
void *priv;
char image_path[1024],
prev_image_path[1024];
char image_path[1024];
char prev_image_path[1024];
uint32_t sound_on, cdrom_capacity,
pad, seek_pos,
seek_diff, cd_end;
char *image_history[CD_IMAGE_HISTORY];
int host_drive, prev_host_drive,
cd_buflen, noplay;
uint32_t sound_on;
uint32_t cdrom_capacity;
uint32_t seek_pos;
uint32_t seek_diff;
uint32_t cd_end;
uint32_t type;
const cdrom_ops_t *ops;
int host_drive;
int prev_host_drive;
int cd_buflen;
int audio_op;
int sony_msf;
void *image;
const cdrom_ops_t *ops;
void (*insert)(void *p);
void (*close)(void *p);
uint32_t (*get_volume)(void *p, int channel);
uint32_t (*get_channel)(void *p, int channel);
void *image;
void (*insert)(void *priv);
void (*close)(void *priv);
uint32_t (*get_volume)(void *p, int channel);
uint32_t (*get_channel)(void *p, int channel);
int16_t cd_buffer[BUF_SIZE];
} cdrom_t;
extern cdrom_t cdrom[CDROM_NUM];
extern cdrom_t cdrom[CDROM_NUM];
extern char *cdrom_getname(int type);
extern int cdrom_lba_to_msf_accurate(int lba);
extern double cdrom_seek_time(cdrom_t *dev);
extern void cdrom_stop(cdrom_t *dev);
extern int cdrom_is_pre(cdrom_t *dev, uint32_t lba);
extern int cdrom_audio_callback(cdrom_t *dev, int16_t *output, int len);
extern uint8_t cdrom_audio_play(cdrom_t *dev, uint32_t pos, uint32_t len, int ismsf);
extern uint8_t cdrom_audio_track_search(cdrom_t *dev, uint32_t pos, int type, uint8_t playbit);
extern uint8_t cdrom_toshiba_audio_play(cdrom_t *dev, uint32_t pos, int type);
extern void cdrom_audio_pause_resume(cdrom_t *dev, uint8_t resume);
extern uint8_t cdrom_get_current_subchannel(cdrom_t *dev, uint8_t *b, int msf);
extern uint8_t cdrom_get_current_subcodeq_playstatus(cdrom_t *dev, uint8_t *b);
extern int cdrom_read_toc(cdrom_t *dev, unsigned char *b, int type,
unsigned char start_track, int msf, int max_len);
extern void cdrom_get_track_buffer(cdrom_t *dev, uint8_t *buf);
extern int cdrom_readsector_raw(cdrom_t *dev, uint8_t *buffer, int sector, int ismsf,
int cdrom_sector_type, int cdrom_sector_flags, int *len);
extern void cdrom_read_disc_info_toc(cdrom_t *dev, unsigned char *b, unsigned char track, int type);
extern char *cdrom_get_internal_name(int type);
extern int cdrom_get_from_internal_name(char *s);
extern void cdrom_set_type(int model, int type);
extern int cdrom_get_type(int model);
extern void cdrom_seek(cdrom_t *dev, uint32_t pos);
extern int cdrom_lba_to_msf_accurate(int lba);
extern double cdrom_seek_time(cdrom_t *dev);
extern void cdrom_stop(cdrom_t *dev);
extern int cdrom_is_pre(cdrom_t *dev, uint32_t lba);
extern int cdrom_audio_callback(cdrom_t *dev, int16_t *output, int len);
extern uint8_t cdrom_audio_play(cdrom_t *dev, uint32_t pos, uint32_t len, int ismsf);
extern uint8_t cdrom_audio_track_search(cdrom_t *dev, uint32_t pos, int type, uint8_t playbit);
extern uint8_t cdrom_audio_track_search_pioneer(cdrom_t *dev, uint32_t pos, uint8_t playbit);
extern uint8_t cdrom_audio_play_pioneer(cdrom_t *dev, uint32_t pos);
extern uint8_t cdrom_audio_play_toshiba(cdrom_t *dev, uint32_t pos, int type);
extern void cdrom_audio_pause_resume(cdrom_t *dev, uint8_t resume);
extern uint8_t cdrom_audio_scan(cdrom_t *dev, uint32_t pos, int type);
extern uint8_t cdrom_get_audio_status_pioneer(cdrom_t *dev, uint8_t *b);
extern uint8_t cdrom_get_audio_status_sony(cdrom_t *dev, uint8_t *b, int msf);
extern uint8_t cdrom_get_current_subchannel(cdrom_t *dev, uint8_t *b, int msf);
extern void cdrom_get_current_subchannel_sony(cdrom_t *dev, uint8_t *b, int msf);
extern void cdrom_get_current_subcodeq(cdrom_t *dev, uint8_t *b);
extern uint8_t cdrom_get_current_subcodeq_playstatus(cdrom_t *dev, uint8_t *b);
extern int cdrom_read_toc(cdrom_t *dev, unsigned char *b, int type,
unsigned char start_track, int msf, int max_len);
extern int cdrom_read_toc_sony(cdrom_t *dev, unsigned char *b, unsigned char start_track, int msf, int max_len);
extern void cdrom_get_track_buffer(cdrom_t *dev, uint8_t *buf);
extern void cdrom_get_q(cdrom_t *dev, uint8_t *buf, int *curtoctrk, uint8_t mode);
extern uint8_t cdrom_mitsumi_audio_play(cdrom_t *dev, uint32_t pos, uint32_t len);
extern int cdrom_readsector_raw(cdrom_t *dev, uint8_t *buffer, int sector, int ismsf,
int cdrom_sector_type, int cdrom_sector_flags, int *len, uint8_t vendor_type);
extern uint8_t cdrom_read_disc_info_toc(cdrom_t *dev, unsigned char *b, unsigned char track, int type);
extern void cdrom_close_handler(uint8_t id);
extern void cdrom_insert(uint8_t id);
extern void cdrom_eject(uint8_t id);
extern void cdrom_reload(uint8_t id);
extern void cdrom_seek(cdrom_t *dev, uint32_t pos, uint8_t vendor_type);
extern int cdrom_image_open(cdrom_t *dev, const char *fn);
extern void cdrom_image_close(cdrom_t *dev);
extern void cdrom_image_reset(cdrom_t *dev);
extern void cdrom_close_handler(uint8_t id);
extern void cdrom_insert(uint8_t id);
extern void cdrom_eject(uint8_t id);
extern void cdrom_reload(uint8_t id);
extern void cdrom_update_cdb(uint8_t *cdb, int lba_pos,
int number_of_blocks);
extern int cdrom_image_open(cdrom_t *dev, const char *fn);
extern void cdrom_image_close(cdrom_t *dev);
extern void cdrom_image_reset(cdrom_t *dev);
extern int find_cdrom_for_scsi_id(uint8_t scsi_id);
extern void cdrom_ioctl_eject(void);
extern void cdrom_ioctl_load(void);
extern int cdrom_ioctl_open(cdrom_t *dev, const char d);
extern void cdrom_close(void);
extern void cdrom_global_init(void);
extern void cdrom_global_reset(void);
extern void cdrom_hard_reset(void);
extern void scsi_cdrom_drive_reset(int c);
extern void cdrom_update_cdb(uint8_t *cdb, int lba_pos,
int number_of_blocks);
extern int find_cdrom_for_scsi_id(uint8_t scsi_id);
extern void cdrom_close(void);
extern void cdrom_global_init(void);
extern void cdrom_global_reset(void);
extern void cdrom_hard_reset(void);
extern void scsi_cdrom_drive_reset(int c);
#ifdef __cplusplus
}
#endif
#endif /*EMU_CDROM_H*/
#endif /*EMU_CDROM_H*/

View File

@@ -1,6 +1,20 @@
/* Copyright holders: RichardG867, Tenshi
see COPYING for more details
*/
/*
* 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.
*
* CD-ROM image file handling module header, translated to C
* from cdrom_dosbox.h.
*
* Authors: RichardG,
* Miran Grca, <mgrca8@gmail.com>
*
* Copyright 2016-2022 RichardG.
* Copyright 2016-2022 Miran Grca.
*/
#ifndef CDROM_IMAGE_H
#define CDROM_IMAGE_H
@@ -11,16 +25,16 @@
extern "C" {
#endif
extern int image_open(uint8_t id, wchar_t *fn);
extern int image_open(uint8_t id, wchar_t *fn);
extern void image_reset(uint8_t id);
extern void image_close(uint8_t id);
void update_status_bar_icon_state(int tag, int state);
void update_status_bar_icon_state(int tag, int state);
extern void cdrom_set_null_handler(uint8_t id);
#ifdef __cplusplus
}
#endif
#endif /* ! CDROM_IMAGE_H */
#endif /*CDROM_IMAGE_H*/

View File

@@ -1,96 +1,105 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* CD-ROM image file handling module header , translated to C
* from cdrom_dosbox.h.
* CD-ROM image file handling module header , translated to C
* from cdrom_dosbox.h.
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
* The DOSBox Team, <unknown>
*
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
* The DOSBox Team, <unknown>
*
* Copyright 2016-2020 Miran Grca.
* Copyright 2017-2020 Fred N. van Kempen.
* Copyright 2002-2020 The DOSBox Team.
* Copyright 2016-2020 Miran Grca.
* Copyright 2017-2020 Fred N. van Kempen.
* Copyright 2002-2020 The DOSBox Team.
*/
#ifndef CDROM_IMAGE_BACKEND_H
#define CDROM_IMAGE_BACKEND_H
#define RAW_SECTOR_SIZE 2352
#define COOKED_SECTOR_SIZE 2048
#define RAW_SECTOR_SIZE 2352
#define COOKED_SECTOR_SIZE 2048
#define DATA_TRACK 0x14
#define AUDIO_TRACK 0x10
#define CD_FPS 75
#define FRAMES_TO_MSF(f, M,S,F) { \
uint64_t value = f; \
*(F) = (value%CD_FPS) & 0xff; \
value /= CD_FPS; \
*(S) = (value%60) & 0xff; \
value /= 60; \
*(M) = value & 0xff; \
}
#define MSF_TO_FRAMES(M, S, F) ((M)*60*CD_FPS+(S)*CD_FPS+(F))
#define DATA_TRACK 0x14
#define AUDIO_TRACK 0x10
#define CD_FPS 75
#define FRAMES_TO_MSF(f, M, S, F) \
{ \
uint64_t value = f; \
*(F) = (value % CD_FPS) & 0xff; \
value /= CD_FPS; \
*(S) = (value % 60) & 0xff; \
value /= 60; \
*(M) = value & 0xff; \
}
#define MSF_TO_FRAMES(M, S, F) ((M) *60 * CD_FPS + (S) *CD_FPS + (F))
typedef struct SMSF {
uint16_t min;
uint8_t sec;
uint8_t fr;
uint16_t min;
uint8_t sec;
uint8_t fr;
} TMSF;
/* Track file struct. */
typedef struct {
int (*read)(void *p, uint8_t *buffer, uint64_t seek, size_t count);
uint64_t (*get_length)(void *p);
void (*close)(void *p);
typedef struct track_file_t {
int (*read)(void *priv, uint8_t *buffer, uint64_t seek, size_t count);
uint64_t (*get_length)(void *priv);
void (*close)(void *priv);
char fn[260];
FILE *file;
char fn[260];
FILE *fp;
void *priv;
} track_file_t;
typedef struct {
int number, track_number, attr, sector_size,
mode2, form, pre, pad;
uint64_t start, length,
skip;
track_file_t *file;
typedef struct track_t {
int number;
int track_number;
int attr;
int sector_size;
int mode2;
int form;
int pre;
int pad;
uint64_t start;
uint64_t length;
uint64_t skip;
track_file_t *file;
} track_t;
typedef struct {
int tracks_num;
track_t *tracks;
typedef struct cd_img_t {
int tracks_num;
track_t *tracks;
} cd_img_t;
/* Binary file functions. */
extern void cdi_close(cd_img_t *cdi);
extern int cdi_set_device(cd_img_t *cdi, const char *path);
extern int cdi_get_audio_tracks(cd_img_t *cdi, int *st_track, int *end, TMSF *lead_out);
extern int cdi_get_audio_tracks_lba(cd_img_t *cdi, int *st_track, int *end, uint32_t *lead_out);
extern int cdi_get_audio_track_pre(cd_img_t *cdi, int track);
extern int cdi_get_audio_track_info(cd_img_t *cdi, int end, int track, int *track_num, TMSF *start, uint8_t *attr);
extern int cdi_get_audio_track_info_lba(cd_img_t *cdi, int end, int track, int *track_num, uint32_t *start, uint8_t *attr);
extern int cdi_get_track(cd_img_t *cdi, uint32_t sector);
extern int cdi_get_audio_sub(cd_img_t *cdi, uint32_t sector, uint8_t *attr, uint8_t *track, uint8_t *index, TMSF *rel_pos, TMSF *abs_pos);
extern int cdi_read_sector(cd_img_t *cdi, uint8_t *buffer, int raw, uint32_t sector);
extern int cdi_read_sectors(cd_img_t *cdi, uint8_t *buffer, int raw, uint32_t sector, uint32_t num);
extern int cdi_read_sector_sub(cd_img_t *cdi, uint8_t *buffer, uint32_t sector);
extern int cdi_get_sector_size(cd_img_t *cdi, uint32_t sector);
extern int cdi_is_mode2(cd_img_t *cdi, uint32_t sector);
extern int cdi_get_mode2_form(cd_img_t *cdi, uint32_t sector);
extern int cdi_load_iso(cd_img_t *cdi, const char *filename);
extern int cdi_load_cue(cd_img_t *cdi, const char *cuefile);
extern int cdi_has_data_track(cd_img_t *cdi);
extern int cdi_has_audio_track(cd_img_t *cdi);
extern void cdi_close(cd_img_t *cdi);
extern int cdi_set_device(cd_img_t *cdi, const char *path);
extern int cdi_get_audio_tracks(cd_img_t *cdi, int *st_track, int *end, TMSF *lead_out);
extern int cdi_get_audio_tracks_lba(cd_img_t *cdi, int *st_track, int *end, uint32_t *lead_out);
extern int cdi_get_audio_track_pre(cd_img_t *cdi, int track);
extern int cdi_get_audio_track_info(cd_img_t *cdi, int end, int track, int *track_num, TMSF *start, uint8_t *attr);
extern int cdi_get_audio_track_info_lba(cd_img_t *cdi, int end, int track, int *track_num, uint32_t *start, uint8_t *attr);
extern int cdi_get_track(cd_img_t *cdi, uint32_t sector);
extern int cdi_get_audio_sub(cd_img_t *cdi, uint32_t sector, uint8_t *attr, uint8_t *track, uint8_t *index, TMSF *rel_pos, TMSF *abs_pos);
extern int cdi_read_sector(cd_img_t *cdi, uint8_t *buffer, int raw, uint32_t sector);
extern int cdi_read_sectors(cd_img_t *cdi, uint8_t *buffer, int raw, uint32_t sector, uint32_t num);
extern int cdi_read_sector_sub(cd_img_t *cdi, uint8_t *buffer, uint32_t sector);
extern int cdi_get_sector_size(cd_img_t *cdi, uint32_t sector);
extern int cdi_is_mode2(cd_img_t *cdi, uint32_t sector);
extern int cdi_get_mode2_form(cd_img_t *cdi, uint32_t sector);
extern int cdi_load_iso(cd_img_t *cdi, const char *filename);
extern int cdi_load_cue(cd_img_t *cdi, const char *cuefile);
extern int cdi_has_data_track(cd_img_t *cdi);
extern int cdi_has_audio_track(cd_img_t *cdi);
/* Virtual ISO functions. */
extern int viso_read(void *priv, uint8_t *buffer, uint64_t seek, size_t count);
extern uint64_t viso_get_length(void *priv);
extern void viso_close(void *priv);
extern track_file_t *viso_init(const char *dirname, int *error);
#endif /* ! CDROM_IMAGE_BACKEND_H */
#endif /*CDROM_IMAGE_BACKEND_H*/

View File

@@ -0,0 +1,31 @@
/*
* 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 common CD-ROM interface controller handler.
*
*
*
* Authors: TheCollector1995
*
* Copyright 2022 TheCollector1995.
*/
#ifndef EMU_CDROM_INTERFACE_H
#define EMU_CDROM_INTERFACE_H
extern int cdrom_interface_current;
extern void cdrom_interface_reset(void);
extern const char *cdrom_interface_get_internal_name(int cdinterface);
extern int cdrom_interface_get_from_internal_name(char *s);
extern int cdrom_interface_has_config(int cdinterface);
extern const device_t *cdrom_interface_get_device(int cdinterface);
extern int cdrom_interface_get_flags(int cdinterface);
extern int cdrom_interface_available(int cdinterface);
#endif /*EMU_CDROM_INTERFACE_H*/

View File

@@ -0,0 +1,22 @@
/*
* 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.
*
* Mitsumi CD-ROM emulation for the ISA bus.
*
*
*
* Authors: Miran Grca, <mgrca8@gmail.com>
*
* Copyright 2022 Miran Grca.
*/
#ifndef CDROM_MITSUMI_H
#define CDROM_MITSUMI_H
extern const device_t mitsumi_cdrom_device;
#endif /*CDROM_MITSUMI_H*/

View File

@@ -1,173 +1,183 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Handling of the emulated chipsets.
* Handling of the emulated chipsets.
*
*
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Authors: Miran Grca, <mgrca8@gmail.com>
*
* Copyright 2019,2020 Miran Grca.
* Copyright 2019-2020 Miran Grca.
*/
#ifndef EMU_CHIPSET_H
# define EMU_CHIPSET_H
#define EMU_CHIPSET_H
/* ACC */
extern const device_t acc2168_device;
extern const device_t acc2168_device;
/* ALi */
extern const device_t ali1217_device;
extern const device_t ali1429_device;
extern const device_t ali1429g_device;
extern const device_t ali1489_device;
extern const device_t ali1531_device;
extern const device_t ali1541_device;
extern const device_t ali1543_device;
extern const device_t ali1543c_device;
extern const device_t ali1621_device;
extern const device_t ali6117d_device;
extern const device_t ali1217_device;
extern const device_t ali1429_device;
extern const device_t ali1429g_device;
extern const device_t ali1435_device;
extern const device_t ali1489_device;
extern const device_t ali1531_device;
extern const device_t ali1541_device;
extern const device_t ali1543_device;
extern const device_t ali1543c_device;
extern const device_t ali1621_device;
extern const device_t ali6117d_device;
/* AMD */
extern const device_t amd640_device;
extern const device_t amd640_device;
/* Compaq */
extern const device_t compaq_386_device;
/* Contaq/Cypress */
extern const device_t contaq_82c596a_device;
extern const device_t contaq_82c597_device;
extern const device_t contaq_82c596a_device;
extern const device_t contaq_82c597_device;
/* C&T */
extern const device_t ct_82c100_device;
extern const device_t neat_device;
extern const device_t scat_device;
extern const device_t scat_4_device;
extern const device_t scat_sx_device;
extern const device_t cs8230_device;
extern const device_t cs4031_device;
extern const device_t ct_82c100_device;
extern const device_t neat_device;
extern const device_t scat_device;
extern const device_t scat_4_device;
extern const device_t scat_sx_device;
extern const device_t cs8230_device;
extern const device_t cs4031_device;
/* G2 */
extern const device_t gc100_device;
extern const device_t gc100a_device;
extern const device_t gc100_device;
extern const device_t gc100a_device;
/* Headland */
extern const device_t headland_gc10x_device;
extern const device_t headland_ht18a_device;
extern const device_t headland_ht18b_device;
extern const device_t headland_ht18c_device;
extern const device_t headland_gc10x_device;
extern const device_t headland_gc113_device;
extern const device_t headland_ht18a_device;
extern const device_t headland_ht18b_device;
extern const device_t headland_ht18c_device;
extern const device_t headland_ht21c_d_device;
extern const device_t headland_ht21e_device;
/* IMS */
extern const device_t ims8848_device;
extern const device_t ims8848_device;
/* Intel */
extern const device_t intel_82335_device;
extern const device_t i420ex_device;
extern const device_t i420ex_ide_device;
extern const device_t i420tx_device;
extern const device_t i420zx_device;
extern const device_t i430lx_device;
extern const device_t i430nx_device;
extern const device_t i430fx_device;
extern const device_t i430fx_old_device;
extern const device_t i430fx_rev02_device;
extern const device_t i430hx_device;
extern const device_t i430vx_device;
extern const device_t i430tx_device;
extern const device_t i440fx_device;
extern const device_t i440lx_device;
extern const device_t i440ex_device;
extern const device_t i440bx_device;
extern const device_t i440bx_no_agp_device;
extern const device_t i440gx_device;
extern const device_t i440zx_device;
extern const device_t i450kx_device;
extern const device_t intel_82335_device;
extern const device_t i420ex_device;
extern const device_t i420ex_ide_device;
extern const device_t i420tx_device;
extern const device_t i420zx_device;
extern const device_t i430lx_device;
extern const device_t i430nx_device;
extern const device_t i430fx_device;
extern const device_t i430fx_old_device;
extern const device_t i430fx_rev02_device;
extern const device_t i430hx_device;
extern const device_t i430vx_device;
extern const device_t i430tx_device;
extern const device_t i440fx_device;
extern const device_t i440lx_device;
extern const device_t i440ex_device;
extern const device_t i440bx_device;
extern const device_t i440bx_no_agp_device;
extern const device_t i440gx_device;
extern const device_t i440zx_device;
extern const device_t i450kx_device;
extern const device_t sio_device;
extern const device_t sio_zb_device;
extern const device_t sio_device;
extern const device_t sio_zb_device;
extern const device_t piix_device;
extern const device_t piix_old_device;
extern const device_t piix_rev02_device;
extern const device_t piix3_device;
extern const device_t piix3_ioapic_device;
extern const device_t piix4_device;
extern const device_t piix4e_device;
extern const device_t slc90e66_device;
extern const device_t piix_device;
extern const device_t piix_no_mirq_device;
extern const device_t piix_old_device;
extern const device_t piix_rev02_device;
extern const device_t piix3_device;
extern const device_t piix3_ioapic_device;
extern const device_t piix4_device;
extern const device_t piix4e_device;
extern const device_t slc90e66_device;
extern const device_t ioapic_device;
extern const device_t ioapic_device;
/* OPTi */
extern const device_t opti283_device;
extern const device_t opti291_device;
extern const device_t opti493_device;
extern const device_t opti495_device;
extern const device_t opti802g_device;
extern const device_t opti822_device;
extern const device_t opti895_device;
extern const device_t opti283_device;
extern const device_t opti291_device;
extern const device_t opti493_device;
extern const device_t opti495_device;
extern const device_t opti601_device;
extern const device_t opti602_device;
extern const device_t opti802g_device;
extern const device_t opti802g_pci_device;
extern const device_t opti822_device;
extern const device_t opti895_device;
extern const device_t opti5x7_device;
extern const device_t opti5x7_device;
extern const device_t opti5x7_pci_device;
/* SiS */
extern const device_t rabbit_device;
extern const device_t sis_85c401_device;
extern const device_t sis_85c460_device;
extern const device_t sis_85c461_device;
extern const device_t sis_85c471_device;
extern const device_t sis_85c496_device;
extern const device_t sis_85c496_ls486e_device;
extern const device_t sis_85c50x_device;
extern const device_t sis_5511_device;
extern const device_t sis_5571_device;
extern const device_t rabbit_device;
extern const device_t sis_85c401_device;
extern const device_t sis_85c460_device;
extern const device_t sis_85c461_device;
extern const device_t sis_85c471_device;
extern const device_t sis_85c496_device;
extern const device_t sis_85c496_ls486e_device;
extern const device_t sis_85c50x_device;
extern const device_t sis_5511_device;
extern const device_t sis_5571_device;
/* ST */
extern const device_t stpc_client_device;
extern const device_t stpc_consumer2_device;
extern const device_t stpc_elite_device;
extern const device_t stpc_atlas_device;
extern const device_t stpc_serial_device;
extern const device_t stpc_lpt_device;
extern const device_t stpc_client_device;
extern const device_t stpc_consumer2_device;
extern const device_t stpc_elite_device;
extern const device_t stpc_atlas_device;
extern const device_t stpc_serial_device;
extern const device_t stpc_lpt_device;
/* UMC */
extern const device_t umc_um82c49x_device;
extern const device_t umc_8886f_device;
extern const device_t umc_8886af_device;
extern const device_t umc_hb4_device;
extern const device_t umc_8886f_device;
extern const device_t umc_8886af_device;
extern const device_t umc_hb4_device;
/* VIA */
extern const device_t via_vt82c49x_device;
extern const device_t via_vt82c49x_pci_device;
extern const device_t via_vt82c49x_pci_ide_device;
extern const device_t via_vt82c505_device;
extern const device_t via_vpx_device;
extern const device_t via_vp3_device;
extern const device_t via_mvp3_device;
extern const device_t via_apro_device;
extern const device_t via_apro133_device;
extern const device_t via_apro133a_device;
extern const device_t via_vt8601_device;
extern const device_t via_vt82c586b_device;
extern const device_t via_vt82c596a_device;
extern const device_t via_vt82c596b_device;
extern const device_t via_vt82c686a_device;
extern const device_t via_vt82c686b_device;
extern const device_t via_vt8231_device;
extern const device_t via_vt82c49x_device;
extern const device_t via_vt82c49x_pci_device;
extern const device_t via_vt82c49x_pci_ide_device;
extern const device_t via_vt82c505_device;
extern const device_t via_vpx_device;
extern const device_t via_vp3_device;
extern const device_t via_mvp3_device;
extern const device_t via_apro_device;
extern const device_t via_apro133_device;
extern const device_t via_apro133a_device;
extern const device_t via_vt8601_device;
extern const device_t via_vt82c586b_device;
extern const device_t via_vt82c596a_device;
extern const device_t via_vt82c596b_device;
extern const device_t via_vt82c686a_device;
extern const device_t via_vt82c686b_device;
extern const device_t via_vt8231_device;
/* VLSI */
extern const device_t vl82c480_device;
extern const device_t vl82c486_device;
extern const device_t vlsi_scamp_device;
extern const device_t vl82c480_device;
extern const device_t vl82c486_device;
extern const device_t vlsi_scamp_device;
/* WD */
extern const device_t wd76c10_device;
extern const device_t wd76c10_device;
/* Miscellaneous Hardware */
extern const device_t phoenix_486_jumper_device;
extern const device_t phoenix_486_jumper_pci_device;
extern const device_t phoenix_486_jumper_device;
extern const device_t phoenix_486_jumper_pci_device;
#if defined(DEV_BRANCH) && defined(USE_OLIVETTI)
extern const device_t olivetti_eva_device;
extern const device_t olivetti_eva_device;
#endif
#endif /*EMU_CHIPSET_H*/
#endif /*EMU_CHIPSET_H*/

View File

@@ -1,21 +1,21 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Definitions for clock generator chips.
* Definitions for clock generator chips.
*
*
*
* Authors: RichardG, <richardg867@gmail.com>
* Authors: RichardG, <richardg867@gmail.com>
*
* Copyright 2020 RichardG.
* Copyright 2020 RichardG.
*/
#ifndef EMU_CLOCK_H
# define EMU_CLOCK_H
#define EMU_CLOCK_H
/* clock_ics9xxx.c */
enum {
@@ -54,9 +54,7 @@ enum {
ICS9xxx_MAX
};
/* clock_ics9xxx.c */
extern device_t *ics9xxx_get(uint8_t model);
extern device_t *ics9xxx_get(uint8_t model);
#endif /*EMU_CLOCK_H*/
#endif /*EMU_CLOCK_H*/

View File

@@ -1,169 +1,171 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Configuration file handler header.
* Configuration file handler header.
*
*
*
* Authors: Sarah Walker,
* Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
* Overdoze,
* Authors: Sarah Walker,
* Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
* Overdoze,
*
* Copyright 2008-2017 Sarah Walker.
* Copyright 2016,2017 Miran Grca.
* Copyright 2017 Fred N. van Kempen.
* Copyright 2008-2017 Sarah Walker.
* Copyright 2016-2017 Miran Grca.
* Copyright 2017 Fred N. van Kempen.
*/
#ifndef EMU_CONFIG_H
# define EMU_CONFIG_H
#define EMU_CONFIG_H
#ifdef __cplusplus
extern "C" {
#endif
#if 0
typedef struct {
uint8_t id,
uint8_t bus_type, /* Bus type: IDE, SCSI, etc. */
bus, :4, /* ID of the bus (for example, for IDE,
0 = primary, 1 = secondary, etc. */
bus_id, :4, /* ID of the device on the bus */
uint8_t type, /* Type flags, interpretation depends
on the device */
uint8_t is_image; /* This is only used for CD-ROM:
0 = Image;
1 = Host drive */
typedef struct storage_cfg_t {
uint8_t id;
uint8_t bus_type; /* Bus type: IDE, SCSI, etc. */
uint8_t bus : 4; /* ID of the bus (for example, for IDE,
0 = primary, 1 = secondary, etc. */
uint8_t bus_id : 4; /* ID of the device on the bus */
uint8_t type; /* Type flags, interpretation depends
on the device */
uint8_t is_image; /* This is only used for CD-ROM:
0 = Image;
1 = Host drive */
wchar_t path[1024]; /* Name of current image file or
host drive */
wchar_t path[1024]; /* Name of current image file or
host drive */
uint32_t spt, /* Physical geometry parameters */
hpc,
tracks;
uint32_t spt; /* Physical geometry parameters */
uint32_t hpc;
uint32_t tracks;
} storage_cfg_t;
typedef struct {
typedef struct config_t {
/* General configuration */
int vid_resize, /* Window is resizable or not */
vid_renderer, /* Renderer */
vid_fullscreen_scale, /* Full screen scale type */
vid_fullscreen_start, /* Start emulator in full screen */
vid_force_43, /* Force 4:3 display ratio in windowed mode */
vid_scale, /* Windowed mode scale */
vid_overscan, /* EGA/(S)VGA overscan enabled */
vid_cga_contrast, /* CGA alternate contrast enabled */
vid_grayscale, /* Video is grayscale */
vid_grayscale_type, /* Video grayscale type */
vid_invert_display, /* Invert display */
rctrl_is_lalt, /* Right CTRL is left ALT */
update_icons, /* Update status bar icons */
window_remember, /* Remember window position and size */
window_w, /* Window coordinates */
window_h,
window_x,
window_y,
sound_gain; /* Sound gain */
#ifdef USE_LANGUAGE
uint16_t language_id; /* Language ID (0x0409 = English (US)) */
#endif
int vid_resize; /* Window is resizable or not */
int vid_renderer; /* Renderer */
int vid_fullscreen_scale; /* Full screen scale type */
int vid_fullscreen_start; /* Start emulator in full screen */
int vid_force_43; /* Force 4:3 display ratio in windowed mode */
int vid_scale; /* Windowed mode scale */
int vid_overscan; /* EGA/(S)VGA overscan enabled */
int vid_cga_contrast; /* CGA alternate contrast enabled */
int vid_grayscale; /* Video is grayscale */
int vid_grayscale_type; /* Video grayscale type */
int vid_invert_display; /* Invert display */
int rctrl_is_lalt; /* Right CTRL is left ALT */
int update_icons; /* Update status bar icons */
int window_remember; /* Remember window position and size */
int window_w; /* Window coordinates */
int window_h;
int window_x;
int window_y;
int sound_gain; /* Sound gain */
# ifdef USE_LANGUAGE
uint16_t language_id; /* Language ID (0x0409 = English (US)) */
# endif
/* Machine cateogory */
int machine, /* Machine */
cpu, /* CPU */
#ifdef USE_DYNAREC
cpu_use_dynarec, /* CPU recompiler enabled */
#endif
wait_states, /* CPU wait states */
enable_external_fpu, /* FPU enabled */
time_sync; /* Time sync enabled */
uint32_t mem_size; /* Memory size */
int machine; /* Machine */
int cpu; /* CPU */
# ifdef USE_DYNAREC
int cpu_use_dynarec; /* CPU recompiler enabled */
# endif
int wait_states; /* CPU wait states */
int enable_external_fpu; /* FPU enabled */
int time_sync; /* Time sync enabled */
uint32_t mem_size; /* Memory size */
/* Video category */
int video_card, /* Video card */
voodoo_enabled; /* Voodoo enabled */
int video_card; /* Video card */
int voodoo_enabled; /* Voodoo enabled */
/* Input devices category */
int mouse_type, /* Mouse type */
joystick_type; /* Joystick type */
int mouse_type; /* Mouse type */
int joystick_type; /* Joystick type */
/* Sound category */
int sound_card, /* Sound card */
midi_device, /* Midi device */
mpu_401, /* Standalone MPU-401 enabled */
ssi_2001_enabled, /* SSI-2001 enabled */
game_blaster_enabled, /* Game blaster enabled */
gus_enabled, /* Gravis Ultrasound enabled */
opl_type, /* OPL emulation type */
sound_is_float; /* Sound is 32-bit float or 16-bit integer */
int sound_card; /* Sound card */
int midi_device; /* Midi device */
int mpu_401; /* Standalone MPU-401 enabled */
int ssi_2001_enabled; /* SSI-2001 enabled */
int game_blaster_enabled; /* Game blaster enabled */
int gus_enabled; /* Gravis Ultrasound enabled */
int opl_type; /* OPL emulation type */
int sound_is_float; /* Sound is 32-bit float or 16-bit integer */
/* Network category */
int network_type, /* Network type (SLiRP or PCap) */
network_card; /* Network card */
char network_host[520]; /* PCap device */
int network_type; /* Network type (SLiRP or PCap) */
int network_card; /* Network card */
char network_host[520]; /* PCap device */
/* Ports category */
char parallel_devices[3][32]; /* LPT device names */
#ifdef USE_SERIAL_DEVICES
char serial_devices[4][32]; /* Serial device names */
#endif
int serial_enabled[4], /* Serial ports 1 and 2 enabled */
parallel_enabled[3]; /* LPT1, LPT2, LPT3 enabled */
char parallel_devices[PARALLEL_MAX][32]; /* LPT device names */
# ifdef USE_SERIAL_DEVICES
char serial_devices[SERIAL_MAX][32]; /* Serial device names */
# endif
/* Other peripherals category */
int fdc_type, /* Floppy disk controller type */
hdc, /* Hard disk controller */
scsi_card, /* SCSI controller */
ide_ter_enabled, /* Tertiary IDE controller enabled */
ide_qua_enabled, /* Quaternary IDE controller enabled */
bugger_enabled, /* ISA bugger device enabled */
isa_rtc_type, /* ISA RTC card */
isa_mem_type[ISAMEM_MAX]; /* ISA memory boards */
int fdc_type; /* Floppy disk controller type */
int hdc; /* Hard disk controller */
int scsi_card; /* SCSI controller */
int ide_ter_enabled; /* Tertiary IDE controller enabled */
int ide_qua_enabled; /* Quaternary IDE controller enabled */
int bugger_enabled; /* ISA bugger device enabled */
int isa_rtc_type; /* ISA RTC card */
int isa_mem_type[ISAMEM_MAX]; /* ISA memory boards */
/* Hard disks category */
storage_cfg_t hdd[HDD_NUM]; /* Hard disk drives */
storage_cfg_t hdd[HDD_NUM]; /* Hard disk drives */
/* Floppy drives category */
storage_cfg_t fdd[FDD_NUM]; /* Floppy drives */
storage_cfg_t fdd[FDD_NUM]; /* Floppy drives */
/* Other removable devices category */
storage_cfg_t cdrom[CDROM_NUM], /* CD-ROM drives */
storage_cfg_t rdisk[ZIP_NUM]; /* Removable disk drives */
storage_cfg_t cdrom[CDROM_NUM]; /* CD-ROM drives */
storage_cfg_t rdisk[ZIP_NUM]; /* Removable disk drives */
} config_t;
#endif
extern void config_load(void);
extern void config_save(void);
extern void config_write(char *fn);
extern void config_dump(void);
extern void config_load(void);
extern void config_save(void);
extern void config_delete_var(char *head, char *name);
extern int config_get_int(char *head, char *name, int def);
extern double config_get_double(char *head, char *name, double def);
extern int config_get_hex16(char *head, char *name, int def);
extern int config_get_hex20(char *head, char *name, int def);
extern int config_get_mac(char *head, char *name, int def);
extern char *config_get_string(char *head, char *name, char *def);
extern wchar_t *config_get_wstring(char *head, char *name, wchar_t *def);
extern void config_set_int(char *head, char *name, int val);
extern void config_set_double(char *head, char *name, double val);
extern void config_set_hex16(char *head, char *name, int val);
extern void config_set_hex20(char *head, char *name, int val);
extern void config_set_mac(char *head, char *name, int val);
extern void config_set_string(char *head, char *name, char *val);
extern void config_set_wstring(char *head, char *name, wchar_t *val);
#ifdef EMU_INI_H
extern ini_t config_get_ini(void);
#else
extern void *config_get_ini(void);
#endif
extern void * config_find_section(char *name);
extern void config_rename_section(void *priv, char *name);
#define config_delete_var(head, name) ini_delete_var(config_get_ini(), head, name)
#define config_get_int(head, name, def) ini_get_int(config_get_ini(), head, name, def)
#define config_get_double(head, name, def) ini_get_double(config_get_ini(), head, name, def)
#define config_get_hex16(head, name, def) ini_get_hex16(config_get_ini(), head, name, def)
#define config_get_hex20(head, name, def) ini_get_hex20(config_get_ini(), head, name, def)
#define config_get_mac(head, name, def) ini_get_mac(config_get_ini(), head, name, def)
#define config_get_string(head, name, def) ini_get_string(config_get_ini(), head, name, def)
#define config_get_wstring(head, name, def) ini_get_wstring(config_get_ini(), head, name, def)
#define config_set_int(head, name, val) ini_set_int(config_get_ini(), head, name, val)
#define config_set_double(head, name, val) ini_set_double(config_get_ini(), head, name, val)
#define config_set_hex16(head, name, val) ini_set_hex16(config_get_ini(), head, name, val)
#define config_set_hex20(head, name, val) ini_set_hex20(config_get_ini(), head, name, val)
#define config_set_mac(head, name, val) ini_set_mac(config_get_ini(), head, name, val)
#define config_set_string(head, name, val) ini_set_string(config_get_ini(), head, name, val)
#define config_set_wstring(head, name, val) ini_set_wstring(config_get_ini(), head, name, val)
#define config_find_section(name) ini_find_section(config_get_ini(), name)
#define config_rename_section ini_rename_section
#ifdef __cplusplus
}
#endif
#endif /*EMU_CONFIG_H*/
#endif /*EMU_CONFIG_H*/

View File

@@ -1,49 +1,44 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Definitions for the Distributed DMA emulation.
* Definitions for the Distributed DMA emulation.
*
*
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Authors: Miran Grca, <mgrca8@gmail.com>
*
* Copyright 2020 Miran Grca.
* Copyright 2020 Miran Grca.
*/
#ifndef DDMA_H
# define DDMA_H
#define DDMA_H
#ifdef __cplusplus
extern "C" {
#endif
typedef struct
{
uint16_t io_base;
int channel, enable;
typedef struct ddma_channel_t {
uint16_t io_base;
int channel;
int enable;
} ddma_channel_t;
typedef struct
{
ddma_channel_t channels[8];
typedef struct ddma_t {
ddma_channel_t channels[8];
} ddma_t;
/* Global variables. */
extern const device_t ddma_device;
extern const device_t ddma_device;
/* Functions. */
extern void ddma_update_io_mapping(ddma_t *dev, int ch, uint8_t base_l, uint8_t base_h, int enable);
extern void ddma_update_io_mapping(ddma_t *dev, int ch, uint8_t base_l, uint8_t base_h, int enable);
#ifdef __cplusplus
}
#endif
#endif /*DDMA_H*/
#endif /*DDMA_H*/

View File

@@ -1,22 +1,24 @@
/*
* VARCem Virtual ARchaeological Computer EMulator.
* An emulator of (mostly) x86-based PC systems and devices,
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
* spanning the era between 1981 and 1995.
* 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 VARCem Project.
* This file is part of the 86Box distribution.
*
* Definitions for the device handler.
* Definitions for the device handler.
*
*
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
* Sarah Walker, <tommowalker@tommowalker.co.uk>
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
* Sarah Walker, <https://pcem-emulator.co.uk/>
*
* Copyright 2017-2019 Fred N. van Kempen.
* Copyright 2016-2019 Miran Grca.
* Copyright 2008-2019 Sarah Walker.
* Copyright 2017-2019 Fred N. van Kempen.
* Copyright 2016-2019 Miran Grca.
* Copyright 2008-2019 Sarah Walker.
* Copyright 2021 Andreas J. Reichel.
* Copyright 2021-2022 Jasmine Iwanek.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -37,137 +39,189 @@
* USA.
*/
#ifndef EMU_DEVICE_H
# define EMU_DEVICE_H
#define EMU_DEVICE_H
#define CONFIG_END -1
#define CONFIG_STRING 0
#define CONFIG_INT 1
#define CONFIG_BINARY 2
#define CONFIG_SELECTION 3
#define CONFIG_MIDI_OUT 4
#define CONFIG_FNAME 5
#define CONFIG_SPINNER 6
#define CONFIG_HEX16 7
#define CONFIG_HEX20 8
#define CONFIG_MAC 9
#define CONFIG_MIDI_IN 10
#define CONFIG_BIOS 11
#define CONFIG_SERPORT 12
#define CONFIG_STRING 0
#define CONFIG_INT 1
#define CONFIG_BINARY 2
#define CONFIG_SELECTION 3
#define CONFIG_MIDI 4
#define CONFIG_FNAME 5
#define CONFIG_SPINNER 6
#define CONFIG_HEX16 7
#define CONFIG_HEX20 8
#define CONFIG_MAC 9
#define CONFIG_MIDI_IN 10
#define CONFIG_ONBOARD 256 /* only avaialble on the on-board variant */
#define CONFIG_STANDALONE 257 /* not available on the on-board variant */
enum {
DEVICE_NOT_WORKING = 1, /* does not currently work correctly and will be disabled in a release build */
DEVICE_PCJR = 2, /* requires an IBM PCjr */
DEVICE_AT = 4, /* requires an AT-compatible system */
DEVICE_PS2 = 8, /* requires a PS/1 or PS/2 system */
DEVICE_ISA = 0x10, /* requires the ISA bus */
DEVICE_CBUS = 0x20, /* requires the C-BUS bus */
DEVICE_MCA = 0x40, /* requires the MCA bus */
DEVICE_EISA = 0x80, /* requires the EISA bus */
DEVICE_VLB = 0x100, /* requires the PCI bus */
DEVICE_PCI = 0x200, /* requires the VLB bus */
DEVICE_AGP = 0x400, /* requires the AGP bus */
DEVICE_AC97 = 0x800, /* requires the AC'97 bus */
DEVICE_COM = 0x1000, /* requires a serial port */
DEVICE_LPT = 0x2000 /* requires a parallel port */
DEVICE_PCJR = 2, /* requires an IBM PCjr */
DEVICE_XTKBC = 4, /* requires an XT-compatible keyboard controller */
DEVICE_AT = 8, /* requires an AT-compatible system */
DEVICE_ATKBC = 0x10, /* requires an AT-compatible keyboard controller */
DEVICE_PS2 = 0x20, /* requires a PS/1 or PS/2 system */
DEVICE_ISA = 0x40, /* requires the ISA bus */
DEVICE_CBUS = 0x80, /* requires the C-BUS bus */
DEVICE_PCMCIA = 0x100, /* requires the PCMCIA bus */
DEVICE_MCA = 0x200, /* requires the MCA bus */
DEVICE_HIL = 0x400, /* requires the HP HIL bus */
DEVICE_EISA = 0x800, /* requires the EISA bus */
DEVICE_AT32 = 0x1000, /* requires the Mylex AT/32 local bus */
DEVICE_OLB = 0x2000, /* requires the OPTi local bus */
DEVICE_VLB = 0x4000, /* requires the VLB bus */
DEVICE_PCI = 0x8000, /* requires the PCI bus */
DEVICE_CARDBUS = 0x10000, /* requires the CardBus bus */
DEVICE_USB = 0x20000, /* requires the USB bus */
DEVICE_AGP = 0x40000, /* requires the AGP bus */
DEVICE_AC97 = 0x80000, /* requires the AC'97 bus */
DEVICE_COM = 0x100000, /* requires a serial port */
DEVICE_LPT = 0x200000, /* requires a parallel port */
DEVICE_KBC = 0x400000, /* is a keyboard controller */
DEVICE_ONBOARD = 0x20000000, /* is on-board */
DEVICE_EXTPARAMS = 0x40000000, /* accepts extended parameters */
DEVICE_PIT = 0x80000000, /* device is a PIT */
DEVICE_ALL = 0xffffffff /* match all devices */
};
#define BIOS_NORMAL 0
#define BIOS_INTERLEAVED 1
#define BIOS_INTERLEAVED_SINGLEFILE 2
#define BIOS_INTERLEAVED_QUAD 3
#define BIOS_INTERLEAVED_QUAD_SINGLEFILE 4
#define BIOS_INTEL_AMI 5
#define BIOS_INTERLEAVED_INVERT 8
#define BIOS_HIGH_BIT_INVERT 16
typedef struct {
typedef struct device_config_selection_t {
const char *description;
int value;
int value;
} device_config_selection_t;
typedef struct {
typedef struct device_config_bios_t {
const char *name;
const char *internal_name;
int bios_type;
int files_no;
uint32_t local;
uint32_t size;
void *dev1;
void *dev2;
const char *files[9];
} device_config_bios_t;
typedef struct device_config_spinner_t {
int16_t min;
int16_t max;
int16_t step;
} device_config_spinner_t;
typedef struct {
const char *name;
const char *description;
int type;
const char *default_string;
int default_int;
const char *file_filter;
device_config_spinner_t spinner;
const device_config_selection_t selection[16];
typedef struct device_config_t {
const char *name;
const char *description;
int type;
const char *default_string;
int default_int;
const char *file_filter;
const device_config_spinner_t spinner;
const device_config_selection_t selection[32];
const device_config_bios_t bios[32];
} device_config_t;
typedef struct _device_ {
const char *name;
const char *name;
const char *internal_name;
uint32_t flags; /* system flags */
uint32_t local; /* flags local to device */
uint32_t flags; /* system flags */
uintptr_t local; /* flags local to device */
void *(*init)(const struct _device_ *);
void (*close)(void *priv);
void (*reset)(void *priv);
union {
int (*available)(void);
int (*poll)(int x, int y, int z, int b, void *priv);
void (*register_pci_slot)(int device, int type, int inta, int intb, int intc, int intd, void *priv);
void *(*init)(const struct _device_ *);
void *(*init_ext)(const struct _device_ *, void*);
};
void (*speed_changed)(void *priv);
void (*force_redraw)(void *priv);
void (*close)(void *priv);
void (*reset)(void *priv);
union {
int (*available)(void);
int (*poll)(void *priv);
};
void (*speed_changed)(void *priv);
void (*force_redraw)(void *priv);
const device_config_t *config;
} device_t;
typedef struct {
const device_t *dev;
char name[2048];
typedef struct device_context_t {
const device_t *dev;
char name[2048];
int instance;
} device_context_t;
#ifdef __cplusplus
extern "C" {
#endif
extern void device_init(void);
extern void device_set_context(device_context_t *c, const device_t *d, int inst);
extern void device_context(const device_t *d);
extern void device_context_inst(const device_t *d, int inst);
extern void device_context_restore(void);
extern void *device_add(const device_t *d);
extern void device_add_ex(const device_t *d, void *priv);
extern void *device_add_inst(const device_t *d, int inst);
extern void device_add_inst_ex(const device_t *d, void *priv, int inst);
extern void *device_cadd(const device_t *d, const device_t *cd);
extern void device_cadd_ex(const device_t *d, const device_t *cd, void *priv);
extern void *device_cadd_inst(const device_t *d, const device_t *cd, int inst);
extern void device_cadd_inst_ex(const device_t *d, const device_t *cd, void *priv, int inst);
extern void device_close_all(void);
extern void device_reset_all(void);
extern void device_reset_all_pci(void);
extern void *device_get_priv(const device_t *d);
extern int device_available(const device_t *d);
extern int device_poll(const device_t *d, int x, int y, int z, int b);
extern void device_register_pci_slot(const device_t *d, int device, int type, int inta, int intb, int intc, int intd);
extern void device_speed_changed(void);
extern void device_force_redraw(void);
extern void device_get_name(const device_t *d, int bus, char *name);
extern void device_init(void);
extern void device_set_context(device_context_t *c, const device_t *dev, int inst);
extern void device_context(const device_t *dev);
extern void device_context_inst(const device_t *dev, int inst);
extern void device_context_restore(void);
extern void *device_add(const device_t *d);
extern void *device_add_parameters(const device_t *dev, void *params);
extern void device_add_ex(const device_t *dev, void *priv);
extern void device_add_ex_parameters(const device_t *dev, void *priv, void *params);
extern void *device_add_inst(const device_t *dev, int inst);
extern void *device_add_inst_parameters(const device_t *dev, int inst, void *params);
extern void device_add_inst_ex(const device_t *dev, void *priv, int inst);
extern void device_add_inst_ex_parameters(const device_t *dev, void *priv, int inst, void *params);
extern void *device_cadd(const device_t *dev, const device_t *cd);
extern void *device_cadd_parameters(const device_t *dev, const device_t *cd, void *params);
extern void device_cadd_ex(const device_t *dev, const device_t *cd, void *priv);
extern void device_cadd_ex_parameters(const device_t *dev, const device_t *cd, void *priv, void *params);
extern void *device_cadd_inst(const device_t *dev, const device_t *cd, int inst);
extern void *device_cadd_inst_parameters(const device_t *dev, const device_t *cd, int inst, void *params);
extern void device_cadd_inst_ex(const device_t *dev, const device_t *cd, void *priv, int inst);
extern void device_cadd_inst_ex_parameters(const device_t *dev, const device_t *cd, void *priv, int inst, void *params);
extern void device_close_all(void);
extern void device_reset_all(uint32_t match_flags);
extern void *device_find_first_priv(uint32_t match_flags);
extern void *device_get_priv(const device_t *dev);
extern int device_available(const device_t *dev);
extern int device_poll(const device_t *dev);
extern void device_speed_changed(void);
extern void device_force_redraw(void);
extern void device_get_name(const device_t *dev, int bus, char *name);
extern int device_has_config(const device_t *dev);
extern const char *device_get_bios_file(const device_t *dev, const char *internal_name, int file_no);
extern int device_is_valid(const device_t *, int m);
extern int device_is_valid(const device_t *, int m);
extern int device_get_config_int(const char *name);
extern int device_get_config_int_ex(const char *s, int dflt_int);
extern int device_get_config_hex16(const char *name);
extern int device_get_config_hex20(const char *name);
extern int device_get_config_mac(const char *name, int dflt_int);
extern void device_set_config_int(const char *s, int val);
extern void device_set_config_hex16(const char *s, int val);
extern void device_set_config_hex20(const char *s, int val);
extern void device_set_config_mac(const char *s, int val);
extern const char *device_get_config_string(const char *name);
extern int device_get_config_int(const char *name);
extern int device_get_config_int_ex(const char *s, int dflt_int);
extern int device_get_config_hex16(const char *name);
extern int device_get_config_hex20(const char *name);
extern int device_get_config_mac(const char *name, int dflt_int);
extern void device_set_config_int(const char *s, int val);
extern void device_set_config_hex16(const char *s, int val);
extern void device_set_config_hex20(const char *s, int val);
extern void device_set_config_mac(const char *s, int val);
extern const char *device_get_config_string(const char *name);
extern const int device_get_instance(void);
#define device_get_config_bios device_get_config_string
extern char * device_get_internal_name(const device_t *d);
extern const char *device_get_internal_name(const device_t *dev);
extern int machine_get_config_int(char *s);
extern char *machine_get_config_string(char *s);
extern int machine_get_config_int(char *s);
extern char *machine_get_config_string(char *s);
#ifdef __cplusplus
}
#endif
#endif /*EMU_DEVICE_H*/
#endif /*EMU_DEVICE_H*/

View File

@@ -1,34 +1,33 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Definitions for the Discord integration module.
* Definitions for the Discord integration module.
*
*
*
* Authors: David Hrdlička, <hrdlickadavid@outlook.com>
* Authors: David Hrdlička, <hrdlickadavid@outlook.com>
*
* Copyright 2019 David Hrdlička.
* Copyright 2019 David Hrdlička.
*/
#ifndef WIN_DISCORD_H
# define WIN_DISCORD_H
#define WIN_DISCORD_H
#ifdef __cplusplus
extern "C"
{
extern "C" {
#endif
extern int discord_loaded;
extern int discord_loaded;
extern int discord_load();
extern void discord_init();
extern void discord_close();
extern void discord_update_activity(int paused);
extern void discord_run_callbacks();
extern int discord_load(void);
extern void discord_init(void);
extern void discord_close(void);
extern void discord_update_activity(int paused);
extern void discord_run_callbacks(void);
#ifdef __cplusplus
}

View File

@@ -0,0 +1,74 @@
/*
* 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.
*
* Header of the emulation of the PC speaker.
*
*
*
* Authors: Jasmine Iwanek <jriwanek@gmail.com/>
*
* Copyright 2022 Jasmine Iwanek
*/
#ifndef DISK_SIZES_H
#define DISK_SIZES_H
#ifdef __cplusplus
extern "C" {
#endif
typedef struct disk_size_t {
int hole;
int sides;
int data_rate;
int encoding;
int rpm;
int tracks;
int sectors; /* For IMG and Japanese FDI only. */
int sector_len; /* For IMG and Japanese FDI only. */
int media_desc;
int spc;
int num_fats;
int spfat;
int root_dir_entries;
} disk_size_t;
static const disk_size_t disk_sizes[14] = {
// clang-format off
#if 0
{ 1, 1, 2, 1, 1, 77, 26, 0, 0, 4, 2, 6, 68 }, /* 250k 8" */
{ 1, 2, 2, 1, 1, 77, 26, 0, 0, 4, 2, 6, 68 }, /* 500k 8" */
{ 1, 1, 2, 1, 1, 77, 8, 3, 0, 1, 2, 2, 192 }, /* 616k 8" */
{ 1, 2, 0, 1, 1, 77, 8, 3, 0, 1, 2, 2, 192 }, /* 1232k 8" */
#endif
{ 0, 1, 2, 1, 0, 40, 8, 2, 0xfe, 2, 2, 1, 64 }, /* 160k */
{ 0, 1, 2, 1, 0, 40, 9, 2, 0xfc, 2, 2, 1, 64 }, /* 180k */
{ 0, 2, 2, 1, 0, 40, 8, 2, 0xff, 2, 2, 1, 112 }, /* 320k */
{ 0, 2, 2, 1, 0, 40, 9, 2, 0xfd, 2, 2, 2, 112 }, /* 360k */
{ 0, 2, 2, 1, 0, 80, 8, 2, 0xfb, 2, 2, 2, 112 }, /* 640k */
{ 0, 2, 2, 1, 0, 80, 9, 2, 0xf9, 2, 2, 3, 112 }, /* 720k */
{ 1, 2, 0, 1, 1, 80, 15, 2, 0xf9, 1, 2, 7, 224 }, /* 1.2M */
{ 1, 2, 0, 1, 1, 77, 8, 3, 0xfe, 1, 2, 2, 192 }, /* 1.25M */
{ 1, 2, 0, 1, 0, 80, 18, 2, 0xf0, 1, 2, 9, 224 }, /* 1.44M */
{ 1, 2, 0, 1, 0, 80, 21, 2, 0xf0, 2, 2, 5, 16 }, /* DMF cluster 1024 */
{ 1, 2, 0, 1, 0, 80, 21, 2, 0xf0, 4, 2, 3, 16 }, /* DMF cluster 2048 */
{ 2, 2, 3, 1, 0, 80, 36, 2, 0xf0, 2, 2, 9, 240 }, /* 2.88M */
{ 0, 64, 0, 0, 0, 96, 32, 2, 0, 0, 0, 0, 0 }, /* ZIP 100 */
{ 0, 64, 0, 0, 0, 239, 32, 2, 0, 0, 0, 0, 0 }, /* ZIP 250 */
#if 0
{ 0, 8, 0, 0, 0, 963, 32, 2, 0, 0, 0, 0, 0 }, /* LS-120 */
{ 0, 32, 0, 0, 0, 262, 56, 2, 0, 0, 0, 0, 0 } /* LS-240 */
#endif
// clang-format on
};
#ifdef __cplusplus
}
#endif
#endif /*DISK_SIZES_H*/

View File

@@ -1,22 +1,22 @@
/*
* VARCem Virtual ARchaeological Computer EMulator.
* An emulator of (mostly) x86-based PC systems and devices,
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
* spanning the era between 1981 and 1995.
* 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 VARCem Project.
* This file is part of the 86Box distribution.
*
* Definitions for the Intel DMA controller.
* Definitions for the Intel DMA controller.
*
*
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
* Sarah Walker, <tommowalker@tommowalker.co.uk>
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
* Sarah Walker, <https://pcem-emulator.co.uk/>
*
* Copyright 2017-2020 Fred N. van Kempen.
* Copyright 2016-2020 Miran Grca.
* Copyright 2008-2020 Sarah Walker.
* Copyright 2017-2020 Fred N. van Kempen.
* Copyright 2016-2020 Miran Grca.
* Copyright 2008-2020 Sarah Walker.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -37,74 +37,85 @@
* USA.
*/
#ifndef EMU_DMA_H
# define EMU_DMA_H
#define EMU_DMA_H
#define DMA_NODATA -1
#define DMA_OVER 0x10000
#define DMA_VERIFY 0x20000
#define DMA_NODATA -1
#define DMA_OVER 0x10000
#define DMA_VERIFY 0x20000
typedef struct {
uint8_t m, mode, page, stat,
stat_rq, command,
ps2_mode, arb_level,
sg_command, sg_status,
ptr0, enabled,
ext_mode, page_l,
page_h, pad;
uint16_t cb, io_addr,
base, transfer_mode;
uint32_t ptr, ptr_cur,
addr,
ab, ac;
int cc, wp,
size, count,
eot;
typedef struct dma_t {
uint8_t m;
uint8_t mode;
uint8_t page;
uint8_t stat;
uint8_t stat_rq;
uint8_t command;
uint8_t ps2_mode;
uint8_t arb_level;
uint8_t sg_command;
uint8_t sg_status;
uint8_t ptr0;
uint8_t enabled;
uint8_t ext_mode;
uint8_t page_l;
uint8_t page_h;
uint8_t pad;
uint16_t cb;
uint16_t io_addr;
uint16_t base;
uint16_t transfer_mode;
uint32_t ptr;
uint32_t ptr_cur;
uint32_t addr;
uint32_t ab;
uint32_t ac;
int cc;
int wp;
int size;
int count;
int eot;
} dma_t;
extern dma_t dma[8];
extern uint8_t dma_e;
extern uint8_t dma_m;
extern dma_t dma[8];
extern uint8_t dma_e;
extern void dma_init(void);
extern void dma16_init(void);
extern void ps2_dma_init(void);
extern void dma_reset(void);
extern int dma_mode(int channel);
extern void readdma0(void);
extern int readdma1(void);
extern uint8_t readdma2(void);
extern int readdma3(void);
extern void dma_init(void);
extern void dma16_init(void);
extern void ps2_dma_init(void);
extern void dma_reset(void);
extern int dma_mode(int channel);
extern void writedma2(uint8_t temp);
extern void readdma0(void);
extern int readdma1(void);
extern uint8_t readdma2(void);
extern int readdma3(void);
extern int dma_get_drq(int channel);
extern void dma_set_drq(int channel, int set);
extern void writedma2(uint8_t temp);
extern int dma_channel_read(int channel);
extern int dma_channel_write(int channel, uint16_t val);
extern int dma_get_drq(int channel);
extern void dma_set_drq(int channel, int set);
extern void dma_alias_set(void);
extern void dma_alias_set_piix(void);
extern void dma_alias_remove(void);
extern void dma_alias_remove_piix(void);
extern int dma_channel_read(int channel);
extern int dma_channel_write(int channel, uint16_t val);
extern void dma_bm_read(uint32_t PhysAddress, uint8_t *DataRead, uint32_t TotalSize, int TransferSize);
extern void dma_bm_write(uint32_t PhysAddress, const uint8_t *DataWrite, uint32_t TotalSize, int TransferSize);
extern void dma_alias_set(void);
extern void dma_alias_set_piix(void);
extern void dma_alias_remove(void);
extern void dma_alias_remove_piix(void);
void dma_set_params(uint8_t advanced, uint32_t mask);
void dma_set_mask(uint32_t mask);
extern void dma_bm_read(uint32_t PhysAddress, uint8_t *DataRead, uint32_t TotalSize, int TransferSize);
extern void dma_bm_write(uint32_t PhysAddress, const uint8_t *DataWrite, uint32_t TotalSize, int TransferSize);
void dma_set_at(uint8_t at);
void dma_set_params(uint8_t advanced, uint32_t mask);
void dma_set_mask(uint32_t mask);
void dma_ext_mode_init(void);
void dma_high_page_init(void);
void dma_set_at(uint8_t at);
void dma_remove_sg(void);
void dma_set_sg_base(uint8_t sg_base);
void dma_ext_mode_init(void);
void dma_high_page_init(void);
void dma_remove_sg(void);
void dma_set_sg_base(uint8_t sg_base);
#endif /*EMU_DMA_H*/
#endif /*EMU_DMA_H*/

View File

@@ -1,203 +1,251 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Implementation of the NEC uPD-765 and compatible floppy disk
* controller.
* Implementation of the NEC uPD-765 and compatible floppy disk
* controller.
*
*
*
* Authors: Sarah Walker, <tommowalker@tommowalker.co.uk>
* Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2008-2020 Sarah Walker.
* Copyright 2016-2020 Miran Grca.
* Copyright 2018-2020 Fred N. van Kempen.
* Copyright 2008-2020 Sarah Walker.
* Copyright 2016-2020 Miran Grca.
* Copyright 2018-2020 Fred N. van Kempen.
*/
#ifndef EMU_FDC_H
# define EMU_FDC_H
#define EMU_FDC_H
extern int fdc_type;
#define FDC_PRIMARY_ADDR 0x03f0
#define FDC_PRIMARY_IRQ 6
#define FDC_PRIMARY_DMA 2
#define FDC_PRIMARY_PCJR_ADDR 0x00f0
#define FDC_PRIMARY_PCJR_IRQ 6
#define FDC_PRIMARY_PCJR_DMA 2
#define FDC_SECONDARY_ADDR 0x0370
#define FDC_SECONDARY_IRQ 6
#define FDC_SECONDARY_DMA 2
#define FDC_TERTIARY_ADDR 0x0360
#define FDC_TERTIARY_IRQ 6
#define FDC_TERTIARY_DMA 2
#define FDC_QUATERNARY_ADDR 0x03e0
#define FDC_QUATERNARY_IRQ 6
#define FDC_QUATERNARY_DMA 2
#define FDC_PRIMARY_ADDR 0x03f0
#define FDC_PRIMARY_IRQ 6
#define FDC_PRIMARY_DMA 2
#define FDC_PRIMARY_PCJR_ADDR 0x00f0
#define FDC_PRIMARY_PCJR_IRQ 6
#define FDC_PRIMARY_PCJR_DMA 2
#define FDC_SECONDARY_ADDR 0x0370
#define FDC_SECONDARY_IRQ 6
#define FDC_SECONDARY_DMA 2
#define FDC_TERTIARY_ADDR 0x0360
#define FDC_TERTIARY_IRQ 6
#define FDC_TERTIARY_DMA 2
#define FDC_QUATERNARY_ADDR 0x03e0
#define FDC_QUATERNARY_IRQ 6
#define FDC_QUATERNARY_DMA 2
#define FDC_FLAG_PCJR 0x01 /* PCjr */
#define FDC_FLAG_DISKCHG_ACTLOW 0x02 /* Amstrad, PS/1, PS/2 ISA */
#define FDC_FLAG_AT 0x04 /* AT+, PS/x */
#define FDC_FLAG_PS1 0x08 /* PS/1, PS/2 ISA */
#define FDC_FLAG_SUPERIO 0x10 /* Super I/O chips */
#define FDC_FLAG_START_RWC_1 0x20 /* W83877F, W83977F */
#define FDC_FLAG_MORE_TRACKS 0x40 /* W83877F, W83977F, PC87306, PC87309 */
#define FDC_FLAG_NSC 0x80 /* PC87306, PC87309 */
#define FDC_FLAG_TOSHIBA 0x100 /* T1000, T1200 */
#define FDC_FLAG_AMSTRAD 0x200 /* Non-AT Amstrad machines */
#define FDC_FLAG_UMC 0x400 /* UMC UM8398 */
#define FDC_FLAG_PCJR 0x01 /* PCjr */
#define FDC_FLAG_DISKCHG_ACTLOW 0x02 /* Amstrad, PS/1, PS/2 ISA */
#define FDC_FLAG_AT 0x04 /* AT+, PS/x */
#define FDC_FLAG_PS1 0x08 /* PS/1, PS/2 ISA */
#define FDC_FLAG_SUPERIO 0x10 /* Super I/O chips */
#define FDC_FLAG_START_RWC_1 0x20 /* W83877F, W83977F */
#define FDC_FLAG_MORE_TRACKS 0x40 /* W83877F, W83977F, PC87306, PC87309 */
#define FDC_FLAG_NSC 0x80 /* PC87306, PC87309 */
#define FDC_FLAG_TOSHIBA 0x100 /* T1000, T1200 */
#define FDC_FLAG_AMSTRAD 0x200 /* Non-AT Amstrad machines */
#define FDC_FLAG_UMC 0x400 /* UMC UM8398 */
#define FDC_FLAG_ALI 0x800 /* ALi M512x / M1543C */
#define FDC_FLAG_SEC 0x1000 /* Is Secondary */
#define FDC_FLAG_TER 0x2000 /* Is Tertiary */
#define FDC_FLAG_QUA 0x3000 /* Is Quaternary */
typedef struct fdc_t {
uint8_t dor;
uint8_t stat;
uint8_t command;
uint8_t processed_cmd;
uint8_t dat;
uint8_t st0;
uint8_t swap;
uint8_t dtl;
uint8_t swwp;
uint8_t disable_write;
uint8_t st5;
uint8_t st6;
uint8_t error;
uint8_t params[8];
uint8_t res[11];
uint8_t specify[2];
uint8_t config;
uint8_t pretrk;
uint8_t fifobuf[16];
typedef struct {
uint8_t dor, stat, command, processed_cmd, dat, st0, swap, dtl;
uint8_t swwp, disable_write, st5, st6, error;
uint8_t params[8], res[11];
uint8_t specify[2];
uint8_t config, pretrk;
uint8_t fifobuf[16];
uint16_t base_address;
uint16_t base_address;
int head;
int sector;
int drive;
int lastdrive;
int pcn[4];
int eot[4];
int rw_track;
int pos;
int pnum;
int ptot;
int rate;
int reset_stat;
int lock;
int perp;
int format_state;
int format_n;
int step;
int seek_dir;
int tc;
int noprec;
int head, sector, drive, lastdrive;
int pcn[4], eot[4];
int rw_track, pos;
int pnum, ptot;
int rate, reset_stat;
int lock, perp;
int format_state, format_n;
int step, seek_dir;
int tc, noprec;
int data_ready;
int inread;
int bitcell_period;
int enh_mode;
int rwc[4];
int drvrate[4];
int boot_drive;
int dma;
int densel_polarity;
int densel_force;
int fifo;
int tfifo;
int fifobufpos;
int drv2en;
int data_ready, inread;
int bitcell_period, enh_mode;
int rwc[4], drvrate[4];
int boot_drive, dma;
int densel_polarity, densel_force;
int fifo, tfifo;
int fifobufpos, drv2en;
int gap;
int enable_3f1;
int format_sectors;
int max_track;
int mfm;
int deleted;
int wrong_am;
int sc;
int satisfying_sectors;
int fintr;
int rw_drive;
int gap;
int enable_3f1, format_sectors;
int max_track, mfm;
int deleted, wrong_am;
int sc, satisfying_sectors;
int fintr, rw_drive;
int flags;
int interrupt;
int flags, interrupt;
int irq; /* Should be 6 by default. */
int dma_ch; /* Should be 2 by default. */
int irq; /* Should be 6 by default. */
int dma_ch; /* Should be 2 by default. */
int bit_rate; /* Should be 250 at start. */
int paramstogo;
int bit_rate; /* Should be 250 at start. */
int paramstogo;
sector_id_t read_track_sector;
sector_id_t format_sector_id;
sector_id_t read_track_sector, format_sector_id;
uint64_t watchdog_count;
uint64_t watchdog_count;
pc_timer_t timer, watchdog_timer;
pc_timer_t timer;
pc_timer_t watchdog_timer;
} fdc_t;
extern void fdc_remove(fdc_t *fdc);
extern void fdc_poll(fdc_t *fdc);
extern void fdc_abort(fdc_t *fdc);
extern void fdc_set_dskchg_activelow(fdc_t *fdc);
extern void fdc_3f1_enable(fdc_t *fdc, int enable);
extern int fdc_get_bit_rate(fdc_t *fdc);
extern int fdc_get_bitcell_period(fdc_t *fdc);
extern void fdc_remove(fdc_t *fdc);
extern void fdc_poll(fdc_t *fdc);
extern void fdc_abort(fdc_t *fdc);
extern void fdc_set_dskchg_activelow(fdc_t *fdc);
extern void fdc_3f1_enable(fdc_t *fdc, int enable);
extern int fdc_get_bit_rate(fdc_t *fdc);
extern int fdc_get_bitcell_period(fdc_t *fdc);
/* A few functions to communicate between Super I/O chips and the FDC. */
extern void fdc_update_enh_mode(fdc_t *fdc, int enh_mode);
extern int fdc_get_rwc(fdc_t *fdc, int drive);
extern void fdc_update_rwc(fdc_t *fdc, int drive, int rwc);
extern int fdc_get_boot_drive(fdc_t *fdc);
extern void fdc_update_boot_drive(fdc_t *fdc, int boot_drive);
extern void fdc_update_densel_polarity(fdc_t *fdc, int densel_polarity);
extern uint8_t fdc_get_densel_polarity(fdc_t *fdc);
extern void fdc_update_densel_force(fdc_t *fdc, int densel_force);
extern void fdc_update_drvrate(fdc_t *fdc, int drive, int drvrate);
extern void fdc_update_drv2en(fdc_t *fdc, int drv2en);
extern void fdc_update_enh_mode(fdc_t *fdc, int enh_mode);
extern int fdc_get_rwc(fdc_t *fdc, int drive);
extern void fdc_update_rwc(fdc_t *fdc, int drive, int rwc);
extern int fdc_get_boot_drive(fdc_t *fdc);
extern void fdc_update_boot_drive(fdc_t *fdc, int boot_drive);
extern void fdc_update_densel_polarity(fdc_t *fdc, int densel_polarity);
extern uint8_t fdc_get_densel_polarity(fdc_t *fdc);
extern void fdc_update_densel_force(fdc_t *fdc, int densel_force);
extern void fdc_update_drvrate(fdc_t *fdc, int drive, int drvrate);
extern void fdc_update_drv2en(fdc_t *fdc, int drv2en);
extern void fdc_noidam(fdc_t *fdc);
extern void fdc_nosector(fdc_t *fdc);
extern void fdc_nodataam(fdc_t *fdc);
extern void fdc_cannotformat(fdc_t *fdc);
extern void fdc_wrongcylinder(fdc_t *fdc);
extern void fdc_badcylinder(fdc_t *fdc);
extern void fdc_writeprotect(fdc_t *fdc);
extern void fdc_datacrcerror(fdc_t *fdc);
extern void fdc_headercrcerror(fdc_t *fdc);
extern void fdc_nosector(fdc_t *fdc);
extern void fdc_noidam(fdc_t *fdc);
extern void fdc_nosector(fdc_t *fdc);
extern void fdc_nodataam(fdc_t *fdc);
extern void fdc_cannotformat(fdc_t *fdc);
extern void fdc_wrongcylinder(fdc_t *fdc);
extern void fdc_badcylinder(fdc_t *fdc);
extern void fdc_writeprotect(fdc_t *fdc);
extern void fdc_datacrcerror(fdc_t *fdc);
extern void fdc_headercrcerror(fdc_t *fdc);
extern void fdc_nosector(fdc_t *fdc);
extern int real_drive(fdc_t *fdc, int drive);
extern int real_drive(fdc_t *fdc, int drive);
extern sector_id_t fdc_get_read_track_sector(fdc_t *fdc);
extern int fdc_get_compare_condition(fdc_t *fdc);
extern int fdc_is_deleted(fdc_t *fdc);
extern int fdc_is_sk(fdc_t *fdc);
extern void fdc_set_wrong_am(fdc_t *fdc);
extern int fdc_get_drive(fdc_t *fdc);
extern int fdc_get_perp(fdc_t *fdc);
extern int fdc_get_format_n(fdc_t *fdc);
extern int fdc_is_mfm(fdc_t *fdc);
extern double fdc_get_hut(fdc_t *fdc);
extern double fdc_get_hlt(fdc_t *fdc);
extern void fdc_request_next_sector_id(fdc_t *fdc);
extern void fdc_stop_id_request(fdc_t *fdc);
extern int fdc_get_gap(fdc_t *fdc);
extern int fdc_get_gap2(fdc_t *fdc, int drive);
extern int fdc_get_dtl(fdc_t *fdc);
extern int fdc_get_format_sectors(fdc_t *fdc);
extern uint8_t fdc_get_swwp(fdc_t *fdc);
extern void fdc_set_swwp(fdc_t *fdc, uint8_t swwp);
extern uint8_t fdc_get_diswr(fdc_t *fdc);
extern void fdc_set_diswr(fdc_t *fdc, uint8_t diswr);
extern uint8_t fdc_get_swap(fdc_t *fdc);
extern void fdc_set_swap(fdc_t *fdc, uint8_t swap);
extern int fdc_get_compare_condition(fdc_t *fdc);
extern int fdc_is_deleted(fdc_t *fdc);
extern int fdc_is_sk(fdc_t *fdc);
extern void fdc_set_wrong_am(fdc_t *fdc);
extern int fdc_get_drive(fdc_t *fdc);
extern int fdc_get_perp(fdc_t *fdc);
extern int fdc_get_format_n(fdc_t *fdc);
extern int fdc_is_mfm(fdc_t *fdc);
extern double fdc_get_hut(fdc_t *fdc);
extern double fdc_get_hlt(fdc_t *fdc);
extern void fdc_request_next_sector_id(fdc_t *fdc);
extern void fdc_stop_id_request(fdc_t *fdc);
extern int fdc_get_gap(fdc_t *fdc);
extern int fdc_get_gap2(fdc_t *fdc, int drive);
extern int fdc_get_dtl(fdc_t *fdc);
extern int fdc_get_format_sectors(fdc_t *fdc);
extern uint8_t fdc_get_swwp(fdc_t *fdc);
extern void fdc_set_swwp(fdc_t *fdc, uint8_t swwp);
extern uint8_t fdc_get_diswr(fdc_t *fdc);
extern void fdc_set_diswr(fdc_t *fdc, uint8_t diswr);
extern uint8_t fdc_get_swap(fdc_t *fdc);
extern void fdc_set_swap(fdc_t *fdc, uint8_t swap);
extern void fdc_finishcompare(fdc_t *fdc, int satisfying);
extern void fdc_finishread(fdc_t *fdc);
extern void fdc_sector_finishcompare(fdc_t *fdc, int satisfying);
extern void fdc_sector_finishread(fdc_t *fdc);
extern void fdc_track_finishread(fdc_t *fdc, int condition);
extern int fdc_is_verify(fdc_t *fdc);
extern void fdc_finishcompare(fdc_t *fdc, int satisfying);
extern void fdc_finishread(fdc_t *fdc);
extern void fdc_sector_finishcompare(fdc_t *fdc, int satisfying);
extern void fdc_sector_finishread(fdc_t *fdc);
extern void fdc_track_finishread(fdc_t *fdc, int condition);
extern int fdc_is_verify(fdc_t *fdc);
extern void fdc_overrun(fdc_t *fdc);
extern void fdc_set_base(fdc_t *fdc, int base);
extern void fdc_set_irq(fdc_t *fdc, int irq);
extern void fdc_set_dma_ch(fdc_t *fdc, int dma_ch);
extern int fdc_getdata(fdc_t *fdc, int last);
extern int fdc_data(fdc_t *fdc, uint8_t data, int last);
extern void fdc_overrun(fdc_t *fdc);
extern void fdc_set_base(fdc_t *fdc, int base);
extern void fdc_set_irq(fdc_t *fdc, int irq);
extern void fdc_set_dma_ch(fdc_t *fdc, int dma_ch);
extern int fdc_getdata(fdc_t *fdc, int last);
extern int fdc_data(fdc_t *fdc, uint8_t data, int last);
extern void fdc_sectorid(fdc_t *fdc, uint8_t track, uint8_t side,
uint8_t sector, uint8_t size, uint8_t crc1,
uint8_t crc2);
extern void fdc_sectorid(fdc_t *fdc, uint8_t track, uint8_t side,
uint8_t sector, uint8_t size, uint8_t crc1,
uint8_t crc2);
extern uint8_t fdc_read(uint16_t addr, void *priv);
extern void fdc_reset(void *priv);
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 uint8_t fdc_get_current_drive(void);
#ifdef EMU_DEVICE_H
extern const device_t fdc_xt_device;
extern const device_t fdc_xt_t1x00_device;
extern const device_t fdc_xt_tandy_device;
extern const device_t fdc_xt_amstrad_device;
extern const device_t fdc_pcjr_device;
extern const device_t fdc_at_device;
extern const device_t fdc_at_actlow_device;
extern const device_t fdc_at_ps1_device;
extern const device_t fdc_at_smc_device;
extern const device_t fdc_at_winbond_device;
extern const device_t fdc_at_nsc_device;
extern const device_t fdc_dp8473_device;
extern const device_t fdc_um8398_device;
extern const device_t fdc_xt_device;
extern const device_t fdc_xt_sec_device;
extern const device_t fdc_xt_ter_device;
extern const device_t fdc_xt_qua_device;
extern const device_t fdc_xt_t1x00_device;
extern const device_t fdc_xt_tandy_device;
extern const device_t fdc_xt_amstrad_device;
extern const device_t fdc_pcjr_device;
extern const device_t fdc_at_device;
extern const device_t fdc_at_sec_device;
extern const device_t fdc_at_ter_device;
extern const device_t fdc_at_qua_device;
extern const device_t fdc_at_actlow_device;
extern const device_t fdc_at_ps1_device;
extern const device_t fdc_at_smc_device;
extern const device_t fdc_at_ali_device;
extern const device_t fdc_at_winbond_device;
extern const device_t fdc_at_nsc_device;
extern const device_t fdc_dp8473_device;
extern const device_t fdc_um8398_device;
#endif
#endif /*EMU_FDC_H*/
#endif /*EMU_FDC_H*/

View File

@@ -1,42 +1,44 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Implementation of the NEC uPD-765 and compatible floppy disk
* controller.
* Implementation of the NEC uPD-765 and compatible floppy disk
* controller.
*
*
*
* Authors: Sarah Walker, <tommowalker@tommowalker.co.uk>
* Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2008-2020 Sarah Walker.
* Copyright 2016-2020 Miran Grca.
* Copyright 2018-2020 Fred N. van Kempen.
* Copyright 2008-2020 Sarah Walker.
* Copyright 2016-2020 Miran Grca.
* Copyright 2018-2020 Fred N. van Kempen.
*/
#ifndef EMU_FDC_EXT_H
# define EMU_FDC_EXT_H
#define EMU_FDC_EXT_H
extern int fdc_type;
/* Controller types. */
#define FDC_INTERNAL 0
#define FDC_INTERNAL 0
extern const device_t fdc_b215_device;
extern const device_t fdc_pii151b_device;
extern const device_t fdc_pii158b_device;
extern const device_t fdc_monster_device;
extern void fdc_card_init(void);
extern char *fdc_card_get_internal_name(int card);
extern int fdc_card_get_from_internal_name(char *s);
extern const char *fdc_card_get_internal_name(int card);
extern int fdc_card_get_from_internal_name(char *s);
extern const device_t *fdc_card_getdevice(int card);
extern int fdc_card_has_config(int card);
extern int fdc_card_available(int card);
extern int fdc_card_has_config(int card);
extern int fdc_card_available(int card);
#endif /*EMU_FDC_H*/
#endif /*EMU_FDC_H*/

View File

@@ -1,196 +1,193 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Definitions for the floppy drive emulation.
* Definitions for the floppy drive emulation.
*
*
*
* Authors: Sarah Walker, <tommowalker@tommowalker.co.uk>
* Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2008-2018 Sarah Walker.
* Copyright 2016-2018 Miran Grca.
* Copyright 2018 Fred N. van Kempen.
* Copyright 2008-2018 Sarah Walker.
* Copyright 2016-2018 Miran Grca.
* Copyright 2018 Fred N. van Kempen.
*/
#ifndef EMU_FDD_H
# define EMU_FDD_H
#define FDD_NUM 4
#define SEEK_RECALIBRATE -999
#define EMU_FDD_H
#define FDD_NUM 4
#define FLOPPY_IMAGE_HISTORY 4
#define SEEK_RECALIBRATE -999
#ifdef __cplusplus
extern "C" {
#endif
extern int fdd_swap;
extern int fdd_swap;
extern void fdd_set_motor_enable(int drive, int motor_enable);
extern void fdd_do_seek(int drive, int track);
extern void fdd_forced_seek(int drive, int track_diff);
extern void fdd_seek(int drive, int track_diff);
extern int fdd_track0(int drive);
extern int fdd_getrpm(int drive);
extern void fdd_set_densel(int densel);
extern int fdd_can_read_medium(int drive);
extern int fdd_doublestep_40(int drive);
extern int fdd_is_525(int drive);
extern int fdd_is_dd(int drive);
extern int fdd_is_ed(int drive);
extern int fdd_is_double_sided(int drive);
extern void fdd_set_head(int drive, int head);
extern int fdd_get_head(int drive);
extern void fdd_set_turbo(int drive, int turbo);
extern int fdd_get_turbo(int drive);
extern void fdd_set_check_bpb(int drive, int check_bpb);
extern int fdd_get_check_bpb(int drive);
extern void fdd_set_motor_enable(int drive, int motor_enable);
extern void fdd_do_seek(int drive, int track);
extern void fdd_forced_seek(int drive, int track_diff);
extern void fdd_seek(int drive, int track_diff);
extern int fdd_track0(int drive);
extern int fdd_getrpm(int drive);
extern void fdd_set_densel(int densel);
extern int fdd_can_read_medium(int drive);
extern int fdd_doublestep_40(int drive);
extern int fdd_is_525(int drive);
extern int fdd_is_dd(int drive);
extern int fdd_is_hd(int drive);
extern int fdd_is_ed(int drive);
extern int fdd_is_double_sided(int drive);
extern void fdd_set_head(int drive, int head);
extern int fdd_get_head(int drive);
extern void fdd_set_turbo(int drive, int turbo);
extern int fdd_get_turbo(int drive);
extern void fdd_set_check_bpb(int drive, int check_bpb);
extern int fdd_get_check_bpb(int drive);
extern void fdd_set_type(int drive, int type);
extern int fdd_get_type(int drive);
extern void fdd_set_type(int drive, int type);
extern int fdd_get_type(int drive);
extern int fdd_get_flags(int drive);
extern int fdd_get_densel(int drive);
extern int fdd_get_flags(int drive);
extern int fdd_get_densel(int drive);
extern char *fdd_getname(int type);
extern char *fdd_getname(int type);
extern char *fdd_get_internal_name(int type);
extern int fdd_get_from_internal_name(char *s);
extern char *fdd_get_internal_name(int type);
extern int fdd_get_from_internal_name(char *s);
extern int fdd_current_track(int drive);
extern int fdd_current_track(int drive);
typedef struct DRIVE {
int id;
typedef struct {
int id;
void (*seek)(int drive, int track);
void (*readsector)(int drive, int sector, int track, int side,
int density, int sector_size);
void (*writesector)(int drive, int sector, int track, int side,
int density, int sector_size);
void (*comparesector)(int drive, int sector, int track, int side,
int density, int sector_size);
void (*readaddress)(int drive, int side, int density);
void (*format)(int drive, int side, int density, uint8_t fill);
int (*hole)(int drive);
uint64_t (*byteperiod)(int drive);
void (*stop)(int drive);
void (*poll)(int drive);
void (*seek)(int drive, int track);
void (*readsector)(int drive, int sector, int track, int side,
int density, int sector_size);
void (*writesector)(int drive, int sector, int track, int side,
int density, int sector_size);
void (*comparesector)(int drive, int sector, int track, int side,
int density, int sector_size);
void (*readaddress)(int drive, int side, int density);
void (*format)(int drive, int side, int density, uint8_t fill);
int (*hole)(int drive);
uint64_t (*byteperiod)(int drive);
void (*stop)(int drive);
void (*poll)(int drive);
} DRIVE;
extern DRIVE drives[FDD_NUM];
extern char floppyfns[FDD_NUM][512];
extern char *fdd_image_history[FDD_NUM][FLOPPY_IMAGE_HISTORY];
extern pc_timer_t fdd_poll_time[FDD_NUM];
extern int ui_writeprot[FDD_NUM];
extern DRIVE drives[FDD_NUM];
extern char floppyfns[FDD_NUM][512];
extern pc_timer_t fdd_poll_time[FDD_NUM];
extern int ui_writeprot[FDD_NUM];
extern int curdrive;
extern int curdrive;
extern int fdd_time;
extern int64_t floppytime;
extern int fdd_time;
extern int64_t floppytime;
extern void fdd_load(int drive, char *fn);
extern void fdd_new(int drive, char *fn);
extern void fdd_close(int drive);
extern void fdd_init(void);
extern void fdd_reset(void);
extern void fdd_seek(int drive, int track);
extern void fdd_readsector(int drive, int sector, int track,
int side, int density, int sector_size);
extern void fdd_writesector(int drive, int sector, int track,
int side, int density, int sector_size);
extern void fdd_comparesector(int drive, int sector, int track,
int side, int density, int sector_size);
extern void fdd_readaddress(int drive, int side, int density);
extern void fdd_format(int drive, int side, int density, uint8_t fill);
extern int fdd_hole(int drive);
extern void fdd_stop(int drive);
extern void fdd_do_writeback(int drive);
extern int motorspin;
extern uint64_t motoron[FDD_NUM];
extern void fdd_load(int drive, char *fn);
extern void fdd_new(int drive, char *fn);
extern void fdd_close(int drive);
extern void fdd_init(void);
extern void fdd_reset(void);
extern void fdd_seek(int drive, int track);
extern void fdd_readsector(int drive, int sector, int track,
int side, int density, int sector_size);
extern void fdd_writesector(int drive, int sector, int track,
int side, int density, int sector_size);
extern void fdd_comparesector(int drive, int sector, int track,
int side, int density, int sector_size);
extern void fdd_readaddress(int drive, int side, int density);
extern void fdd_format(int drive, int side, int density, uint8_t fill);
extern int fdd_hole(int drive);
extern void fdd_stop(int drive);
extern void fdd_do_writeback(int drive);
extern int swwp;
extern int disable_write;
extern int motorspin;
extern uint64_t motoron[FDD_NUM];
extern int defaultwriteprot;
extern int swwp;
extern int disable_write;
extern int defaultwriteprot;
extern int writeprot[FDD_NUM], fwriteprot[FDD_NUM];
extern int fdd_changed[FDD_NUM];
extern int drive_empty[FDD_NUM];
extern int writeprot[FDD_NUM];
extern int fwriteprot[FDD_NUM];
extern int fdd_changed[FDD_NUM];
extern int drive_empty[FDD_NUM];
/*Used in the Read A Track command. Only valid for fdd_readsector(). */
#define SECTOR_FIRST -2
#define SECTOR_NEXT -1
typedef union {
uint16_t word;
uint8_t bytes[2];
uint16_t word;
uint8_t bytes[2];
} crc_t;
void fdd_calccrc(uint8_t byte, crc_t *crc_var);
typedef struct {
uint16_t (*disk_flags)(int drive);
uint16_t (*side_flags)(int drive);
void (*writeback)(int drive);
void (*set_sector)(int drive, int side, uint8_t c, uint8_t h,
uint8_t r, uint8_t n);
uint8_t (*read_data)(int drive, int side, uint16_t pos);
void (*write_data)(int drive, int side, uint16_t pos,
uint8_t data);
int (*format_conditions)(int drive);
int32_t (*extra_bit_cells)(int drive, int side);
uint16_t* (*encoded_data)(int drive, int side);
void (*read_revolution)(int drive);
uint32_t (*index_hole_pos)(int drive, int side);
uint32_t (*get_raw_size)(int drive, int side);
typedef struct d86f_handler_t {
uint16_t (*disk_flags)(int drive);
uint16_t (*side_flags)(int drive);
void (*writeback)(int drive);
void (*set_sector)(int drive, int side, uint8_t c, uint8_t h,
uint8_t r, uint8_t n);
uint8_t (*read_data)(int drive, int side, uint16_t pos);
void (*write_data)(int drive, int side, uint16_t pos,
uint8_t data);
int (*format_conditions)(int drive);
int32_t (*extra_bit_cells)(int drive, int side);
uint16_t *(*encoded_data)(int drive, int side);
void (*read_revolution)(int drive);
uint32_t (*index_hole_pos)(int drive, int side);
uint32_t (*get_raw_size)(int drive, int side);
uint8_t check_crc;
} d86f_handler_t;
extern const int gap3_sizes[5][8][48];
extern const int gap3_sizes[5][8][48];
extern const uint8_t dmf_r[21];
extern const uint8_t xdf_physical_sectors[2][2];
extern const uint8_t xdf_gap3_sizes[2][2];
extern const uint16_t xdf_trackx_spos[2][8];
extern const uint8_t dmf_r[21];
extern const uint8_t xdf_physical_sectors[2][2];
extern const uint8_t xdf_gap3_sizes[2][2];
extern const uint16_t xdf_trackx_spos[2][8];
typedef struct {
uint8_t h;
uint8_t r;
typedef struct xdf_id_t {
uint8_t h;
uint8_t r;
} xdf_id_t;
typedef union {
uint16_t word;
xdf_id_t id;
uint16_t word;
xdf_id_t id;
} xdf_sector_t;
extern const xdf_sector_t xdf_img_layout[2][2][46];
extern const xdf_sector_t xdf_disk_layout[2][2][38];
typedef struct {
uint8_t c;
uint8_t h;
uint8_t r;
uint8_t n;
typedef struct sector_id_fields_t {
uint8_t c;
uint8_t h;
uint8_t r;
uint8_t n;
} sector_id_fields_t;
typedef union {
uint32_t dword;
uint8_t byte_array[4];
typedef union sector_id_t {
uint32_t dword;
uint8_t byte_array[4];
sector_id_fields_t id;
} sector_id_t;
void d86f_set_fdc(void *fdc);
void fdi_set_fdc(void *fdc);
void fdd_set_fdc(void *fdc);
@@ -198,10 +195,8 @@ void imd_set_fdc(void *fdc);
void img_set_fdc(void *fdc);
void mfm_set_fdc(void *fdc);
#ifdef __cplusplus
}
#endif
#endif /*EMU_FDD_H*/
#endif /*EMU_FDD_H*/

View File

@@ -1,110 +1,106 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Definitions for the 86F floppy image format.
* Definitions for the 86F floppy image format.
*
*
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
* Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2016-2019 Miran Grca.
* Copyright 2018,2019 Fred N. van Kempen.
* Copyright 2016-2019 Miran Grca.
* Copyright 2018-2019 Fred N. van Kempen.
*/
#ifndef EMU_FLOPPY_86F_H
# define EMU_FLOPPY_86F_H
#define EMU_FLOPPY_86F_H
#define D86FVER 0x020C
#define D86FVER 0x020C
/* Thesere were borrowed from TeleDisk. */
#define SECTOR_DUPLICATED 0x01
#define SECTOR_CRC_ERROR 0x02
#define SECTOR_DELETED_DATA 0x04
#define SECTOR_DATA_SKIPPED 0x10
#define SECTOR_NO_DATA 0x20
#define SECTOR_NO_ID 0x40
#define SECTOR_DUPLICATED 0x01
#define SECTOR_CRC_ERROR 0x02
#define SECTOR_DELETED_DATA 0x04
#define SECTOR_DATA_SKIPPED 0x10
#define SECTOR_NO_DATA 0x20
#define SECTOR_NO_ID 0x40
#define length_gap0 80
#define length_gap1 50
#define length_sync 12
#define length_am 4
#define length_crc 2
#define length_gap0 80
#define length_gap1 50
#define length_sync 12
#define length_am 4
#define length_crc 2
#define IBM
#define MFM
#ifdef IBM
#define pre_gap1 length_gap0 + length_sync + length_am
# define pre_gap1 length_gap0 + length_sync + length_am
#else
#define pre_gap1 0
# define pre_gap1 0
#endif
#define pre_track pre_gap1 + length_gap1
#define pre_gap length_sync + length_am + 4 + length_crc
#define pre_data length_sync + length_am
#define post_gap length_crc
#define pre_track pre_gap1 + length_gap1
#define pre_gap length_sync + length_am + 4 + length_crc
#define pre_data length_sync + length_am
#define post_gap length_crc
extern d86f_handler_t d86f_handler[FDD_NUM];
extern d86f_handler_t d86f_handler[FDD_NUM];
extern void d86f_init(void);
extern void d86f_load(int drive, char *fn);
extern void d86f_close(int drive);
extern void d86f_seek(int drive, int track);
extern int d86f_hole(int drive);
extern uint64_t d86f_byteperiod(int drive);
extern void d86f_stop(int drive);
extern void d86f_poll(int drive);
extern int d86f_realtrack(int track, int drive);
extern void d86f_reset(int drive, int side);
extern void d86f_readsector(int drive, int sector, int track, int side, int density, int sector_size);
extern void d86f_writesector(int drive, int sector, int track, int side, int density, int sector_size);
extern void d86f_comparesector(int drive, int sector, int track, int side, int rate, int sector_size);
extern void d86f_readaddress(int drive, int side, int density);
extern void d86f_format(int drive, int side, int density, uint8_t fill);
extern void d86f_init(void);
extern void d86f_load(int drive, char *fn);
extern void d86f_close(int drive);
extern void d86f_seek(int drive, int track);
extern int d86f_hole(int drive);
extern uint64_t d86f_byteperiod(int drive);
extern void d86f_stop(int drive);
extern void d86f_poll(int drive);
extern int d86f_realtrack(int track, int drive);
extern void d86f_reset(int drive, int side);
extern void d86f_readsector(int drive, int sector, int track, int side, int density, int sector_size);
extern void d86f_writesector(int drive, int sector, int track, int side, int density, int sector_size);
extern void d86f_comparesector(int drive, int sector, int track, int side, int rate, int sector_size);
extern void d86f_readaddress(int drive, int side, int density);
extern void d86f_format(int drive, int side, int density, uint8_t fill);
extern void d86f_prepare_track_layout(int drive, int side);
extern void d86f_set_version(int drive, uint16_t version);
extern uint16_t d86f_side_flags(int drive);
extern uint16_t d86f_track_flags(int drive);
extern void d86f_initialize_last_sector_id(int drive, int c, int h, int r, int n);
extern void d86f_initialize_linked_lists(int drive);
extern void d86f_destroy_linked_lists(int drive, int side);
extern void d86f_prepare_track_layout(int drive, int side);
extern void d86f_set_version(int drive, uint16_t version);
extern uint16_t d86f_side_flags(int drive);
extern uint16_t d86f_track_flags(int drive);
extern void d86f_initialize_last_sector_id(int drive, int c, int h, int r, int n);
extern void d86f_initialize_linked_lists(int drive);
extern void d86f_destroy_linked_lists(int drive, int side);
extern uint16_t 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);
extern void d86f_setup(int drive);
extern void d86f_destroy(int drive);
extern int d86f_export(int drive, char *fn);
extern void d86f_unregister(int drive);
extern void d86f_common_handlers(int drive);
extern void d86f_set_version(int drive, uint16_t version);
extern int d86f_is_40_track(int drive);
extern void d86f_reset_index_hole_pos(int drive, int side);
extern uint16_t d86f_prepare_pretrack(int drive, int side, int iso);
extern void d86f_set_track_pos(int drive, uint32_t track_pos);
extern void d86f_set_cur_track(int drive, int track);
extern void d86f_zero_track(int drive);
extern void d86f_initialize_last_sector_id(int drive, int c, int h, int r, int n);
extern void d86f_initialize_linked_lists(int drive);
extern void d86f_destroy_linked_lists(int drive, int side);
extern uint16_t 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);
extern void d86f_setup(int drive);
extern void d86f_destroy(int drive);
extern int d86f_export(int drive, char *fn);
extern void d86f_unregister(int drive);
extern void d86f_common_handlers(int drive);
extern void d86f_set_version(int drive, uint16_t version);
extern int d86f_is_40_track(int drive);
extern void d86f_reset_index_hole_pos(int drive, int side);
extern uint16_t d86f_prepare_pretrack(int drive, int side, int iso);
extern void d86f_set_track_pos(int drive, uint32_t track_pos);
extern void d86f_set_cur_track(int drive, int track);
extern void d86f_zero_track(int drive);
extern void d86f_initialize_last_sector_id(int drive, int c, int h, int r, int n);
extern void d86f_initialize_linked_lists(int drive);
extern void d86f_destroy_linked_lists(int drive, int side);
extern uint16_t *common_encoded_data(int drive, int side);
extern void common_read_revolution(int drive);
extern uint32_t common_get_raw_size(int drive, int side);
extern uint16_t *common_encoded_data(int drive, int side);
extern void common_read_revolution(int drive);
extern uint32_t common_get_raw_size(int drive, int side);
extern void null_writeback(int drive);
extern void null_write_data(int drive, int side, uint16_t pos, uint8_t data);
extern int null_format_conditions(int drive);
extern int32_t null_extra_bit_cells(int drive, int side);
extern void null_set_sector(int drive, int side, uint8_t c, uint8_t h, uint8_t r, uint8_t n);
extern uint32_t null_index_hole_pos(int drive, int side);
extern void null_writeback(int drive);
extern void null_write_data(int drive, int side, uint16_t pos, uint8_t data);
extern int null_format_conditions(int drive);
extern int32_t null_extra_bit_cells(int drive, int side);
extern void null_set_sector(int drive, int side, uint8_t c, uint8_t h, uint8_t r, uint8_t n);
extern uint32_t null_index_hole_pos(int drive, int side);
#endif /*EMU_FLOPPY_86F_H*/
#endif /*EMU_FLOPPY_86F_H*/

View File

@@ -1,35 +1,32 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Shared code for all the floppy modules.
* Shared code for all the floppy modules.
*
*
*
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2017,2018 Fred N. van Kempen.
* Copyright 2017-2018 Fred N. van Kempen.
*/
#ifndef FDD_COMMON_H
# define FDD_COMMON_H
#define FDD_COMMON_H
extern const uint8_t fdd_holes[6];
extern const uint8_t fdd_rates[6];
extern const double fdd_bit_rates_300[6];
extern const uint8_t fdd_max_sectors[8][6];
extern const uint8_t fdd_dmf_r[21];
extern const uint8_t fdd_holes[6];
extern const uint8_t fdd_rates[6];
extern const double fdd_bit_rates_300[6];
extern const uint8_t fdd_max_sectors[8][6];
extern const uint8_t fdd_dmf_r[21];
extern int fdd_get_gap3_size(int rate, int size, int sector);
extern uint8_t fdd_sector_size_code(int size);
extern int fdd_sector_code_size(uint8_t code);
extern int fdd_bps_valid(uint16_t bps);
extern int fdd_interleave(int sector, int skew, int spt);
extern int fdd_get_gap3_size(int rate, int size, int sector);
extern uint8_t fdd_sector_size_code(int size);
extern int fdd_sector_code_size(uint8_t code);
extern int fdd_bps_valid(uint16_t bps);
extern int fdd_interleave(int sector, int skew, int spt);
#endif /*FDD_COMMON_H*/
#endif /*FDD_COMMON_H*/

View File

@@ -1,31 +1,29 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Implementation of the FDI floppy stream image format
* interface to the FDI2RAW module.
* Implementation of the FDI floppy stream image format
* interface to the FDI2RAW module.
*
*
*
* Authors: Sarah Walker, <tommowalker@tommowalker.co.uk>
* Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2008-2018 Sarah Walker.
* Copyright 2016-2018 Miran Grca.
* Copyright 2018 Fred N. van Kempen.
* Copyright 2008-2018 Sarah Walker.
* Copyright 2016-2018 Miran Grca.
* Copyright 2018 Fred N. van Kempen.
*/
#ifndef EMU_FLOPPY_FDI_H
# define EMU_FLOPPY_FDI_H
#define EMU_FLOPPY_FDI_H
extern void fdi_seek(int drive, int track);
extern void fdi_load(int drive, char *fn);
extern void fdi_close(int drive);
extern void fdi_seek(int drive, int track);
extern void fdi_load(int drive, char *fn);
extern void fdi_close(int drive);
#endif /*EMU_FLOPPY_FDI_H*/
#endif /*EMU_FLOPPY_FDI_H*/

View File

@@ -1,20 +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.
* 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.
* This file is part of the 86Box distribution.
*
* Definitions for the IMD floppy image format.
* Definitions for the IMD floppy image format.
*
*
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
* Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2016-2018 Miran Grca.
* Copyright 2018 Fred N. van Kempen.
* Copyright 2016-2018 Miran Grca.
* Copyright 2018 Fred N. van Kempen.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -35,12 +35,10 @@
* USA.
*/
#ifndef EMU_FLOPPY_IMD_H
# define EMU_FLOPPY_IMD_H
#define EMU_FLOPPY_IMD_H
extern void imd_init(void);
extern void imd_load(int drive, char *fn);
extern void imd_close(int drive);
#endif /*EMU_FLOPPY_IMD_H*/
#endif /*EMU_FLOPPY_IMD_H*/

View File

@@ -1,31 +1,29 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Implementation of the raw sector-based floppy image format,
* as well as the Japanese FDI, CopyQM, and FDF formats.
* Implementation of the raw sector-based floppy image format,
* as well as the Japanese FDI, CopyQM, and FDF formats.
*
*
*
* Authors: Sarah Walker, <tommowalker@tommowalker.co.uk>
* Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2008-2018 Sarah Walker.
* Copyright 2016-2018 Miran Grca.
* Copyright 2018 Fred N. van Kempen.
* Copyright 2008-2018 Sarah Walker.
* Copyright 2016-2018 Miran Grca.
* Copyright 2018 Fred N. van Kempen.
*/
#ifndef EMU_FLOPPY_IMG_H
# define EMU_FLOPPY_IMG_H
#define EMU_FLOPPY_IMG_H
extern void img_init(void);
extern void img_load(int drive, char *fn);
extern void img_close(int drive);
extern void img_init(void);
extern void img_load(int drive, char *fn);
extern void img_close(int drive);
#endif /*EMU_FLOPPY_IMG_H*/
#endif /*EMU_FLOPPY_IMG_H*/

View File

@@ -1,36 +1,34 @@
/*
* VARCem Virtual ARchaeological Computer EMulator.
* An emulator of (mostly) x86-based PC systems and devices,
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
* spanning the era between 1981 and 1995.
* VARCem Virtual ARchaeological Computer EMulator.
* An emulator of (mostly) x86-based PC systems and devices,
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
* spanning the era between 1981 and 1995.
*
* This file is part of the VARCem Project.
*
* Definitions for the PCjs JSON floppy image format.
* Definitions for the PCjs JSON floppy image format.
*
*
*
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2017,2018 Fred N. van Kempen.
* Copyright 2017-2018 Fred N. van Kempen.
*
* Redistribution and use in source and binary forms, with
* or without modification, are permitted provided that the
* following conditions are met:
* Redistribution and use in source and binary forms, with
* or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the entire
* above notice, this list of conditions and the following
* disclaimer.
* 1. Redistributions of source code must retain the entire
* above notice, this list of conditions and the following
* disclaimer.
*
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names
* of its contributors may be used to endorse or promote
* products derived from this software without specific
* prior written permission.
* 3. Neither the name of the copyright holder nor the names
* of its contributors may be used to endorse or promote
* products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
@@ -45,12 +43,10 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef EMU_FLOPPY_JSON_H
# define EMU_FLOPPY_JSON_H
#define EMU_FLOPPY_JSON_H
extern void json_init(void);
extern void json_load(int drive, char *fn);
extern void json_close(int drive);
extern void json_init(void);
extern void json_load(int drive, char *fn);
extern void json_close(int drive);
#endif /*EMU_FLOPPY_JSON_H*/
#endif /*EMU_FLOPPY_JSON_H*/

View File

@@ -1,26 +1,24 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Implementation of the HxC MFM image format.
* Implementation of the HxC MFM image format.
*
*
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Authors: Miran Grca, <mgrca8@gmail.com>
*
* Copyright 2018 Miran Grca.
* Copyright 2018 Miran Grca.
*/
#ifndef EMU_FLOPPY_MFM_H
# define EMU_FLOPPY_MFM_H
#define EMU_FLOPPY_MFM_H
extern void mfm_seek(int drive, int track);
extern void mfm_load(int drive, char *fn);
extern void mfm_close(int drive);
extern void mfm_seek(int drive, int track);
extern void mfm_load(int drive, char *fn);
extern void mfm_close(int drive);
#endif /*EMU_FLOPPY_MFM_H*/
#endif /*EMU_FLOPPY_MFM_H*/

View File

@@ -1,28 +1,26 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Definitions for the Teledisk floppy image format.
* Definitions for the Teledisk floppy image format.
*
*
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
* Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2016-2018 Miran Grca.
* Copyright 2017,2018 Fred N. van Kempen.
* Copyright 2016-2018 Miran Grca.
* Copyright 2017-2018 Fred N. van Kempen.
*/
#ifndef EMU_FLOPPY_TD0_H
# define EMU_FLOPPY_TD0_H
#define EMU_FLOPPY_TD0_H
extern void td0_init(void);
extern void td0_load(int drive, char *fn);
extern void td0_close(int drive);
#endif /*EMU_FLOPPY_TD0_H*/
#endif /*EMU_FLOPPY_TD0_H*/

73
src/include/86box/fifo.h Normal file
View File

@@ -0,0 +1,73 @@
/*
* 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.
*
* FIFO infrastructure header.
*
* Authors: Miran Grca, <mgrca8@gmail.com>
*
* Copyright 2023 Miran Grca.
*/
#define FIFO(size) \
typedef struct { \
int start; \
int end; \
int trigger_len; \
int len; \
int empty; \
int overrun; \
int full; \
int ready; \
int d_empty; \
int d_overrun; \
int d_full; \
int d_ready; \
\
void *priv; \
\
void (*d_empty_evt)(void *); \
void (*d_overrun_evt)(void *); \
void (*d_full_evt)(void *); \
void (*d_ready_evt)(void *); \
\
uint8_t buf[size]; \
} fifo## size ##_t;
FIFO()
FIFO(16)
#define fifo16_init() fifo_init(16)
FIFO(64)
#define fifo64_init() fifo_init(64)
extern int fifo_get_count(void *priv);
extern void fifo_write(uint8_t val, void *priv);
extern void fifo_write_evt(uint8_t val, void *priv);
extern uint8_t fifo_read(void *priv);
extern uint8_t fifo_read_evt(void *priv);
extern void fifo_clear_overrun(void *priv);
extern int fifo_get_full(void *priv);
extern int fifo_get_d_full(void *priv);
extern int fifo_get_empty(void *priv);
extern int fifo_get_d_empty(void *priv);
extern int fifo_get_overrun(void *priv);
extern int fifo_get_d_overrun(void *priv);
extern int fifo_get_ready(void *priv);
extern int fifo_get_d_ready(void *priv);
extern int fifo_get_trigger_len(void *priv);
extern void fifo_set_trigger_len(void *priv, int trigger_len);
extern void fifo_set_len(void *priv, int len);
extern void fifo_set_d_full_evt(void *priv, void (*d_full_evt)(void *));
extern void fifo_set_d_empty_evt(void *priv, void (*d_empty_evt)(void *));
extern void fifo_set_d_overrun_evt(void *priv, void (*d_overrun_evt)(void *));
extern void fifo_set_d_ready_evt(void *priv, void (*d_ready_evt)(void *));
extern void fifo_set_priv(void *priv, void *sub_priv);
extern void fifo_reset(void *priv);
extern void fifo_reset_evt(void *priv);
extern void fifo_close(void *priv);
extern void *fifo_init(int len);

View File

@@ -1,8 +1,7 @@
#ifndef EMU_FIFO8_H
#define EMU_FIFO8_H
typedef struct {
typedef struct Fifo8 {
/* All fields are private */
uint8_t *data;
uint32_t capacity;
@@ -26,7 +25,7 @@ extern void fifo8_create(Fifo8 *fifo, uint32_t capacity);
* @fifo: FIFO to cleanup
*
* Cleanup a FIFO created with fifo8_create(). Frees memory created for FIFO
*storage. The FIFO is no longer usable after this has been called.
*storage. The FIFO is no longer usable after this has been called.
*/
extern void fifo8_destroy(Fifo8 *fifo);

View File

@@ -1,132 +1,143 @@
#ifndef EMU_FILTERS_H
#define EMU_FILTERS_H
#define NCoef 2
/* fc=150Hz */
static inline float adgold_highpass_iir(int i, float NewSample) {
float ACoef[NCoef+1] = {
static inline float
adgold_highpass_iir(int i, float NewSample)
{
float ACoef[NCoef + 1] = {
0.98657437157334349000,
-1.97314874314668700000,
0.98657437157334349000
};
float BCoef[NCoef+1] = {
float BCoef[NCoef + 1] = {
1.00000000000000000000,
-1.97223372919758360000,
0.97261396931534050000
};
static float y[2][NCoef+1]; /* output samples */
static float x[2][NCoef+1]; /* input samples */
int n;
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[i][n] = x[i][n-1];
y[i][n] = y[i][n-1];
for (n = NCoef; n > 0; n--) {
x[i][n] = x[i][n - 1];
y[i][n] = y[i][n - 1];
}
/* Calculate the new output */
x[i][0] = NewSample;
y[i][0] = ACoef[0] * x[i][0];
for(n=1; n<=NCoef; n++)
for (n = 1; n <= NCoef; n++)
y[i][0] += ACoef[n] * x[i][n] - BCoef[n] * y[i][n];
return y[i][0];
}
/* fc=150Hz */
static inline float adgold_lowpass_iir(int i, float NewSample) {
float ACoef[NCoef+1] = {
static inline float
adgold_lowpass_iir(int i, float NewSample)
{
float ACoef[NCoef + 1] = {
0.00009159473951071446,
0.00018318947902142891,
0.00009159473951071446
};
float BCoef[NCoef+1] = {
float BCoef[NCoef + 1] = {
1.00000000000000000000,
-1.97223372919526560000,
0.97261396931306277000
};
static float y[2][NCoef+1]; /* output samples */
static float x[2][NCoef+1]; /* input samples */
int n;
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[i][n] = x[i][n-1];
y[i][n] = y[i][n-1];
for (n = NCoef; n > 0; n--) {
x[i][n] = x[i][n - 1];
y[i][n] = y[i][n - 1];
}
/* Calculate the new output */
x[i][0] = NewSample;
y[i][0] = ACoef[0] * x[i][0];
for(n=1; n<=NCoef; n++)
for (n = 1; n <= NCoef; n++)
y[i][0] += ACoef[n] * x[i][n] - BCoef[n] * y[i][n];
return y[i][0];
}
/* fc=56Hz */
static inline float adgold_pseudo_stereo_iir(float NewSample) {
float ACoef[NCoef+1] = {
static inline float
adgold_pseudo_stereo_iir(float NewSample)
{
float ACoef[NCoef + 1] = {
0.00001409030866231767,
0.00002818061732463533,
0.00001409030866231767
};
float BCoef[NCoef+1] = {
float BCoef[NCoef + 1] = {
1.00000000000000000000,
-1.98733021473466760000,
0.98738361004063568000
};
static float y[NCoef+1]; /* output samples */
static float x[NCoef+1]; /* input samples */
int n;
static float y[NCoef + 1]; /* output samples */
static float x[NCoef + 1]; /* input samples */
int n;
/* shift the old samples */
for(n=NCoef; n>0; n--) {
x[n] = x[n-1];
y[n] = y[n-1];
for (n = NCoef; n > 0; n--) {
x[n] = x[n - 1];
y[n] = y[n - 1];
}
/* Calculate the new output */
x[0] = NewSample;
y[0] = ACoef[0] * x[0];
for(n=1; n<=NCoef; n++)
for (n = 1; n <= NCoef; n++)
y[0] += ACoef[n] * x[n] - BCoef[n] * y[n];
return y[0];
}
/* fc=3.2kHz - probably incorrect */
static inline float dss_iir(float NewSample) {
float ACoef[NCoef+1] = {
static inline float
dss_iir(float NewSample)
{
float ACoef[NCoef + 1] = {
0.03356837051492005100,
0.06713674102984010200,
0.03356837051492005100
};
float BCoef[NCoef+1] = {
float BCoef[NCoef + 1] = {
1.00000000000000000000,
-1.41898265221812010000,
0.55326988968868285000
};
static float y[NCoef+1]; /* output samples */
static float x[NCoef+1]; /* input samples */
int n;
static float y[NCoef + 1]; /* output samples */
static float x[NCoef + 1]; /* input samples */
int n;
/* shift the old samples */
for(n=NCoef; n>0; n--) {
x[n] = x[n-1];
y[n] = y[n-1];
for (n = NCoef; n > 0; n--) {
x[n] = x[n - 1];
y[n] = y[n - 1];
}
/* Calculate the new output */
x[0] = NewSample;
y[0] = ACoef[0] * x[0];
for(n=1; n<=NCoef; n++)
for (n = 1; n <= NCoef; n++)
y[0] += ACoef[n] * x[n] - BCoef[n] * y[n];
return y[0];
@@ -135,197 +146,208 @@ static inline float dss_iir(float NewSample) {
#undef NCoef
#define NCoef 1
/*Basic high pass to remove DC bias. fc=10Hz*/
static inline float dac_iir(int i, float NewSample) {
float ACoef[NCoef+1] = {
static inline float
dac_iir(int i, float NewSample)
{
float ACoef[NCoef + 1] = {
0.99901119820285345000,
-0.99901119820285345000
};
float BCoef[NCoef+1] = {
float BCoef[NCoef + 1] = {
1.00000000000000000000,
-0.99869185905052738000
};
static float y[2][NCoef+1]; /* output samples */
static float x[2][NCoef+1]; /* input samples */
int n;
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[i][n] = x[i][n-1];
y[i][n] = y[i][n-1];
for (n = NCoef; n > 0; n--) {
x[i][n] = x[i][n - 1];
y[i][n] = y[i][n - 1];
}
/* Calculate the new output */
x[i][0] = NewSample;
y[i][0] = ACoef[0] * x[i][0];
for(n=1; n<=NCoef; n++)
for (n = 1; n <= NCoef; n++)
y[i][0] += ACoef[n] * x[i][n] - BCoef[n] * y[i][n];
return y[i][0];
}
#undef NCoef
#define NCoef 2
/* fc=350Hz */
static inline double low_iir(int c, int i, double NewSample) {
double ACoef[NCoef+1] = {
static inline double
low_iir(int c, int i, double NewSample)
{
double ACoef[NCoef + 1] = {
0.00049713569693400649,
0.00099427139386801299,
0.00049713569693400649
};
double BCoef[NCoef+1] = {
double BCoef[NCoef + 1] = {
1.00000000000000000000,
-1.93522955470669530000,
0.93726236021404663000
};
static double y[2][2][NCoef+1]; /* output samples */
static double x[2][2][NCoef+1]; /* input samples */
int n;
static double y[3][2][NCoef + 1]; /* output samples */
static double x[3][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];
for (n = NCoef; n > 0; n--) {
x[c][i][n] = x[c][i][n - 1];
y[c][i][n] = y[c][i][n - 1];
}
/* Calculate the new output */
x[c][i][0] = NewSample;
y[c][i][0] = ACoef[0] * x[c][i][0];
for(n=1; n<=NCoef; n++)
for (n = 1; n <= NCoef; n++)
y[c][i][0] += ACoef[n] * x[c][i][n] - BCoef[n] * y[c][i][n];
return y[c][i][0];
}
/* fc=350Hz */
static inline double low_cut_iir(int c, int i, double NewSample) {
double ACoef[NCoef+1] = {
static inline double
low_cut_iir(int c, int i, double NewSample)
{
double ACoef[NCoef + 1] = {
0.96839970114733542000,
-1.93679940229467080000,
0.96839970114733542000
};
double BCoef[NCoef+1] = {
double BCoef[NCoef + 1] = {
1.00000000000000000000,
-1.93522955471202770000,
0.93726236021916731000
};
static double y[2][2][NCoef+1]; /* output samples */
static double x[2][2][NCoef+1]; /* input samples */
int n;
static double y[3][2][NCoef + 1]; /* output samples */
static double x[3][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];
for (n = NCoef; n > 0; n--) {
x[c][i][n] = x[c][i][n - 1];
y[c][i][n] = y[c][i][n - 1];
}
/* Calculate the new output */
x[c][i][0] = NewSample;
y[c][i][0] = ACoef[0] * x[c][i][0];
for(n=1; n<=NCoef; n++)
for (n = 1; n <= NCoef; n++)
y[c][i][0] += ACoef[n] * x[c][i][n] - BCoef[n] * y[c][i][n];
return y[c][i][0];
}
/* fc=3.5kHz */
static inline double high_iir(int c, int i, double NewSample) {
double ACoef[NCoef+1] = {
static inline double
high_iir(int c, int i, double NewSample)
{
double ACoef[NCoef + 1] = {
0.72248704753064896000,
-1.44497409506129790000,
0.72248704753064896000
};
double BCoef[NCoef+1] = {
double BCoef[NCoef + 1] = {
1.00000000000000000000,
-1.36640781670578510000,
0.52352474706139873000
};
static double y[2][2][NCoef+1]; /* output samples */
static double x[2][2][NCoef+1]; /* input samples */
int n;
static double y[3][2][NCoef + 1]; /* output samples */
static double x[3][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];
for (n = NCoef; n > 0; n--) {
x[c][i][n] = x[c][i][n - 1];
y[c][i][n] = y[c][i][n - 1];
}
/* Calculate the new output */
x[c][i][0] = NewSample;
y[c][i][0] = ACoef[0] * x[c][i][0];
for(n=1; n<=NCoef; n++)
for (n = 1; n <= NCoef; n++)
y[c][i][0] += ACoef[n] * x[c][i][n] - BCoef[n] * y[c][i][n];
return y[c][i][0];
}
/* fc=3.5kHz */
static inline double high_cut_iir(int c, int i, double NewSample) {
double ACoef[NCoef+1] = {
static inline double
high_cut_iir(int c, int i, double NewSample)
{
double ACoef[NCoef + 1] = {
0.03927726802250377400,
0.07855453604500754700,
0.03927726802250377400
};
double BCoef[NCoef+1] = {
double BCoef[NCoef + 1] = {
1.00000000000000000000,
-1.36640781666419950000,
0.52352474703279628000
};
static double y[2][2][NCoef+1]; /* output samples */
static double x[2][2][NCoef+1]; /* input samples */
int n;
static double y[3][2][NCoef + 1]; /* output samples */
static double x[3][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];
for (n = NCoef; n > 0; n--) {
x[c][i][n] = x[c][i][n - 1];
y[c][i][n] = y[c][i][n - 1];
}
/* Calculate the new output */
x[c][i][0] = NewSample;
y[c][i][0] = ACoef[0] * x[c][i][0];
for(n=1; n<=NCoef; n++)
for (n = 1; n <= NCoef; n++)
y[c][i][0] += ACoef[n] * x[c][i][n] - BCoef[n] * y[c][i][n];
return y[c][i][0];
}
/* fc=5.283kHz, gain=-9.477dB, width=0.4845 */
static inline double deemph_iir(int i, double NewSample) {
double ACoef[NCoef+1] = {
static inline double
deemph_iir(int i, double NewSample)
{
double ACoef[NCoef + 1] = {
0.46035077886318842566,
-0.28440821191249848754,
0.03388877229118691936
};
double BCoef[NCoef+1] = {
double BCoef[NCoef + 1] = {
1.00000000000000000000,
-1.05429146278569141337,
0.26412280202756849290
};
static double y[2][NCoef+1]; /* output samples */
static double x[2][NCoef+1]; /* input samples */
int n;
static double y[3][NCoef + 1]; /* output samples */
static double x[3][NCoef + 1]; /* input samples */
int n;
/* shift the old samples */
for(n=NCoef; n>0; n--) {
x[i][n] = x[i][n-1];
y[i][n] = y[i][n-1];
for (n = NCoef; n > 0; n--) {
x[i][n] = x[i][n - 1];
y[i][n] = y[i][n - 1];
}
/* Calculate the new output */
x[i][0] = NewSample;
y[i][0] = ACoef[0] * x[i][0];
for(n=1; n<=NCoef; n++)
for (n = 1; n <= NCoef; n++)
y[i][0] += ACoef[n] * x[i][n] - BCoef[n] * y[i][n];
return y[i][0];
@@ -335,67 +357,69 @@ static inline double deemph_iir(int i, double NewSample) {
#define NCoef 2
/* fc=3.2kHz */
static inline double sb_iir(int c, int i, double NewSample) {
double ACoef[NCoef+1] = {
static inline double
sb_iir(int c, int i, double NewSample)
{
double ACoef[NCoef + 1] = {
0.03356837051492005100,
0.06713674102984010200,
0.03356837051492005100
};
double BCoef[NCoef+1] = {
double BCoef[NCoef + 1] = {
1.00000000000000000000,
-1.41898265221812010000,
0.55326988968868285000
};
static double y[2][2][NCoef+1]; /* output samples */
static double x[2][2][NCoef+1]; /* input samples */
int n;
static double y[3][2][NCoef + 1]; /* output samples */
static double x[3][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];
for (n = NCoef; n > 0; n--) {
x[c][i][n] = x[c][i][n - 1];
y[c][i][n] = y[c][i][n - 1];
}
/* Calculate the new output */
x[c][i][0] = NewSample;
y[c][i][0] = ACoef[0] * x[c][i][0];
for(n=1; n<=NCoef; n++)
for (n = 1; n <= NCoef; n++)
y[c][i][0] += ACoef[n] * x[c][i][n] - BCoef[n] * y[c][i][n];
return y[c][i][0];
}
#undef NCoef
#define NCoef 1
#define NCoef 1
#define SB16_NCoef 51
extern double low_fir_sb16_coef[2][SB16_NCoef];
extern double low_fir_sb16_coef[3][SB16_NCoef];
static inline double low_fir_sb16(int c, int i, double NewSample)
static inline double
low_fir_sb16(int c, int i, double NewSample)
{
static double x[2][2][SB16_NCoef+1]; //input samples
static int pos[2] = { 0, 0 };
double out = 0.0;
int n;
static double x[3][2][SB16_NCoef + 1]; // input samples
static int pos[3] = { 0, 0 };
double out = 0.0;
int n;
/* Calculate the new output */
x[c][i][pos[c]] = NewSample;
/* Calculate the new output */
x[c][i][pos[c]] = NewSample;
for (n = 0; n < ((SB16_NCoef+1)-pos[c]) && n < SB16_NCoef; n++)
out += low_fir_sb16_coef[c][n] * x[c][i][n+pos[c]];
for (; n < SB16_NCoef; n++)
out += low_fir_sb16_coef[c][n] * x[c][i][(n+pos[c]) - (SB16_NCoef+1)];
for (n = 0; n < ((SB16_NCoef + 1) - pos[c]) && n < SB16_NCoef; n++)
out += low_fir_sb16_coef[c][n] * x[c][i][n + pos[c]];
for (; n < SB16_NCoef; n++)
out += low_fir_sb16_coef[c][n] * x[c][i][(n + pos[c]) - (SB16_NCoef + 1)];
if (i == 1)
{
pos[c]++;
if (pos[c] > SB16_NCoef)
pos[c] = 0;
}
return out;
if (i == 1) {
pos[c]++;
if (pos[c] > SB16_NCoef)
pos[c] = 0;
}
return out;
}
#endif /*EMU_FILTERS_H*/

View File

@@ -1,19 +1,25 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Handling of the emulated flash devices.
* Handling of the emulated flash devices.
*
*
*
* Author: Miran Grca, <mgrca8@gmail.com>
* Copyright 2020 Miran Grca.
* Authors: Miran Grca, <mgrca8@gmail.com>
* Jasmine Iwanek, <jriwanek@gmail.com>
*
* Copyright 2020 Miran Grca.
* Copyright 2022-2023 Jasmine Iwanek.
*/
#ifndef EMU_FLASH_H
#define EMU_FLASH_H
extern const device_t catalyst_flash_device;
extern const device_t intel_flash_bxt_ami_device;
@@ -22,7 +28,36 @@ extern const device_t intel_flash_bxb_device;
extern const device_t sst_flash_29ee010_device;
extern const device_t sst_flash_29ee020_device;
extern const device_t winbond_flash_w29c512_device;
extern const device_t winbond_flash_w29c010_device;
extern const device_t winbond_flash_w29c020_device;
extern const device_t winbond_flash_w29c040_device;
extern const device_t sst_flash_39sf512_device;
extern const device_t sst_flash_39sf010_device;
extern const device_t sst_flash_39sf020_device;
extern const device_t sst_flash_39sf040_device;
extern const device_t sst_flash_39sf040_device;
extern const device_t sst_flash_39lf512_device;
extern const device_t sst_flash_39lf010_device;
extern const device_t sst_flash_39lf020_device;
extern const device_t sst_flash_39lf040_device;
extern const device_t sst_flash_39lf080_device;
extern const device_t sst_flash_39lf016_device;
extern const device_t sst_flash_49lf002_device;
extern const device_t sst_flash_49lf020_device;
extern const device_t sst_flash_49lf020a_device;
extern const device_t sst_flash_49lf003_device;
extern const device_t sst_flash_49lf030_device;
extern const device_t sst_flash_49lf004_device;
extern const device_t sst_flash_49lf004c_device;
extern const device_t sst_flash_49lf040_device;
extern const device_t sst_flash_49lf008_device;
extern const device_t sst_flash_49lf008c_device;
extern const device_t sst_flash_49lf080_device;
extern const device_t sst_flash_49lf016_device;
extern const device_t sst_flash_49lf160_device;
#endif /*EMU_FLASH_H*/

View File

@@ -1,152 +1,165 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Definitions for the generic game port handlers.
* Definitions for the generic game port handlers.
*
*
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Sarah Walker, <tommowalker@tommowalker.co.uk>
* RichardG, <richardg867@gmail.com>
* Authors: Miran Grca, <mgrca8@gmail.com>
* Sarah Walker, <https://pcem-emulator.co.uk/>
* RichardG, <richardg867@gmail.com>
*
* Copyright 2016-2018 Miran Grca.
* Copyright 2008-2018 Sarah Walker.
* Copyright 2021 RichardG.
* Copyright 2016-2018 Miran Grca.
* Copyright 2008-2018 Sarah Walker.
* Copyright 2021 RichardG.
*/
#ifndef EMU_GAMEPORT_H
# define EMU_GAMEPORT_H
#define EMU_GAMEPORT_H
#define MAX_PLAT_JOYSTICKS 8
#define MAX_JOYSTICKS 4
#define JS_TYPE_NONE 0
#define JS_TYPE_2AXIS_4BUTTON 1
#define JS_TYPE_2AXIS_6BUTTON 2
#define JS_TYPE_2AXIS_8BUTTON 3
#define JS_TYPE_4AXIS_4BUTTON 4
#define JS_TYPE_CH_FLIGHTSTICK_PRO 5
#define JS_TYPE_SIDEWINDER_PAD 6
#define JS_TYPE_THRUSTMASTER_FCS 7
#define MAX_PLAT_JOYSTICKS 8
#define MAX_JOYSTICKS 4
#define POV_X 0x80000000
#define POV_Y 0x40000000
#define SLIDER 0x20000000
#define POV_X 0x80000000
#define POV_Y 0x40000000
#define SLIDER 0x20000000
#define AXIS_NOT_PRESENT -99999
#define AXIS_NOT_PRESENT -99999
#define JOYSTICK_PRESENT(n) (joystick_state[n].plat_joystick_nr != 0)
#define JOYSTICK_PRESENT(n) (joystick_state[n].plat_joystick_nr != 0)
#define GAMEPORT_SIO 0x1000000
#define GAMEPORT_SIO 0x1000000
typedef struct plat_joystick_t {
char name[260];
typedef struct {
char name[260];
int a[8];
int b[32];
int p[4];
int s[2];
int a[8];
int b[32];
int p[4];
int s[2];
struct {
char name[260];
int id;
} axis[8];
char name[260];
int id;
} axis[8];
struct {
char name[260];
int id;
} button[32];
char name[260];
int id;
} button[32];
struct {
char name[260];
int id;
} pov[4];
char name[260];
int id;
} pov[4];
struct
{
char name[260];
int id;
} slider[2];
struct {
char name[260];
int id;
} slider[2];
int nr_axes;
int nr_buttons;
int nr_povs;
int nr_sliders;
int nr_axes;
int nr_buttons;
int nr_povs;
int nr_sliders;
} plat_joystick_t;
typedef struct {
int axis[8];
int button[32];
int pov[4];
typedef struct joystick_t {
int axis[8];
int button[32];
int pov[4];
int plat_joystick_nr;
int axis_mapping[8];
int button_mapping[32];
int pov_mapping[4][2];
int plat_joystick_nr;
int axis_mapping[8];
int button_mapping[32];
int pov_mapping[4][2];
} joystick_t;
typedef struct {
typedef struct joystick_if_t {
const char *name;
const char *internal_name;
void *(*init)(void);
void (*close)(void *p);
uint8_t (*read)(void *p);
void (*write)(void *p);
int (*read_axis)(void *p, int axis);
void (*a0_over)(void *p);
void *(*init)(void);
void (*close)(void *priv);
uint8_t (*read)(void *priv);
void (*write)(void *priv);
int (*read_axis)(void *priv, int axis);
void (*a0_over)(void *priv);
int axis_count,
button_count,
pov_count;
int max_joysticks;
const char *axis_names[8];
const char *button_names[32];
const char *pov_names[4];
int axis_count;
int button_count;
int pov_count;
int max_joysticks;
const char *axis_names[8];
const char *button_names[32];
const char *pov_names[4];
} joystick_if_t;
#ifdef __cplusplus
extern "C" {
#endif
#ifdef EMU_DEVICE_H
extern const device_t gameport_device;
extern const device_t gameport_201_device;
extern const device_t gameport_208_device;
extern const device_t gameport_209_device;
extern const device_t gameport_pnp_device;
extern const device_t gameport_pnp_6io_device;
extern const device_t gameport_sio_device;
extern const device_t gameport_device;
extern const device_t gameport_201_device;
extern const device_t gameport_203_device;
extern const device_t gameport_205_device;
extern const device_t gameport_207_device;
extern const device_t gameport_208_device;
extern const device_t gameport_209_device;
extern const device_t gameport_20b_device;
extern const device_t gameport_20d_device;
extern const device_t gameport_20f_device;
extern const device_t gameport_tm_acm_device;
extern const device_t gameport_pnp_device;
extern const device_t gameport_pnp_6io_device;
extern const device_t gameport_sio_device;
extern const device_t gameport_sio_1io_device;
extern const device_t *standalone_gameport_type;
extern const device_t *standalone_gameport_type;
#endif
extern int gameport_instance_id;
extern plat_joystick_t plat_joystick_state[MAX_PLAT_JOYSTICKS];
extern joystick_t joystick_state[MAX_JOYSTICKS];
extern int joysticks_present;
extern int gameport_instance_id;
extern plat_joystick_t plat_joystick_state[MAX_PLAT_JOYSTICKS];
extern joystick_t joystick_state[MAX_JOYSTICKS];
extern int joysticks_present;
extern int joystick_type;
extern int joystick_type;
extern void joystick_init(void);
extern void joystick_close(void);
extern void joystick_process(void);
extern void joystick_init(void);
extern void joystick_close(void);
extern void joystick_process(void);
extern const char *joystick_get_name(int js);
extern const char *joystick_get_internal_name(int js);
extern int joystick_get_from_internal_name(char *s);
extern int joystick_get_max_joysticks(int js);
extern int joystick_get_axis_count(int js);
extern int joystick_get_button_count(int js);
extern int joystick_get_pov_count(int js);
extern const char *joystick_get_axis_name(int js, int id);
extern const char *joystick_get_button_name(int js, int id);
extern const char *joystick_get_pov_name(int js, int id);
extern char *joystick_get_name(int js);
extern char *joystick_get_internal_name(int js);
extern int joystick_get_from_internal_name(char *s);
extern int joystick_get_max_joysticks(int js);
extern int joystick_get_axis_count(int js);
extern int joystick_get_button_count(int js);
extern int joystick_get_pov_count(int js);
extern char *joystick_get_axis_name(int js, int id);
extern char *joystick_get_button_name(int js, int id);
extern char *joystick_get_pov_name(int js, int id);
extern void gameport_update_joystick_type(void);
extern void gameport_remap(void *priv, uint16_t address);
extern void *gameport_add(const device_t *gameport_type);
extern void gameport_update_joystick_type(void);
extern void gameport_remap(void *priv, uint16_t address);
extern void *gameport_add(const device_t *gameport_type);
#ifdef __cplusplus
}
#endif
#endif /*EMU_GAMEPORT_H*/
#endif /*EMU_GAMEPORT_H*/

View File

@@ -0,0 +1,79 @@
/*
* 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 GDB stub server.
*
*
*
* Authors: RichardG, <richardg867@gmail.com>
*
* Copyright 2022 RichardG.
*/
#ifndef EMU_GDBSTUB_H
#define EMU_GDBSTUB_H
#include <stdint.h>
#include <86box/mem.h>
#define GDBSTUB_MEM_READ 0
#define GDBSTUB_MEM_WRITE 16
#define GDBSTUB_MEM_AWATCH 32
enum {
GDBSTUB_EXEC = 0,
GDBSTUB_SSTEP = 1,
GDBSTUB_BREAK = 2,
GDBSTUB_BREAK_SW = 3,
GDBSTUB_BREAK_HW = 4,
GDBSTUB_BREAK_RWATCH = 5,
GDBSTUB_BREAK_WWATCH = 6,
GDBSTUB_BREAK_AWATCH = 7
};
#ifdef USE_GDBSTUB
# define GDBSTUB_MEM_ACCESS(addr, access, width) \
uint32_t gdbstub_page = (addr) >> MEM_GRANULARITY_BITS; \
if (gdbstub_watch_pages[gdbstub_page >> 6] & (1ULL << (gdbstub_page & 63))) { \
uint32_t gdbstub_addrs[(width)]; \
for (int gdbstub_i = 0; gdbstub_i < (width); gdbstub_i++) \
gdbstub_addrs[gdbstub_i] = (addr) + gdbstub_i; \
gdbstub_mem_access(gdbstub_addrs, (access) | (width)); \
}
# define GDBSTUB_MEM_ACCESS_FAST(addrs, access, width) \
uint32_t gdbstub_page = (addrs)[0] >> MEM_GRANULARITY_BITS; \
if (gdbstub_watch_pages[gdbstub_page >> 6] & (1ULL << (gdbstub_page & 63))) \
gdbstub_mem_access((addrs), (access) | (width));
extern int gdbstub_step, gdbstub_next_asap;
extern uint64_t gdbstub_watch_pages[(((uint32_t) -1) >> (MEM_GRANULARITY_BITS + 6)) + 1];
extern void gdbstub_cpu_init(void);
extern int gdbstub_instruction(void);
extern int gdbstub_int3(void);
extern void gdbstub_mem_access(uint32_t *addrs, int access);
extern void gdbstub_init(void);
extern void gdbstub_close(void);
#else
# define GDBSTUB_MEM_ACCESS(addr, access, width)
# define GDBSTUB_MEM_ACCESS_FAST(addrs, access, width)
# define gdbstub_step 0
# define gdbstub_next_asap 0
# define gdbstub_cpu_init()
# define gdbstub_instruction() 0
# define gdbstub_int3() 0
# define gdbstub_init()
# define gdbstub_close()
#endif
#endif

View File

@@ -1,91 +1,105 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Definitions for the common disk controller handler.
* Definitions for the common disk controller handler.
*
*
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
* Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2016-2020 Miran Grca.
* Copyright 2017-2020 Fred N. van Kempen.
* Copyright 2016-2020 Miran Grca.
* Copyright 2017-2020 Fred N. van Kempen.
*/
#ifndef EMU_HDC_H
# define EMU_HDC_H
#define EMU_HDC_H
#define MFM_NUM 2 /* 2 drives per controller supported */
#define ESDI_NUM 2 /* 2 drives per controller supported */
#define XTA_NUM 2 /* 2 drives per controller supported */
#define IDE_NUM 10 /* 8 drives per AT IDE + 2 for XT IDE */
#define ATAPI_NUM 8 /* 8 drives per AT IDE */
#define SCSI_NUM 16 /* theoretically the controller can have at \
* least 7 devices, with each device being \
* able to support 8 units, but hey... */
#define MFM_NUM 2 /* 2 drives per controller supported */
#define ESDI_NUM 2 /* 2 drives per controller supported */
#define XTA_NUM 2 /* 2 drives per controller supported */
#define IDE_NUM 10 /* 8 drives per AT IDE + 2 for XT IDE */
#define ATAPI_NUM 8 /* 8 drives per AT IDE */
#define SCSI_NUM 16 /* theoretically the controller can have at
* least 7 devices, with each device being
* able to support 8 units, but hey... */
/* Controller types. */
#define HDC_NONE 0
#define HDC_INTERNAL 1
extern int hdc_current;
extern int hdc_current;
extern const device_t st506_xt_xebec_device; /* st506_xt_xebec */
extern const device_t st506_xt_wdxt_gen_device; /* st506_xt_wdxt_gen */
extern const device_t st506_xt_dtc5150x_device; /* st506_xt_dtc */
extern const device_t st506_xt_st11_m_device; /* st506_xt_st11_m */
extern const device_t st506_xt_st11_r_device; /* st506_xt_st11_m */
extern const device_t st506_xt_wd1002a_wx1_device; /* st506_xt_wd1002a_wx1 */
extern const device_t st506_xt_wd1002a_wx1_nobios_device; /* st506_xt_wd1002a_wx1 */
extern const device_t st506_xt_wd1002a_27x_device; /* st506_xt_wd1002a_27x */
extern const device_t st506_at_wd1003_device; /* st506_at_wd1003 */
extern const device_t st506_xt_wd1004a_wx1_device; /* st506_xt_wd1004a_wx1 */
extern const device_t st506_xt_wd1004_27x_device; /* st506_xt_wd1004_27x */
extern const device_t st506_xt_wd1004a_27x_device; /* st506_xt_wd1004a_27x */
extern const device_t st506_xt_victor_v86p_device; /* st506_xt_victor_v86p */
extern const device_t st506_xt_toshiba_t1200_device; /* st506_xt_toshiba_t1200 */
extern const device_t st506_xt_xebec_device; /* st506_xt_xebec */
extern const device_t st506_xt_dtc5150x_device; /* st506_xt_dtc */
extern const device_t st506_xt_st11_m_device; /* st506_xt_st11_m */
extern const device_t st506_xt_st11_r_device; /* st506_xt_st11_m */
extern const device_t st506_xt_wd1002a_wx1_device; /* st506_xt_wd1002a_wx1 */
extern const device_t st506_xt_wd1002a_27x_device; /* st506_xt_wd1002a_27x */
extern const device_t st506_at_wd1003_device; /* st506_at_wd1003 */
extern const device_t esdi_at_wd1007vse1_device; /* esdi_at */
extern const device_t esdi_ps2_device; /* esdi_mca */
extern const device_t esdi_at_wd1007vse1_device; /* esdi_at */
extern const device_t esdi_ps2_device; /* esdi_mca */
extern const device_t ide_isa_device; /* isa_ide */
extern const device_t ide_isa_2ch_device; /* isa_ide_2ch */
extern const device_t ide_isa_2ch_opt_device; /* isa_ide_2ch_opt */
extern const device_t ide_vlb_device; /* vlb_ide */
extern const device_t ide_vlb_2ch_device; /* vlb_ide_2ch */
extern const device_t ide_pci_device; /* pci_ide */
extern const device_t ide_pci_2ch_device; /* pci_ide_2ch */
extern const device_t ide_isa_device; /* isa_ide */
extern const device_t ide_isa_2ch_device; /* isa_ide_2ch */
extern const device_t ide_isa_2ch_opt_device; /* isa_ide_2ch_opt */
extern const device_t ide_vlb_device; /* vlb_ide */
extern const device_t ide_vlb_2ch_device; /* vlb_ide_2ch */
extern const device_t ide_pci_device; /* pci_ide */
extern const device_t ide_pci_2ch_device; /* pci_ide_2ch */
extern const device_t ide_cmd640_vlb_device; /* CMD PCI-640B VLB */
extern const device_t ide_cmd640_vlb_178_device; /* CMD PCI-640B VLB (Port 178h) */
extern const device_t ide_cmd640_vlb_pri_device; /* CMD PCI-640B VLB (Only primary channel) */
extern const device_t ide_cmd640_vlb_pri_178_device; /* CMD PCI-640B VLB (Only primary channel) (Port 178h) */
extern const device_t ide_cmd640_vlb_sec_device; /* CMD PCI-640B VLB (Only secondary channel) */
extern const device_t ide_cmd640_vlb_sec_178_device; /* CMD PCI-640B VLB (Only secondary channel) (Port 178h) */
extern const device_t ide_cmd640_pci_device; /* CMD PCI-640B PCI */
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_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) */
extern const device_t ide_cmd640_vlb_device; /* CMD PCI-640B VLB */
extern const device_t ide_cmd640_vlb_178_device; /* CMD PCI-640B VLB (Port 178h) */
extern const device_t ide_cmd640_pci_device; /* CMD PCI-640B PCI */
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_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) */
extern const device_t ide_opti611_vlb_device; /* OPTi 82c611/611A VLB */
extern const device_t ide_opti611_vlb_sec_device; /* OPTi 82c611/611A VLB (Secondary channel) */
extern const device_t ide_opti611_vlb_device; /* OPTi 82c611/611A VLB */
extern const device_t ide_ter_device;
extern const device_t ide_ter_pnp_device;
extern const device_t ide_qua_device;
extern const device_t ide_qua_pnp_device;
extern const device_t ide_ter_device;
extern const device_t ide_ter_pnp_device;
extern const device_t ide_qua_device;
extern const device_t ide_qua_pnp_device;
extern const device_t xta_wdxt150_device; /* xta_wdxt150 */
extern const device_t xta_hd20_device; /* EuroPC internal */
extern const device_t xta_wdxt150_device; /* xta_wdxt150 */
extern const device_t xta_hd20_device; /* EuroPC internal */
extern const device_t xtide_device; /* xtide_xt */
extern const device_t xtide_plus_device; /* xtide_xt_plus */
extern const device_t xtide_at_device; /* xtide_at */
extern const device_t xtide_at_386_device; /* xtide_at_386 */
extern const device_t xtide_acculogic_device; /* xtide_ps2 */
extern const device_t xtide_at_ps2_device; /* xtide_at_ps2 */
extern const device_t xtide_device; /* xtide_xt */
extern const device_t xtide_at_device; /* xtide_at */
extern const device_t xtide_at_386_device; /* xtide_at_386 */
extern const device_t xtide_acculogic_device; /* xtide_ps2 */
extern const device_t xtide_at_ps2_device; /* xtide_at_ps2 */
extern void hdc_init(void);
extern void hdc_reset(void);
extern const char *hdc_get_internal_name(int hdc);
extern int hdc_get_from_internal_name(char *s);
extern int hdc_has_config(int hdc);
extern const device_t *hdc_get_device(int hdc);
extern int hdc_get_flags(int hdc);
extern int hdc_available(int hdc);
extern void hdc_init(void);
extern void hdc_reset(void);
extern char *hdc_get_internal_name(int hdc);
extern int hdc_get_from_internal_name(char *s);
extern int hdc_has_config(int hdc);
extern const device_t *hdc_get_device(int hdc);
extern int hdc_get_flags(int hdc);
extern int hdc_available(int hdc);
#endif /*EMU_HDC_H*/
#endif /*EMU_HDC_H*/

View File

@@ -1,160 +1,241 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Implementation of the IDE emulation for hard disks and ATAPI
* CD-ROM devices.
* Implementation of the IDE emulation for hard disks and ATAPI
* CD-ROM devices.
*
*
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* Copyright 2008-2019 Sarah Walker.
* Copyright 2016-2019 Miran Grca.
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* Copyright 2008-2019 Sarah Walker.
* Copyright 2016-2019 Miran Grca.
*/
#ifndef EMU_IDE_H
# define EMU_IDE_H
#define EMU_IDE_H
#define IDE_BUS_MAX 4
#define IDE_CHAN_MAX 2
enum
{
IDE_NONE = 0,
IDE_HDD,
IDE_ATAPI
#define HDC_PRIMARY_BASE 0x01F0
#define HDC_PRIMARY_SIDE 0x03F6
#define HDC_PRIMARY_IRQ 14
#define HDC_SECONDARY_BASE 0x0170
#define HDC_SECONDARY_SIDE 0x0376
#define HDC_SECONDARY_IRQ 15
#define HDC_TERTIARY_BASE 0x01E8
#define HDC_TERTIARY_SIDE 0x03EE
#define HDC_TERTIARY_IRQ 11
#define HDC_QUATERNARY_BASE 0x0168
#define HDC_QUATERNARY_SIDE 0x036E
#define HDC_QUATERNARY_IRQ 10
enum {
IDE_NONE = 0, /* Absent master or both. */
IDE_HDD, /* Hard disk. */
IDE_ATAPI, /* ATAPI device. */
IDE_RESERVED, /* Reserved, do not use. */
IDE_SHADOW, /* Shadow flag, do not assign on is own. */
IDE_HDD_SHADOW, /* Shadow of a hard disk. */
IDE_ATAPI_SHADOW /* Shadow of an ATAPI device. */
};
#ifdef SCSI_DEVICE_H
typedef struct ide_tf_s {
union {
uint8_t cylprecomp;
uint8_t features;
};
union {
uint8_t secount;
uint8_t phase;
};
union {
uint16_t cylinder;
uint16_t request_length;
};
union {
uint8_t atastat;
uint8_t status;
};
uint8_t error;
uint8_t sector;
union {
uint8_t drvsel;
struct {
uint8_t head :4;
uint8_t pad :2;
uint8_t lba :1;
uint8_t pad0 :1;
};
};
uint32_t pos;
} ide_tf_t;
#ifdef _TIMER_H_
typedef struct ide_s {
uint8_t selected,
atastat, error,
command, fdisk;
int type, board,
irqstat, service,
blocksize, blockcount,
hdd_num, channel,
pos, sector_pos,
lba, skip512,
reset, mdma_mode,
do_initial_read;
uint32_t secount, sector,
cylinder, head,
drive, cylprecomp,
cfg_spt, cfg_hpc,
lba_addr, tracks,
spt, hpc;
/* The rest. */
uint8_t selected;
uint8_t command;
uint8_t head;
uint8_t pad;
int type;
int board;
int irqstat;
int service;
int blocksize;
int blockcount;
int hdd_num;
int channel;
int sector_pos;
int reset;
int mdma_mode;
int do_initial_read;
uint32_t drive;
uint32_t cfg_spt;
uint32_t cfg_hpc;
uint32_t lba_addr;
uint32_t tracks;
uint32_t spt;
uint32_t hpc;
uint16_t *buffer;
uint8_t *sector_buffer;
uint8_t *sector_buffer;
pc_timer_t timer;
pc_timer_t timer;
/* Task file. */
ide_tf_t * tf;
/* Stuff mostly used by ATAPI */
scsi_common_t *sc;
int interrupt_drq;
#ifdef SCSI_DEVICE_H
scsi_common_t *sc;
#else
void * sc;
#endif
int interrupt_drq;
double pending_delay;
int (*get_max)(int ide_has_dma, int type);
int (*get_timings)(int ide_has_dma, int type);
void (*identify)(struct ide_s *ide, int ide_has_dma);
void (*stop)(scsi_common_t *sc);
void (*packet_command)(scsi_common_t *sc, uint8_t *cdb);
void (*device_reset)(scsi_common_t *sc);
uint8_t (*phase_data_out)(scsi_common_t *sc);
void (*command_stop)(scsi_common_t *sc);
void (*bus_master_error)(scsi_common_t *sc);
#ifdef SCSI_DEVICE_H
int (*get_max)(int ide_has_dma, int type);
int (*get_timings)(int ide_has_dma, int type);
void (*identify)(struct ide_s *ide, int ide_has_dma);
void (*stop)(scsi_common_t *sc);
void (*packet_command)(scsi_common_t *sc, uint8_t *cdb);
void (*device_reset)(scsi_common_t *sc);
uint8_t (*phase_data_out)(scsi_common_t *sc);
void (*command_stop)(scsi_common_t *sc);
void (*bus_master_error)(scsi_common_t *sc);
#else
void * get_max;
void * get_timings;
void * identify;
void * stop;
void * device_reset;
void * phase_data_out;
void * command_stop;
void * bus_master_error;
#endif
} ide_t;
extern ide_t *ide_drives[IDE_NUM];
#ifdef EMU_HDC_H
extern ide_t *ide_drives[IDE_NUM];
#endif
#endif
/* Type:
0 = PIO,
1 = SDMA,
2 = MDMA,
3 = UDMA
0 = PIO,
1 = SDMA,
2 = MDMA,
3 = UDMA
Return:
-1 = Not supported,
Anything else = maximum mode
-1 = Not supported,
Anything else = maximum mode
This will eventually be hookable. */
enum {
TYPE_PIO = 0,
TYPE_SDMA,
TYPE_MDMA,
TYPE_UDMA
TYPE_PIO = 0,
TYPE_SDMA = 1,
TYPE_MDMA = 2,
TYPE_UDMA = 3
};
/* Return:
0 = Not supported,
Anything else = timings
0 = Not supported,
Anything else = timings
This will eventually be hookable. */
enum {
TIMINGS_DMA = 0,
TIMINGS_PIO,
TIMINGS_PIO_FC
TIMINGS_DMA = 0,
TIMINGS_PIO = 1,
TIMINGS_PIO_FC = 2
};
extern int ide_ter_enabled, ide_qua_enabled;
extern int ide_ter_enabled;
extern int ide_qua_enabled;
#ifdef SCSI_DEVICE_H
extern ide_t * ide_get_drive(int ch);
extern void ide_irq_raise(ide_t *ide);
extern void ide_irq_lower(ide_t *ide);
extern void ide_allocate_buffer(ide_t *dev);
extern void ide_atapi_attach(ide_t *dev);
extern ide_t *ide_get_drive(int ch);
extern void ide_irq(ide_t *ide, int set, int log);
extern void ide_allocate_buffer(ide_t *dev);
extern void ide_atapi_attach(ide_t *dev);
#endif
extern void * ide_xtide_init(void);
extern void ide_xtide_close(void);
extern void *ide_xtide_init(void);
extern void ide_xtide_close(void);
extern void ide_writew(uint16_t addr, uint16_t val, void *priv);
extern void ide_write_devctl(uint16_t addr, uint8_t val, void *priv);
extern void ide_writeb(uint16_t addr, uint8_t val, void *priv);
extern uint8_t ide_readb(uint16_t addr, void *priv);
extern uint8_t ide_read_alt_status(uint16_t addr, void *priv);
extern uint16_t ide_readw(uint16_t addr, void *priv);
extern void ide_writew(uint16_t addr, uint16_t val, void *priv);
extern void ide_write_devctl(uint16_t addr, uint8_t val, void *priv);
extern void ide_writeb(uint16_t addr, uint8_t val, void *priv);
extern uint8_t ide_readb(uint16_t addr, void *priv);
extern uint8_t ide_read_alt_status(uint16_t addr, void *priv);
extern uint16_t ide_readw(uint16_t addr, void *priv);
extern void ide_set_bus_master(int board,
int (*dma)(int channel, uint8_t *data, int transfer_length, int out, void *priv),
void (*set_irq)(int channel, void *priv), void *priv);
extern void ide_set_bus_master(int board,
int (*dma)(uint8_t *data, int transfer_length, int out, void *priv),
void (*set_irq)(uint8_t status, void *priv), void *priv);
extern void win_cdrom_eject(uint8_t id);
extern void win_cdrom_reload(uint8_t id);
extern void win_cdrom_eject(uint8_t id);
extern void win_cdrom_reload(uint8_t id);
extern void ide_set_base(int board, uint16_t port);
extern void ide_set_side(int board, uint16_t port);
extern void ide_set_base_addr(int board, int base, uint16_t port);
extern void ide_pri_enable(void);
extern void ide_pri_disable(void);
extern void ide_sec_enable(void);
extern void ide_sec_disable(void);
extern void ide_handlers(uint8_t board, int set);
extern void ide_board_set_force_ata3(int board, int force_ata3);
extern void ide_board_set_force_ata3(int board, int force_ata3);
#ifdef EMU_ISAPNP_H
extern void ide_pnp_config_changed(uint8_t ld, isapnp_device_config_t *config, void *priv);
extern void ide_pnp_config_changed(uint8_t ld, isapnp_device_config_t *config, void *priv);
#endif
extern double ide_atapi_get_period(uint8_t channel);
extern double ide_atapi_get_period(uint8_t channel);
#ifdef SCSI_DEVICE_H
extern void ide_set_callback(ide_t *ide, double callback);
extern void ide_set_callback(ide_t *ide, double callback);
#endif
extern void ide_set_board_callback(uint8_t board, double callback);
extern void ide_set_board_callback(uint8_t board, double callback);
extern void ide_padstr(char *str, const char *src, int len);
extern void ide_padstr8(uint8_t *buf, int buf_size, const char *src);
extern void ide_padstr(char *str, const char *src, int len);
extern void ide_padstr8(uint8_t *buf, int buf_size, const char *src);
extern int (*ide_bus_master_dma)(int channel, uint8_t *data, int transfer_length, int out, void *priv);
extern void (*ide_bus_master_set_irq)(int channel, void *priv);
extern void *ide_bus_master_priv[2];
extern uint8_t ide_read_ali_75(void);
extern uint8_t ide_read_ali_76(void);
extern uint8_t ide_read_ali_75(void);
extern uint8_t ide_read_ali_76(void);
/* Legacy #define's. */
#define ide_irq_raise(ide) ide_irq(ide, 1, 1)
#define ide_irq_lower(ide) ide_irq(ide, 0, 1)
#define ide_set_base(board, port) ide_set_base_addr(board, 0, port)
#define ide_set_side(board, port) ide_set_base_addr(board, 1, port)
#endif /*EMU_IDE_H*/
#define ide_pri_enable() ide_handlers(0, 1)
#define ide_pri_disable() ide_handlers(0, 0)
#define ide_sec_enable() ide_handlers(1, 1)
#define ide_sec_disable() ide_handlers(1, 0)
#define ide_set_handlers(board) ide_handlers(board, 1)
#define ide_remove_handlers(board) ide_handlers(board, 0)
#endif /*EMU_IDE_H*/

View File

@@ -1,58 +1,81 @@
/*
* 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.
* 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.
*
* Emulation of the SFF-8038i IDE Bus Master.
* This file is part of the 86Box distribution.
*
* Emulation core dispatcher.
* Emulation of the SFF-8038i IDE Bus Master.
*
*
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* Copyright 2008-2020 Sarah Walker.
* Copyright 2016-2020 Miran Grca.
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
*
* Copyright 2008-2020 Sarah Walker.
* Copyright 2016-2020 Miran Grca.
*/
typedef struct
{
uint8_t command, status,
ptr0, enabled,
dma_mode, pad,
pad0, pad1;
uint16_t base, pad2;
uint32_t ptr, ptr_cur,
addr;
int count, eot,
slot,
irq_mode[2], irq_level[2],
irq_pin, irq_line;
} sff8038i_t;
#ifndef EMU_HDC_IDE_SFF8038I_H
#define EMU_HDC_IDE_SFF8038I_H
enum
{
IRQ_MODE_LEGACY = 0,
IRQ_MODE_PCI_IRQ_PIN,
IRQ_MODE_PCI_IRQ_LINE,
IRQ_MODE_ALI_ALADDIN,
IRQ_MODE_MIRQ_0,
IRQ_MODE_MIRQ_1,
IRQ_MODE_MIRQ_2,
IRQ_MODE_MIRQ_3,
IRQ_MODE_SIS_551X
};
typedef struct sff8038i_t
{
uint8_t command;
uint8_t status;
uint8_t ptr0;
uint8_t enabled;
uint8_t dma_mode;
uint8_t irq_state;
uint8_t channel;
uint8_t irq_line;
uint16_t base;
uint16_t pad;
uint32_t ptr;
uint32_t ptr_cur;
uint32_t addr;
int count;
int eot;
int slot;
int irq_mode;
int irq_level;
int irq_pin;
int pci_irq_line;
} sff8038i_t;
extern const device_t sff8038i_device;
extern void sff_bus_master_handler(sff8038i_t *dev, int enabled, uint16_t base);
extern void sff_bus_master_handler(sff8038i_t *dev, int enabled, uint16_t base);
extern int sff_bus_master_dma_read(int channel, uint8_t *data, int transfer_length, void *priv);
extern int sff_bus_master_dma_write(int channel, uint8_t *data, int transfer_length, void *priv);
extern void sff_bus_master_set_irq(uint8_t status, void *priv);
extern int sff_bus_master_dma(uint8_t *data, int transfer_length, int out, void *priv);
extern void sff_bus_master_set_irq(int channel, void *priv);
extern void sff_bus_master_write(uint16_t port, uint8_t val, void *priv);
extern uint8_t sff_bus_master_read(uint16_t port, void *priv);
extern int sff_bus_master_dma(int channel, uint8_t *data, int transfer_length, int out, void *priv);
extern void sff_bus_master_reset(sff8038i_t *dev);
extern void sff_bus_master_write(uint16_t port, uint8_t val, void *priv);
extern uint8_t sff_bus_master_read(uint16_t port, void *priv);
extern void sff_set_slot(sff8038i_t *dev, int slot);
extern void sff_bus_master_reset(sff8038i_t *dev, uint16_t old_base);
extern void sff_set_irq_line(sff8038i_t *dev, int irq_line);
extern void sff_set_slot(sff8038i_t *dev, int slot);
extern void sff_set_irq_mode(sff8038i_t *dev, int irq_mode);
extern void sff_set_irq_pin(sff8038i_t *dev, int irq_pin);
extern void sff_set_irq_line(sff8038i_t *dev, int irq_line);
extern void sff_set_irq_level(sff8038i_t *dev, int irq_level);
extern void sff_set_irq_mode(sff8038i_t *dev, int channel, int irq_mode);
extern void sff_set_irq_pin(sff8038i_t *dev, int irq_pin);
extern void sff_set_irq_level(sff8038i_t *dev, int channel, int irq_level);
#endif /*EMU_HDC_IDE_SFF8038I_H*/

View File

@@ -1,26 +1,32 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Definitions for the hard disk image handler.
* Definitions for the hard disk image handler.
*
*
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
* Copyright 2016-2018 Miran Grca.
* Copyright 2017,2018 Fred N. van Kempen.
* Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2016-2018 Miran Grca.
* Copyright 2017-2018 Fred N. van Kempen.
*/
#ifndef EMU_HDD_H
# define EMU_HDD_H
#define EMU_HDD_H
#define IMG_FMT_RAW 0
#define IMG_FMT_HDI 1
#define IMG_FMT_HDX 2
#define IMG_FMT_VHD_FIXED 3
#define IMG_FMT_VHD_DYNAMIC 4
#define IMG_FMT_VHD_DIFF 5
#define HDD_NUM 88 /* total of 88 images supported */
#define HDD_NUM 88 /* total of 88 images supported */
/* Hard Disk bus types. */
#if 0
@@ -28,108 +34,194 @@
Bit 5 = Removable (0 = no, 1 yes). */
enum {
BUS_DISABLED = 0x00,
BUS_DISABLED = 0x00,
BUS_MFM = 0x01, /* These four are for hard disk only. */
BUS_XIDE = 0x02,
BUS_XTA = 0x03,
BUS_ESDI = 0x04,
BUS_MFM = 0x01, /* These four are for hard disk only. */
BUS_XIDE = 0x02,
BUS_XTA = 0x03,
BUS_ESDI = 0x04,
BUS_PANASONIC = 0x21, / These four are for CD-ROM only. */
BUS_PHILIPS = 0x22,
BUS_SONY = 0x23,
BUS_MITSUMI = 0x24,
BUS_PANASONIC = 0x21, / These four are for CD-ROM only. */
BUS_PHILIPS = 0x22,
BUS_SONY = 0x23,
BUS_MITSUMI = 0x24,
BUS_IDE_PIO_ONLY = 0x05,
BUS_IDE_PIO_AND_DMA = 0x15,
BUS_IDE_R_PIO_ONLY = 0x25,
BUS_IDE_R_PIO_AND_DMA = 0x35,
BUS_IDE_PIO_ONLY = 0x05,
BUS_IDE_PIO_AND_DMA = 0x15,
BUS_IDE_R_PIO_ONLY = 0x25,
BUS_IDE_R_PIO_AND_DMA = 0x35,
BUS_ATAPI_PIO_ONLY = 0x06,
BUS_ATAPI_PIO_AND_DMA = 0x16,
BUS_ATAPI_R_PIO_ONLY = 0x26,
BUS_ATAPI_R_PIO_AND_DMA = 0x36,
BUS_ATAPI_PIO_ONLY = 0x06,
BUS_ATAPI_PIO_AND_DMA = 0x16,
BUS_ATAPI_R_PIO_ONLY = 0x26,
BUS_ATAPI_R_PIO_AND_DMA = 0x36,
BUS_SASI = 0x07,
BUS_SASI_R = 0x27,
BUS_SASI = 0x07,
BUS_SASI_R = 0x27,
BUS_SCSI = 0x08,
BUS_SCSI_R = 0x28,
BUS_SCSI = 0x08,
BUS_SCSI_R = 0x28,
BUS_USB = 0x09,
BUS_USB_R = 0x29
BUS_USB = 0x09,
BUS_USB_R = 0x29
};
#else
enum {
HDD_BUS_DISABLED = 0,
HDD_BUS_MFM,
HDD_BUS_XTA,
HDD_BUS_ESDI,
HDD_BUS_IDE,
HDD_BUS_ATAPI,
HDD_BUS_SCSI,
HDD_BUS_USB
HDD_BUS_MFM = 1,
HDD_BUS_XTA = 2,
HDD_BUS_ESDI = 3,
HDD_BUS_IDE = 4,
HDD_BUS_ATAPI = 5,
HDD_BUS_SCSI = 6,
HDD_BUS_USB = 7
};
#endif
enum {
HDD_OP_SEEK = 0,
HDD_OP_READ = 2,
HDD_OP_WRITE = 3
};
#define HDD_MAX_ZONES 16
#define HDD_MAX_CACHE_SEG 16
typedef struct hdd_preset_t {
const char *name;
const char *internal_name;
uint32_t zones;
uint32_t avg_spt;
uint32_t heads;
uint32_t rpm;
uint32_t rcache_num_seg;
uint32_t rcache_seg_size;
uint32_t max_multiple;
double full_stroke_ms;
double track_seek_ms;
} hdd_preset_t;
typedef struct hdd_cache_seg_t {
uint32_t id;
uint32_t lba_addr;
uint32_t ra_addr;
uint32_t host_addr;
uint8_t lru;
uint8_t valid;
} hdd_cache_seg_t;
typedef struct hdd_cache_t {
// Read cache
hdd_cache_seg_t segments[HDD_MAX_CACHE_SEG];
uint32_t num_segments;
uint32_t segment_size;
uint32_t ra_segment;
uint8_t ra_ongoing;
uint64_t ra_start_time;
// Write cache
uint32_t write_addr;
uint32_t write_pending;
uint32_t write_size;
uint64_t write_start_time;
} hdd_cache_t;
typedef struct hdd_zone_t {
uint32_t cylinders;
uint32_t sectors_per_track;
double sector_time_usec;
uint32_t start_sector;
uint32_t end_sector;
uint32_t start_track;
} hdd_zone_t;
/* Define the virtual Hard Disk. */
typedef struct {
uint8_t id;
typedef struct hard_disk_t {
uint8_t id;
union {
uint8_t channel; /* Needed for Settings to reduce the number of if's */
uint8_t channel; /* Needed for Settings to reduce the number of if's */
uint8_t mfm_channel; /* Should rename and/or unionize */
uint8_t esdi_channel;
uint8_t xta_channel;
uint8_t ide_channel;
uint8_t scsi_id;
uint8_t mfm_channel; /* Should rename and/or unionize */
uint8_t esdi_channel;
uint8_t xta_channel;
uint8_t ide_channel;
uint8_t scsi_id;
};
uint8_t bus,
res; /* Reserved for bus mode */
uint8_t wp; /* Disk has been mounted READ-ONLY */
uint8_t pad, pad0;
uint8_t bus;
uint8_t bus_mode; /* Bit 0 = PIO suported;
Bit 1 = DMA supportd. */
uint8_t wp; /* Disk has been mounted READ-ONLY */
uint8_t pad;
uint8_t pad0;
void *priv;
void *priv;
char fn[1024], /* Name of current image file */
prev_fn[1024]; /* Name of previous image file */
char fn[1024]; /* Name of current image file */
char vhd_parent[1041]; /* Differential VHD parent file */
uint32_t res0, pad1,
base,
spt,
hpc, /* Physical geometry parameters */
tracks;
uint32_t res0;
uint32_t pad1;
uint32_t base;
uint32_t spt;
uint32_t hpc; /* Physical geometry parameters */
uint32_t tracks;
hdd_zone_t zones[HDD_MAX_ZONES];
uint32_t num_zones;
hdd_cache_t cache;
uint32_t phy_cyl;
uint32_t phy_heads;
uint32_t rpm;
uint8_t max_multiple_block;
uint32_t cur_cylinder;
uint32_t cur_track;
uint32_t cur_addr;
uint32_t speed_preset;
uint32_t vhd_blocksize;
double avg_rotation_lat_usec;
double full_stroke_usec;
double head_switch_usec;
double cyl_switch_usec;
} hard_disk_t;
extern hard_disk_t hdd[HDD_NUM];
extern unsigned int hdd_table[128][3];
extern hard_disk_t hdd[HDD_NUM];
extern unsigned int hdd_table[128][3];
extern int hdd_init(void);
extern int hdd_string_to_bus(char *str, int cdrom);
extern char *hdd_bus_to_string(int bus, int cdrom);
extern int hdd_is_valid(int c);
extern int hdd_init(void);
extern int hdd_string_to_bus(char *str, int cdrom);
extern char *hdd_bus_to_string(int bus, int cdrom);
extern int hdd_is_valid(int c);
extern void hdd_image_init(void);
extern int hdd_image_load(int id);
extern void hdd_image_seek(uint8_t id, uint32_t sector);
extern void hdd_image_read(uint8_t id, uint32_t sector, uint32_t count, uint8_t *buffer);
extern int hdd_image_read_ex(uint8_t id, uint32_t sector, uint32_t count, uint8_t *buffer);
extern void hdd_image_write(uint8_t id, uint32_t sector, uint32_t count, uint8_t *buffer);
extern int hdd_image_write_ex(uint8_t id, uint32_t sector, uint32_t count, uint8_t *buffer);
extern void hdd_image_zero(uint8_t id, uint32_t sector, uint32_t count);
extern int hdd_image_zero_ex(uint8_t id, uint32_t sector, uint32_t count);
extern uint32_t hdd_image_get_last_sector(uint8_t id);
extern uint32_t hdd_image_get_pos(uint8_t id);
extern uint8_t hdd_image_get_type(uint8_t id);
extern void hdd_image_unload(uint8_t id, int fn_preserve);
extern void hdd_image_close(uint8_t id);
extern void hdd_image_calc_chs(uint32_t *c, uint32_t *h, uint32_t *s, uint32_t size);
extern void hdd_image_init(void);
extern int hdd_image_load(int id);
extern void hdd_image_seek(uint8_t id, uint32_t sector);
extern void hdd_image_read(uint8_t id, uint32_t sector, uint32_t count, uint8_t *buffer);
extern int hdd_image_read_ex(uint8_t id, uint32_t sector, uint32_t count, uint8_t *buffer);
extern void hdd_image_write(uint8_t id, uint32_t sector, uint32_t count, uint8_t *buffer);
extern int hdd_image_write_ex(uint8_t id, uint32_t sector, uint32_t count, uint8_t *buffer);
extern void hdd_image_zero(uint8_t id, uint32_t sector, uint32_t count);
extern int hdd_image_zero_ex(uint8_t id, uint32_t sector, uint32_t count);
extern uint32_t hdd_image_get_last_sector(uint8_t id);
extern uint32_t hdd_image_get_pos(uint8_t id);
extern uint8_t hdd_image_get_type(uint8_t id);
extern void hdd_image_unload(uint8_t id, int fn_preserve);
extern void hdd_image_close(uint8_t id);
extern void hdd_image_calc_chs(uint32_t *c, uint32_t *h, uint32_t *s, uint32_t size);
extern int image_is_hdi(const char *s);
extern int image_is_hdx(const char *s, int check_signature);
extern int image_is_vhd(const char *s, int check_signature);
extern int image_is_hdi(const char *s);
extern int image_is_hdx(const char *s, int check_signature);
extern int image_is_vhd(const char *s, int check_signature);
extern double hdd_timing_write(hard_disk_t *hdd, uint32_t addr, uint32_t len);
extern double hdd_timing_read(hard_disk_t *hdd, uint32_t addr, uint32_t len);
extern double hdd_seek_get_time(hard_disk_t *hdd, uint32_t dst_addr, uint8_t operation, uint8_t continuous, double max_seek_time);
int hdd_preset_get_num(void);
const char *hdd_preset_getname(int preset);
extern const char *hdd_preset_get_internal_name(int preset);
extern int hdd_preset_get_from_internal_name(char *s);
extern void hdd_preset_apply(int hdd_id);
#endif /*EMU_HDD_H*/
#endif /*EMU_HDD_H*/

View File

@@ -1,78 +1,74 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Definitions for hardware monitoring chips.
* Definitions for hardware monitoring chips.
*
*
*
* Author: RichardG, <richardg867@gmail.com>
* Authors: RichardG, <richardg867@gmail.com>
*
* Copyright 2020 RichardG.
* Copyright 2020 RichardG.
*/
#ifndef EMU_HWM_H
# define EMU_HWM_H
# include <stdint.h>
#define EMU_HWM_H
#include <stdint.h>
#define RESISTOR_DIVIDER(v, r1, r2) (((v) * (r2)) / ((r1) + (r2)))
typedef struct {
uint16_t fans[4];
uint8_t temperatures[4];
uint16_t voltages[13];
typedef struct hwm_values_t {
uint16_t fans[4];
uint8_t temperatures[4];
uint16_t voltages[13];
} hwm_values_t;
typedef struct {
uint32_t local;
typedef struct lm75_t {
uint32_t local;
hwm_values_t *values;
void *as99127f;
void *as99127f;
uint8_t regs[8];
uint8_t addr_register;
uint8_t i2c_addr: 7, i2c_state: 2;
uint8_t i2c_enabled: 1;
uint8_t regs[8];
uint8_t addr_register;
uint8_t i2c_addr : 7;
uint8_t i2c_state : 2;
uint8_t i2c_enabled : 1;
} lm75_t;
/* hwm.c */
extern uint16_t hwm_get_vcore();
extern uint16_t hwm_get_vcore(void);
/* hwm_lm75.c */
extern void lm75_remap(lm75_t *dev, uint8_t addr);
extern uint8_t lm75_read(lm75_t *dev, uint8_t reg);
extern uint8_t lm75_write(lm75_t *dev, uint8_t reg, uint8_t val);
extern void lm75_remap(lm75_t *dev, uint8_t addr);
extern uint8_t lm75_read(lm75_t *dev, uint8_t reg);
extern uint8_t lm75_write(lm75_t *dev, uint8_t reg, uint8_t val);
/* hwm_lm78.c */
extern uint8_t lm78_as99127f_read(void *priv, uint8_t reg);
extern uint8_t lm78_as99127f_write(void *priv, uint8_t reg, uint8_t val);
extern uint8_t lm78_as99127f_read(void *priv, uint8_t reg);
extern uint8_t lm78_as99127f_write(void *priv, uint8_t reg, uint8_t val);
/* hwm_vt82c686.c */
extern void vt82c686_hwm_write(uint8_t addr, uint8_t val, void *priv);
extern void vt82c686_hwm_write(uint8_t addr, uint8_t val, void *priv);
/* Refer to specific hardware monitor implementations for the meaning of hwm_values. */
extern hwm_values_t hwm_values;
extern hwm_values_t hwm_values;
extern const device_t lm75_1_4a_device;
extern const device_t lm75_w83781d_device;
extern const device_t lm75_1_4a_device;
extern const device_t lm75_w83781d_device;
extern const device_t lm78_device;
extern const device_t w83781d_device;
extern const device_t w83781d_p5a_device;
extern const device_t as99127f_device;
extern const device_t as99127f_rev2_device;
extern const device_t w83782d_device;
extern const device_t lm78_device;
extern const device_t w83781d_device;
extern const device_t w83781d_p5a_device;
extern const device_t as99127f_device;
extern const device_t as99127f_rev2_device;
extern const device_t w83782d_device;
extern const device_t gl518sm_2c_device;
extern const device_t gl518sm_2d_device;
extern const device_t gl518sm_2c_device;
extern const device_t gl518sm_2d_device;
extern const device_t via_vt82c686_hwm_device;
extern const device_t via_vt82c686_hwm_device;
#endif /*EMU_HWM_H*/
#endif /*EMU_HWM_H*/

View File

@@ -1,70 +1,67 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Definitions for the I2C handler.
* Definitions for the I2C handler.
*
*
*
* Authors: RichardG, <richardg867@gmail.com>
* Authors: RichardG, <richardg867@gmail.com>
*
* Copyright 2020 RichardG.
* Copyright 2020 RichardG.
*/
#ifndef EMU_I2C_H
# define EMU_I2C_H
#define EMU_I2C_H
/* i2c.c */
extern void *i2c_smbus;
extern void *i2c_smbus;
/* i2c.c */
extern void *i2c_addbus(char *name);
extern void i2c_removebus(void *bus_handle);
extern char *i2c_getbusname(void *bus_handle);
extern void *i2c_addbus(char *name);
extern void i2c_removebus(void *bus_handle);
extern char *i2c_getbusname(void *bus_handle);
extern void i2c_sethandler(void *bus_handle, uint8_t base, int size,
uint8_t (*start)(void *bus, uint8_t addr, uint8_t read, void *priv),
uint8_t (*read)(void *bus, uint8_t addr, void *priv),
uint8_t (*write)(void *bus, uint8_t addr, uint8_t data, void *priv),
void (*stop)(void *bus, uint8_t addr, void *priv),
void *priv);
extern void i2c_sethandler(void *bus_handle, uint8_t base, int size,
uint8_t (*start)(void *bus, uint8_t addr, uint8_t read, void *priv),
uint8_t (*read)(void *bus, uint8_t addr, void *priv),
uint8_t (*write)(void *bus, uint8_t addr, uint8_t data, void *priv),
void (*stop)(void *bus, uint8_t addr, void *priv),
void *priv);
extern void i2c_removehandler(void *bus_handle, uint8_t base, int size,
uint8_t (*start)(void *bus, uint8_t addr, uint8_t read, void *priv),
uint8_t (*read)(void *bus, uint8_t addr, void *priv),
uint8_t (*write)(void *bus, uint8_t addr, uint8_t data, void *priv),
void (*stop)(void *bus, uint8_t addr, void *priv),
void *priv);
extern void i2c_removehandler(void *bus_handle, uint8_t base, int size,
uint8_t (*start)(void *bus, uint8_t addr, uint8_t read, void *priv),
uint8_t (*read)(void *bus, uint8_t addr, void *priv),
uint8_t (*write)(void *bus, uint8_t addr, uint8_t data, void *priv),
void (*stop)(void *bus, uint8_t addr, void *priv),
void *priv);
extern void i2c_handler(int set, void *bus_handle, uint8_t base, int size,
uint8_t (*start)(void *bus, uint8_t addr, uint8_t read, void *priv),
uint8_t (*read)(void *bus, uint8_t addr, void *priv),
uint8_t (*write)(void *bus, uint8_t addr, uint8_t data, void *priv),
void (*stop)(void *bus, uint8_t addr, void *priv),
void *priv);
extern void i2c_handler(int set, void *bus_handle, uint8_t base, int size,
uint8_t (*start)(void *bus, uint8_t addr, uint8_t read, void *priv),
uint8_t (*read)(void *bus, uint8_t addr, void *priv),
uint8_t (*write)(void *bus, uint8_t addr, uint8_t data, void *priv),
void (*stop)(void *bus, uint8_t addr, void *priv),
void *priv);
extern uint8_t i2c_start(void *bus_handle, uint8_t addr, uint8_t read);
extern uint8_t i2c_read(void *bus_handle, uint8_t addr);
extern uint8_t i2c_write(void *bus_handle, uint8_t addr, uint8_t data);
extern void i2c_stop(void *bus_handle, uint8_t addr);
extern uint8_t i2c_start(void *bus_handle, uint8_t addr, uint8_t read);
extern uint8_t i2c_read(void *bus_handle, uint8_t addr);
extern uint8_t i2c_write(void *bus_handle, uint8_t addr, uint8_t data);
extern void i2c_stop(void *bus_handle, uint8_t addr);
/* i2c_eeprom.c */
extern uint8_t log2i(uint32_t i);
extern void *i2c_eeprom_init(void *i2c, uint8_t addr, uint8_t *data, uint32_t size, uint8_t writable);
extern void i2c_eeprom_close(void *dev_handle);
extern uint8_t log2i(uint32_t i);
extern void *i2c_eeprom_init(void *i2c, uint8_t addr, uint8_t *data, uint32_t size, uint8_t writable);
extern void i2c_eeprom_close(void *dev_handle);
/* i2c_gpio.c */
extern void *i2c_gpio_init(char *bus_name);
extern void i2c_gpio_close(void *dev_handle);
extern void i2c_gpio_set(void *dev_handle, uint8_t scl, uint8_t sda);
extern uint8_t i2c_gpio_get_scl(void *dev_handle);
extern uint8_t i2c_gpio_get_sda(void *dev_handle);
extern void *i2c_gpio_get_bus();
extern void *i2c_gpio_init(char *bus_name);
extern void i2c_gpio_close(void *dev_handle);
extern void i2c_gpio_set(void *dev_handle, uint8_t scl, uint8_t sda);
extern uint8_t i2c_gpio_get_scl(void *dev_handle);
extern uint8_t i2c_gpio_get_sda(void *dev_handle);
extern void *i2c_gpio_get_bus(void *dev_handle);
#endif /*EMU_I2C_H*/
#endif /*EMU_I2C_H*/

69
src/include/86box/i8080.h Normal file
View File

@@ -0,0 +1,69 @@
/*
* 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.
*
* 8080 CPU emulation (header).
*
*
*
* Authors: Cacodemon345
*
* Copyright 2022 Cacodemon345
*/
#include <stdint.h>
typedef struct i8080 {
union {
uint16_t af; /* Intended in case we also go for μPD9002 emulation, which also has a Z80 emulation mode. */
struct {
uint8_t a;
uint8_t flags;
};
};
union {
uint16_t bc;
struct {
uint8_t b;
uint8_t c;
};
};
union {
uint16_t de;
struct {
uint8_t d;
uint8_t e;
};
};
union {
uint16_t hl;
struct {
uint8_t h;
uint8_t l;
};
};
uint16_t pc;
uint16_t sp;
uint16_t oldpc;
uint16_t ei;
uint32_t pmembase;
uint32_t dmembase; /* Base from where i8080 starts. */
uint8_t emulated; /* 0 = not emulated, use separate registers, 1 = emulated, use x86 registers. */
uint16_t *cpu_flags;
void (*writemembyte)(uint32_t, uint8_t);
uint8_t (*readmembyte)(uint32_t);
void (*startclock)(void);
void (*endclock)(void);
void (*checkinterrupts)(void);
uint8_t (*fetchinstruction)(void *);
} i8080;
#define C_FLAG_I8080 (1 << 0)
#define P_FLAG_I8080 (1 << 2)
#define AC_FLAG_I8080 (1 << 4)
#define Z_FLAG_I8080 (1 << 6)
#define S_FLAG_I8080 (1 << 7)

View File

@@ -1 +1,6 @@
#ifndef EMU_I82335_H
#define EMU_I82335_H
extern void i82335_init(void);
#endif /*EMU_I82335_H*/

View File

@@ -1,15 +1,23 @@
/*
* 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.
* 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.
*
* Emulation of the IBM Expansion Unit (5161).
* This file is part of the 86Box distribution.
*
* Emulation of the IBM Expansion Unit (5161).
*
*
*
* Author: Miran Grca, <mgrca8@gmail.com>
* Copyright 2016-2018 Miran Grca.
* Authors: Miran Grca, <mgrca8@gmail.com>
*
* Copyright 2016-2018 Miran Grca.
*/
#ifndef EMU_IBM_5161_H
#define EMU_IBM_5161_H
extern const device_t ibm_5161_device;
#endif /*EMU_IBM_5151_H*/

97
src/include/86box/ini.h Normal file
View File

@@ -0,0 +1,97 @@
/*
* 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.
*
* Configuration file handler header.
*
*
*
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
* Overdoze,
*
* Copyright 2008-2017 Sarah Walker.
* Copyright 2016-2017 Miran Grca.
*
*/
#ifndef EMU_INI_H
#define EMU_INI_H
#ifdef __cplusplus
extern "C" {
#endif
typedef void *ini_t;
typedef void *ini_section_t;
extern ini_t ini_new(void);
extern ini_t ini_read(const char *fn);
extern void ini_write(ini_t ini, const char *fn);
extern void ini_dump(ini_t ini);
extern void ini_close(ini_t ini);
extern void ini_section_delete_var(ini_section_t section, const char *name);
extern int ini_section_get_int(ini_section_t section, const char *name, int def);
extern uint32_t ini_section_get_uint(ini_section_t section, const char *name, uint32_t def);
#if 0
extern float ini_section_get_float(ini_section_t section, const char *name, float def);
#endif
extern double ini_section_get_double(ini_section_t section, const char *name, double def);
extern int ini_section_get_hex16(ini_section_t section, const char *name, int def);
extern int ini_section_get_hex20(ini_section_t section, const char *name, int def);
extern int ini_section_get_mac(ini_section_t section, const char *name, int def);
extern char *ini_section_get_string(ini_section_t section, const char *name, char *def);
extern wchar_t *ini_section_get_wstring(ini_section_t section, const char *name, wchar_t *def);
extern void ini_section_set_int(ini_section_t section, const char *name, int val);
extern void ini_section_set_uint(ini_section_t section, const char *name, uint32_t val);
#if 0
extern void ini_section_set_float(ini_section_t section, const char *name, float val);
#endif
extern void ini_section_set_double(ini_section_t section, const char *name, double val);
extern void ini_section_set_hex16(ini_section_t section, const char *name, int val);
extern void ini_section_set_hex20(ini_section_t section, const char *name, int val);
extern void ini_section_set_mac(ini_section_t section, const char *name, int val);
extern void ini_section_set_string(ini_section_t section, const char *name, const char *val);
extern void ini_section_set_wstring(ini_section_t section, const char *name, wchar_t *val);
#define ini_delete_var(ini, head, name) ini_section_delete_var(ini_find_section(ini, head), name)
#define ini_get_int(ini, head, name, def) ini_section_get_int(ini_find_section(ini, head), name, def)
#define ini_get_uint(ini, head, name, def) ini_section_get_uint(ini_find_section(ini, head), name, def)
#if 0
#define ini_get_float(ini, head, name, def) ini_section_get_float(ini_find_section(ini, head), name, def)
#endif
#define ini_get_double(ini, head, name, def) ini_section_get_double(ini_find_section(ini, head), name, def)
#define ini_get_hex16(ini, head, name, def) ini_section_get_hex16(ini_find_section(ini, head), name, def)
#define ini_get_hex20(ini, head, name, def) ini_section_get_hex20(ini_find_section(ini, head), name, def)
#define ini_get_mac(ini, head, name, def) ini_section_get_mac(ini_find_section(ini, head), name, def)
#define ini_get_string(ini, head, name, def) ini_section_get_string(ini_find_section(ini, head), name, def)
#define ini_get_wstring(ini, head, name, def) ini_section_get_wstring(ini_find_section(ini, head), name, def)
#define ini_set_int(ini, head, name, val) ini_section_set_int(ini_find_or_create_section(ini, head), name, val)
#define ini_set_uint(ini, head, name, val) ini_section_set_uint(ini_find_or_create_section(ini, head), name, val)
#if 0
#define ini_set_float(ini, head, name, val) ini_section_set_float(ini_find_or_create_section(ini, head), name, val)
#endif
#define ini_set_double(ini, head, name, val) ini_section_set_double(ini_find_or_create_section(ini, head), name, val)
#define ini_set_hex16(ini, head, name, val) ini_section_set_hex16(ini_find_or_create_section(ini, head), name, val)
#define ini_set_hex20(ini, head, name, val) ini_section_set_hex20(ini_find_or_create_section(ini, head), name, val)
#define ini_set_mac(ini, head, name, val) ini_section_set_mac(ini_find_or_create_section(ini, head), name, val)
#define ini_set_string(ini, head, name, val) ini_section_set_string(ini_find_or_create_section(ini, head), name, val)
#define ini_set_wstring(ini, head, name, val) ini_section_set_wstring(ini_find_or_create_section(ini, head), name, val)
extern ini_section_t ini_find_section(ini_t ini, const char *name);
extern ini_section_t ini_find_or_create_section(ini_t ini, const char *name);
extern void ini_rename_section(ini_section_t section, const char *name);
extern void ini_delete_section_if_empty(ini_t ini, ini_section_t section);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -1,120 +1,118 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Definitions for the I/O handler.
* Definitions for the I/O handler.
*
*
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2008-2017 Sarah Walker.
* Copyright 2016,2017 Miran Grca.
* Copyright 2008-2017 Sarah Walker.
* Copyright 2016-2017 Miran Grca.
*/
#ifndef EMU_IO_H
# define EMU_IO_H
#define EMU_IO_H
extern void io_init(void);
extern void io_init(void);
extern void io_sethandler_common(uint16_t base, int size,
uint8_t (*inb)(uint16_t addr, void *priv),
uint16_t (*inw)(uint16_t addr, void *priv),
uint32_t (*inl)(uint16_t addr, void *priv),
void (*outb)(uint16_t addr, uint8_t val, void *priv),
void (*outw)(uint16_t addr, uint16_t val, void *priv),
void (*outl)(uint16_t addr, uint32_t val, void *priv),
void *priv, int step);
extern void io_sethandler_common(uint16_t base, int size,
uint8_t (*inb)(uint16_t addr, void *priv),
uint16_t (*inw)(uint16_t addr, void *priv),
uint32_t (*inl)(uint16_t addr, void *priv),
void (*outb)(uint16_t addr, uint8_t val, void *priv),
void (*outw)(uint16_t addr, uint16_t val, void *priv),
void (*outl)(uint16_t addr, uint32_t val, void *priv),
void *priv, int step);
extern void io_removehandler_common(uint16_t base, int size,
uint8_t (*inb)(uint16_t addr, void *priv),
uint16_t (*inw)(uint16_t addr, void *priv),
uint32_t (*inl)(uint16_t addr, void *priv),
void (*outb)(uint16_t addr, uint8_t val, void *priv),
void (*outw)(uint16_t addr, uint16_t val, void *priv),
void (*outl)(uint16_t addr, uint32_t val, void *priv),
void *priv, int step);
extern void io_removehandler_common(uint16_t base, int size,
uint8_t (*inb)(uint16_t addr, void *priv),
uint16_t (*inw)(uint16_t addr, void *priv),
uint32_t (*inl)(uint16_t addr, void *priv),
void (*outb)(uint16_t addr, uint8_t val, void *priv),
void (*outw)(uint16_t addr, uint16_t val, void *priv),
void (*outl)(uint16_t addr, uint32_t val, void *priv),
void *priv, int step);
extern void io_handler_common(int set, uint16_t base, int size,
uint8_t (*inb)(uint16_t addr, void *priv),
uint16_t (*inw)(uint16_t addr, void *priv),
uint32_t (*inl)(uint16_t addr, void *priv),
void (*outb)(uint16_t addr, uint8_t val, void *priv),
void (*outw)(uint16_t addr, uint16_t val, void *priv),
void (*outl)(uint16_t addr, uint32_t val, void *priv),
void *priv, int step);
extern void io_handler_common(int set, uint16_t base, int size,
uint8_t (*inb)(uint16_t addr, void *priv),
uint16_t (*inw)(uint16_t addr, void *priv),
uint32_t (*inl)(uint16_t addr, void *priv),
void (*outb)(uint16_t addr, uint8_t val, void *priv),
void (*outw)(uint16_t addr, uint16_t val, void *priv),
void (*outl)(uint16_t addr, uint32_t val, void *priv),
void *priv, int step);
extern void io_sethandler(uint16_t base, int size,
uint8_t (*inb)(uint16_t addr, void *priv),
uint16_t (*inw)(uint16_t addr, void *priv),
uint32_t (*inl)(uint16_t addr, void *priv),
void (*outb)(uint16_t addr, uint8_t val, void *priv),
void (*outw)(uint16_t addr, uint16_t val, void *priv),
void (*outl)(uint16_t addr, uint32_t val, void *priv),
void *priv);
extern void io_sethandler(uint16_t base, int size,
uint8_t (*inb)(uint16_t addr, void *priv),
uint16_t (*inw)(uint16_t addr, void *priv),
uint32_t (*inl)(uint16_t addr, void *priv),
void (*outb)(uint16_t addr, uint8_t val, void *priv),
void (*outw)(uint16_t addr, uint16_t val, void *priv),
void (*outl)(uint16_t addr, uint32_t val, void *priv),
void *priv);
extern void io_removehandler(uint16_t base, int size,
uint8_t (*inb)(uint16_t addr, void *priv),
uint16_t (*inw)(uint16_t addr, void *priv),
uint32_t (*inl)(uint16_t addr, void *priv),
void (*outb)(uint16_t addr, uint8_t val, void *priv),
void (*outw)(uint16_t addr, uint16_t val, void *priv),
void (*outl)(uint16_t addr, uint32_t val, void *priv),
void *priv);
extern void io_removehandler(uint16_t base, int size,
uint8_t (*inb)(uint16_t addr, void *priv),
uint16_t (*inw)(uint16_t addr, void *priv),
uint32_t (*inl)(uint16_t addr, void *priv),
void (*outb)(uint16_t addr, uint8_t val, void *priv),
void (*outw)(uint16_t addr, uint16_t val, void *priv),
void (*outl)(uint16_t addr, uint32_t val, void *priv),
void *priv);
extern void io_handler(int set, uint16_t base, int size,
uint8_t (*inb)(uint16_t addr, void *priv),
uint16_t (*inw)(uint16_t addr, void *priv),
uint32_t (*inl)(uint16_t addr, void *priv),
void (*outb)(uint16_t addr, uint8_t val, void *priv),
void (*outw)(uint16_t addr, uint16_t val, void *priv),
void (*outl)(uint16_t addr, uint32_t val, void *priv),
void *priv);
extern void io_handler(int set, uint16_t base, int size,
uint8_t (*inb)(uint16_t addr, void *priv),
uint16_t (*inw)(uint16_t addr, void *priv),
uint32_t (*inl)(uint16_t addr, void *priv),
void (*outb)(uint16_t addr, uint8_t val, void *priv),
void (*outw)(uint16_t addr, uint16_t val, void *priv),
void (*outl)(uint16_t addr, uint32_t val, void *priv),
void *priv);
extern void io_sethandler_interleaved(uint16_t base, int size,
uint8_t (*inb)(uint16_t addr, void *priv),
uint16_t (*inw)(uint16_t addr, void *priv),
uint32_t (*inl)(uint16_t addr, void *priv),
void (*outb)(uint16_t addr, uint8_t val, void *priv),
void (*outw)(uint16_t addr, uint16_t val, void *priv),
void (*outl)(uint16_t addr, uint32_t val, void *priv),
void *priv);
extern void io_sethandler_interleaved(uint16_t base, int size,
uint8_t (*inb)(uint16_t addr, void *priv),
uint16_t (*inw)(uint16_t addr, void *priv),
uint32_t (*inl)(uint16_t addr, void *priv),
void (*outb)(uint16_t addr, uint8_t val, void *priv),
void (*outw)(uint16_t addr, uint16_t val, void *priv),
void (*outl)(uint16_t addr, uint32_t val, void *priv),
void *priv);
extern void io_removehandler_interleaved(uint16_t base, int size,
uint8_t (*inb)(uint16_t addr, void *priv),
uint16_t (*inw)(uint16_t addr, void *priv),
uint32_t (*inl)(uint16_t addr, void *priv),
void (*outb)(uint16_t addr, uint8_t val, void *priv),
void (*outw)(uint16_t addr, uint16_t val, void *priv),
void (*outl)(uint16_t addr, uint32_t val, void *priv),
void *priv);
extern void io_removehandler_interleaved(uint16_t base, int size,
uint8_t (*inb)(uint16_t addr, void *priv),
uint16_t (*inw)(uint16_t addr, void *priv),
uint32_t (*inl)(uint16_t addr, void *priv),
void (*outb)(uint16_t addr, uint8_t val, void *priv),
void (*outw)(uint16_t addr, uint16_t val, void *priv),
void (*outl)(uint16_t addr, uint32_t val, void *priv),
void *priv);
extern void io_handler_interleaved(int set, uint16_t base, int size,
uint8_t (*inb)(uint16_t addr, void *priv),
uint16_t (*inw)(uint16_t addr, void *priv),
uint32_t (*inl)(uint16_t addr, void *priv),
void (*outb)(uint16_t addr, uint8_t val, void *priv),
void (*outw)(uint16_t addr, uint16_t val, void *priv),
void (*outl)(uint16_t addr, uint32_t val, void *priv),
void *priv);
extern void io_handler_interleaved(int set, uint16_t base, int size,
uint8_t (*inb)(uint16_t addr, void *priv),
uint16_t (*inw)(uint16_t addr, void *priv),
uint32_t (*inl)(uint16_t addr, void *priv),
void (*outb)(uint16_t addr, uint8_t val, void *priv),
void (*outw)(uint16_t addr, uint16_t val, void *priv),
void (*outl)(uint16_t addr, uint32_t val, void *priv),
void *priv);
extern uint8_t inb(uint16_t port);
extern void outb(uint16_t port, uint8_t val);
extern uint16_t inw(uint16_t port);
extern void outw(uint16_t port, uint16_t val);
extern uint32_t inl(uint16_t port);
extern void outl(uint16_t port, uint32_t val);
extern uint8_t inb(uint16_t port);
extern void outb(uint16_t port, uint8_t val);
extern uint16_t inw(uint16_t port);
extern void outw(uint16_t port, uint16_t val);
extern uint32_t inl(uint16_t port);
extern void outl(uint16_t port, uint32_t val);
extern void *io_trap_add(void (*func)(int size, uint16_t addr, uint8_t write, uint8_t val, void *priv),
void *priv);
extern void io_trap_remap(void *handle, int enable, uint16_t addr, uint16_t size);
extern void io_trap_remove(void *handle);
extern void *io_trap_add(void (*func)(int size, uint16_t addr, uint8_t write, uint8_t val, void *priv),
void *priv);
extern void io_trap_remap(void *handle, int enable, uint16_t addr, uint16_t size);
extern void io_trap_remove(void *handle);
#endif /*EMU_IO_H*/
#endif /*EMU_IO_H*/

View File

@@ -1,36 +1,34 @@
/*
* VARCem Virtual ARchaeological Computer EMulator.
* An emulator of (mostly) x86-based PC systems and devices,
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
* spanning the era between 1981 and 1995.
* VARCem Virtual ARchaeological Computer EMulator.
* An emulator of (mostly) x86-based PC systems and devices,
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
* spanning the era between 1981 and 1995.
*
* This file is part of the VARCem Project.
*
* Definitions for the ISAMEM cards.
* Definitions for the ISAMEM cards.
*
*
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2018 Fred N. van Kempen.
* Copyright 2018 Fred N. van Kempen.
*
* Redistribution and use in source and binary forms, with
* or without modification, are permitted provided that the
* following conditions are met:
* Redistribution and use in source and binary forms, with
* or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the entire
* above notice, this list of conditions and the following
* disclaimer.
* 1. Redistributions of source code must retain the entire
* above notice, this list of conditions and the following
* disclaimer.
*
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names
* of its contributors may be used to endorse or promote
* products derived from this software without specific
* prior written permission.
* 3. Neither the name of the copyright holder nor the names
* of its contributors may be used to endorse or promote
* products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
@@ -44,12 +42,11 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ISAMEM_H
# define ISAMEM_H
#ifndef EMU_ISAMEM_H
#define EMU_ISAMEM_H
#define ISAMEM_MAX 4 /* max #cards in system */
#define ISAMEM_MAX 4 /* max #cards in system */
#ifdef __cplusplus
extern "C" {
@@ -60,18 +57,16 @@ extern const device_t isamem_device;
extern const device_t isamem_brat80_device;
extern const device_t isamem_ev159_device;
/* Functions. */
extern void isamem_reset(void);
extern void isamem_reset(void);
extern const char *isamem_get_name(int t);
extern const char *isamem_get_internal_name(int t);
extern int isamem_get_from_internal_name(const char *s);
extern const device_t *isamem_get_device(int t);
extern const char *isamem_get_name(int t);
extern const char *isamem_get_internal_name(int t);
extern int isamem_get_from_internal_name(const char *s);
extern const device_t *isamem_get_device(int t);
#ifdef __cplusplus
}
#endif
#endif /*ISAMEM_H*/
#endif /*EMU_ISAMEM_H*/

View File

@@ -1,69 +1,70 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Definitions for ISA Plug and Play.
* Definitions for ISA Plug and Play.
*
*
*
* Author: RichardG, <richardg867@gmail.com>
* Authors: RichardG, <richardg867@gmail.com>
*
* Copyright 2021 RichardG.
* Copyright 2021 RichardG.
*/
#ifndef EMU_ISAPNP_H
# define EMU_ISAPNP_H
# include <stdint.h>
#define ISAPNP_MEM_DISABLED 0
#define ISAPNP_IO_DISABLED 0
#define ISAPNP_IRQ_DISABLED 0
#define ISAPNP_DMA_DISABLED 4
#define EMU_ISAPNP_H
#include <stdint.h>
#define ISAPNP_MEM_DISABLED 0
#define ISAPNP_IO_DISABLED 0
#define ISAPNP_IRQ_DISABLED 0
#define ISAPNP_DMA_DISABLED 4
enum {
ISAPNP_CARD_DISABLE = 0,
ISAPNP_CARD_ENABLE = 1,
ISAPNP_CARD_FORCE_CONFIG /* cheat code for UMC UM8669F */
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 */
};
typedef struct {
uint8_t activate;
struct {
uint32_t base: 24, size: 24;
typedef struct isapnp_device_config_t {
uint8_t activate;
struct pnp_mem_t {
uint32_t base : 24;
uint32_t size : 24;
} mem[4];
struct {
uint32_t base, size;
struct pnp_mem32_t {
uint32_t base;
uint32_t size;
} mem32[4];
struct {
uint16_t base;
struct pnp_io_t {
uint16_t base;
} io[8];
struct {
uint8_t irq: 4, level: 1, type: 1;
struct pnp_irq_t {
uint8_t irq : 4;
uint8_t level : 1;
uint8_t type : 1;
} irq[2];
struct {
uint8_t dma: 3;
struct pnp_dma_t {
uint8_t dma : 3;
} dma[2];
} isapnp_device_config_t;
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);
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);
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);
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);
#endif /*EMU_ISAPNP_H*/
#endif /*EMU_ISAPNP_H*/

View File

@@ -1,36 +1,34 @@
/*
* VARCem Virtual ARchaeological Computer EMulator.
* An emulator of (mostly) x86-based PC systems and devices,
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
* spanning the era between 1981 and 1995.
* VARCem Virtual ARchaeological Computer EMulator.
* An emulator of (mostly) x86-based PC systems and devices,
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
* spanning the era between 1981 and 1995.
*
* This file is part of the VARCem Project.
*
* Definitions for the ISARTC cards.
* Definitions for the ISARTC cards.
*
*
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2018 Fred N. van Kempen.
* Copyright 2018 Fred N. van Kempen.
*
* Redistribution and use in source and binary forms, with
* or without modification, are permitted provided that the
* following conditions are met:
* Redistribution and use in source and binary forms, with
* or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the entire
* above notice, this list of conditions and the following
* disclaimer.
* 1. Redistributions of source code must retain the entire
* above notice, this list of conditions and the following
* disclaimer.
*
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names
* of its contributors may be used to endorse or promote
* products derived from this software without specific
* prior written permission.
* 3. Neither the name of the copyright holder nor the names
* of its contributors may be used to endorse or promote
* products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
@@ -44,9 +42,9 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ISARTC_H
# define ISARTC_H
#ifndef EMU_ISARTC_H
#define EMU_ISARTC_H
#ifdef __cplusplus
extern "C" {
@@ -54,17 +52,15 @@ extern "C" {
/* Global variables. */
/* Functions. */
extern void isartc_reset(void);
extern void isartc_reset(void);
extern char *isartc_get_internal_name(int t);
extern int isartc_get_from_internal_name(char *s);
extern const device_t *isartc_get_device(int t);
extern const char *isartc_get_internal_name(int t);
extern int isartc_get_from_internal_name(char *s);
extern const device_t *isartc_get_device(int t);
#ifdef __cplusplus
}
#endif
#endif /*ISARTC_H*/
#endif /*EMU_ISARTC_H*/

View File

@@ -1,20 +1,20 @@
/*
* VARCem Virtual ARchaeological Computer EMulator.
* An emulator of (mostly) x86-based PC systems and devices,
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
* spanning the era between 1981 and 1995.
* 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 VARCem Project.
* This file is part of the 86Box distribution.
*
* Definitions for the Flight Stick Pro driver.
* Definitions for the Flight Stick Pro driver.
*
*
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Sarah Walker, <tommowalker@tommowalker.co.uk>
* Authors: Miran Grca, <mgrca8@gmail.com>
* Sarah Walker, <https://pcem-emulator.co.uk/>
*
* Copyright 2016-2018 Miran Grca.
* Copyright 2008-2018 Sarah Walker.
* Copyright 2016-2018 Miran Grca.
* Copyright 2008-2018 Sarah Walker.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -35,4 +35,9 @@
* USA.
*/
#ifndef EMU_JOYSTICK_CH_FLIGHTSTICK_PRO_H
#define EMU_JOYSTICK_CH_FLIGHTSTICK_PRO_H
extern const joystick_if_t joystick_ch_flightstick_pro;
#endif /*EMU_JOYSTICK_CH_FLIGHTSTICK_PRO_H*/

View File

@@ -1,20 +1,20 @@
/*
* VARCem Virtual ARchaeological Computer EMulator.
* An emulator of (mostly) x86-based PC systems and devices,
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
* spanning the era between 1981 and 1995.
* 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 VARCem Project.
* This file is part of the 86Box distribution.
*
* Definitions for the joystick driver.
* Definitions for the joystick driver.
*
*
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Sarah Walker, <tommowalker@tommowalker.co.uk>
* Authors: Miran Grca, <mgrca8@gmail.com>
* Sarah Walker, <https://pcem-emulator.co.uk/>
*
* Copyright 2016-2018 Miran Grca.
* Copyright 2008-2018 Sarah Walker.
* Copyright 2016-2018 Miran Grca.
* Copyright 2008-2018 Sarah Walker.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -35,6 +35,9 @@
* USA.
*/
#ifndef EMU_JOYSTICK_STANDARD_H
#define EMU_JOYSTICK_STANDARD_H
extern const joystick_if_t joystick_2axis_2button;
extern const joystick_if_t joystick_2axis_4button;
extern const joystick_if_t joystick_3axis_2button;
@@ -42,3 +45,5 @@ extern const joystick_if_t joystick_3axis_4button;
extern const joystick_if_t joystick_4axis_4button;
extern const joystick_if_t joystick_2axis_6button;
extern const joystick_if_t joystick_2axis_8button;
#endif /*EMU_JOYSTICK_STANDARD_H*/

View File

@@ -1,20 +1,20 @@
/*
* VARCem Virtual ARchaeological Computer EMulator.
* An emulator of (mostly) x86-based PC systems and devices,
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
* spanning the era between 1981 and 1995.
* 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 VARCem Project.
* This file is part of the 86Box distribution.
*
* Definitions for the Sidewinder Pro driver.
* Definitions for the Sidewinder Pro driver.
*
*
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Sarah Walker, <tommowalker@tommowalker.co.uk>
* Authors: Miran Grca, <mgrca8@gmail.com>
* Sarah Walker, <https://pcem-emulator.co.uk/>
*
* Copyright 2016-2018 Miran Grca.
* Copyright 2008-2018 Sarah Walker.
* Copyright 2016-2018 Miran Grca.
* Copyright 2008-2018 Sarah Walker.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -35,4 +35,9 @@
* USA.
*/
#ifndef EMU_JOYSTICK_SW_PAD_H
#define EMU_JOYSTICK_SW_PAD_H
extern const joystick_if_t joystick_sw_pad;
#endif /*EMU_JOYSTICK_SW_PAD_H*/

View File

@@ -1,20 +1,20 @@
/*
* VARCem Virtual ARchaeological Computer EMulator.
* An emulator of (mostly) x86-based PC systems and devices,
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
* spanning the era between 1981 and 1995.
* 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 VARCem Project.
* This file is part of the 86Box distribution.
*
* Definitions for the Flight Control System driver.
* Definitions for the Flight Control System driver.
*
*
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Sarah Walker, <tommowalker@tommowalker.co.uk>
* Authors: Miran Grca, <mgrca8@gmail.com>
* Sarah Walker, <https://pcem-emulator.co.uk/>
*
* Copyright 2016-2018 Miran Grca.
* Copyright 2008-2018 Sarah Walker.
* Copyright 2016-2018 Miran Grca.
* Copyright 2008-2018 Sarah Walker.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -35,4 +35,9 @@
* USA.
*/
#ifndef EMU_JOYSTICK_TM_FCS_H
#define EMU_JOYSTICK_TM_FCS_H
extern const joystick_if_t joystick_tm_fcs;
#endif /*EMU_JOYSTICK_TM_FCS_H*/

View File

@@ -1,127 +1,287 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Definitions for the keyboard interface.
* Definitions for the keyboard interface.
*
*
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2008-2019 Sarah Walker.
* Copyright 2016-2019 Miran Grca.
* Copyright 2017-2019 Fred N. van Kempen.
* Copyright 2008-2019 Sarah Walker.
* Copyright 2016-2019 Miran Grca.
* Copyright 2017-2019 Fred N. van Kempen.
*/
#ifndef EMU_KEYBOARD_H
# define EMU_KEYBOARD_H
#define EMU_KEYBOARD_H
enum {
DEV_KBD = 0,
DEV_AUX = 1
};
typedef struct {
const uint8_t mk[4];
const uint8_t brk[4];
enum {
DEV_STATE_MAIN_1 = 0,
DEV_STATE_MAIN_OUT = 1,
DEV_STATE_MAIN_2 = 2,
DEV_STATE_MAIN_CMD = 3,
DEV_STATE_MAIN_WANT_IN = 4,
DEV_STATE_MAIN_IN = 5,
DEV_STATE_EXECUTE_BAT = 6,
DEV_STATE_MAIN_WANT_EXECUTE_BAT = 7
};
/* Used by the AT / PS/2 keyboard controller, common device, keyboard, and mouse. */
typedef struct kbc_at_port_t {
uint8_t wantcmd;
uint8_t dat;
int16_t out_new;
void *priv;
void (*poll)(void *priv);
} kbc_at_port_t;
/* Used by the AT / PS/2 common device, keyboard, and mouse. */
typedef struct atkbc_dev_t {
const char *name; /* name of this device */
uint8_t type;
uint8_t command;
uint8_t last_scan_code;
uint8_t state;
uint8_t resolution;
uint8_t rate;
uint8_t cmd_queue_start;
uint8_t cmd_queue_end;
uint8_t queue_start;
uint8_t queue_end;
uint16_t flags;
/* Internal FIFO, not present on real devices, needed for commands that
output multiple bytes. */
uint8_t cmd_queue[16];
uint8_t queue[64];
int fifo_mask;
int mode;
int x;
int y;
int z;
int b;
int *scan;
void (*process_cmd)(void *priv);
void (*execute_bat)(void *priv);
kbc_at_port_t *port;
} atkbc_dev_t;
typedef struct scancode {
const uint8_t mk[4];
const uint8_t brk[4];
} scancode;
#define STATE_SHIFT_MASK 0x22
#define STATE_RSHIFT 0x20
#define STATE_LSHIFT 0x02
#define STATE_SHIFT_MASK 0x22
#define STATE_RSHIFT 0x20
#define STATE_LSHIFT 0x02
#define FAKE_LSHIFT_ON 0x100
#define FAKE_LSHIFT_OFF 0x101
#define LSHIFT_ON 0x102
#define LSHIFT_OFF 0x103
#define RSHIFT_ON 0x104
#define RSHIFT_OFF 0x105
#define FAKE_LSHIFT_ON 0x100
#define FAKE_LSHIFT_OFF 0x101
#define LSHIFT_ON 0x102
#define LSHIFT_OFF 0x103
#define RSHIFT_ON 0x104
#define RSHIFT_OFF 0x105
/* KBC #define's */
/* IBM-style controllers */
#define KBC_IBM_PC_XT 0x0000 /* IBM PC/XT */
#define KBC_IBM_PCJR 0x0001 /* IBM PCjr */
#define KBC_IBM_TYPE_1 0x0002 /* IBM AT / PS/2 Type 1 */
#define KBC_IBM_TYPE_2 0x0003 /* IBM PS/2 Type 2 */
#define KBC_AMI_ACCESS_METHODS 0x0004 /* Access Methods AMI */
#define KBC_JU_JET 0x0005 /* Ju-Jet */
/* OEM proprietary */
#define KBC_TANDY 0x0011 /* Tandy 1000/1000HX */
#define KBC_TANDY_SL2 0x0012 /* Tandy 1000SL2 */
#define KBC_AMSTRAD 0x0013 /* Amstrad */
#define KBC_OLIVETTI_XT 0x0014 /* Olivetti XT */
#define KBC_OLIVETTI 0x0015 /* Olivetti AT */
#define KBC_TOSHIBA 0x0016 /* Toshiba AT */
#define KBC_COMPAQ 0x0017 /* Compaq */
#define KBC_NCR 0x0018 /* NCR */
#define KBC_QUADTEL 0x0019 /* Quadtel */
#define KBC_SIEMENS 0x001A /* Siemens */
/* Phoenix MultiKey/42 */
#define PHOENIX_MK42_105 0x0521 /* Phoenix MultiKey/42 1.05 */
#define PHOENIX_MK42_129 0x2921 /* Phoenix MultiKey/42 1.29 */
#define PHOENIX_MK42_138 0x3821 /* Phoenix MultiKey/42 1.38 */
#define PHOENIX_MK42_140 0x3821 /* Phoenix MultiKey/42 1.40 */
#define PHOENIX_MKC42_214 0x1422 /* Phoenix MultiKey/C42 2.14 */
#define PHOENIX_MK42I_416 0x1624 /* Phoenix MultiKey/42i 4.16 */
#define PHOENIX_MK42I_419 0x1924 /* Phoenix MultiKey/42i 4.19 */
/* AMI 0x3x */
#define KBC_ACER_V30 0x0030 /* Acer (0xA1 returns nothing, 0xAF returns 0x00) */
#define KBC_AMI_MEGAKEY_SUPER_IO 0x0035 /* AMI '5' MegaKey 1994 NSC (and SM(S)C?) */
#define KBC_AMI_8 0x0038 /* AMI '8' */
/* AMI 0x4x */
#define KBC_AMI_B 0x0042 /* AMI 'B' */
#define KBC_AMI_D 0x0044 /* AMI 'D' */
#define KBC_AMI_E 0x0045 /* AMI 'E' */
#define KBC_AMIKEY 0x0046 /* AMI 'F'/AMIKEY */
#define KBC_AMIKEY_2 0x0048 /* AMI 'H'/AMIEY-2 */
#define KBC_MR 0x004D /* MR 'M' - Temporary classification until we get a dump */
/* AMI 0x5x */
#define KBC_AMI_MEGAKEY_1993 0x0050 /* AMI 'P' MegaKey 1993 */
#define KBC_AMI_MEGAKEY_1994 0x0052 /* AMI 'R' MegaKey 1994 - 0xA0 returns 1993 copyright */
#define KBC_AMI_TRIGEM 0x005A /* TriGem AMI 'Z' (1990 AMI copyright) */
/* AMI 0x6x */
#define KBC_TANDON 0x0061 /* Tandon 'a' - Temporary classification until we get a dump */
/* Holtek */
#define KBC_HT_REGIONAL_6542 0x1046 /* Holtek 'F' (Regional 6542) */
#define KBC_HT_HT6542B_BESTKEY 0x1048 /* Holtek 'H' (Holtek HT6542B, BestKey) */
/* AMI 0x0x clone without command 0xA0 */
#define KBC_UNK_00 0x2000 /* Unknown 0x00 */
#define KBC_UNK_01 0x2001 /* Unknown 0x01 */
/* AMI 0x3x clone without command 0xA0 */
#define KBC_UNK_7 0x2037 /* Unknown '7' - Temporary classification until we get a dump */
#define KBC_UNK_9 0x2037 /* Unknown '9' - Temporary classification until we get a dump */
#define KBC_JETKEY_NO_VER 0x2038 /* No-version JetKey '8' */
/* AMI 0x4x clone without command 0xA0 */
#define KBC_UNK_A 0x2041 /* Unknown 'A' - Temporary classification until we get a dump */
#define KBC_JETKEY_5_W83C42 0x2046 /* JetKey 5.0 'F' and Winbond W83C42 */
#define KBC_UNK_G 0x2047 /* Unknown 'G' - Temporary classification until we get a dump */
#define KBC_MB_300E_SIS 0x2048 /* MB-300E Non-VIA 'H' and SiS 5582/559x */
#define KBC_UNK_L 0x204C /* Unknown 'L' - Temporary classification until we get a dump */
/* AMI 0x0x clone with command 0xA0 (Get Copyright String) only returning 0x00 */
#define KBC_VPC_2007 0x3000 /* Microsoft Virtual PC 2007 - everything returns 0x00 */
/* AMI 0x4x clone with command 0xA0 (Get Copyright String) only returning 0x00 */
#define KBC_ALI_M148X 0x3045 /* ALi M148x 'E'/'U' (0xA1 actually returns 'F' but BIOS shows 'E' or 'U') */
#define KBC_LANCE_UTRON 0x3046 /* Lance LT38C41 'F', Utron */
/* AMI 0x5x clone with command 0xA0 (Get Copyright String) only returning 0x00 */
#define KBC_SARC_6042 0x3055 /* SARC 6042 'U' */
/* Award and clones */
#define KBC_AWARD 0x4200 /* Award (0xA1 returns 0x00) - Temporary classification until we get \
the real 0xAF return */
#define KBC_VIA_VT82C4XN 0x4246 /* VIA VT82C41N, VT82C4N (0xA1 returns 'F') */
#define KBC_VIA_VT82C586A 0x4346 /* VIA VT82C586A (0xA1 returns 'F') */
#define KBC_VIA_VT82C586B 0x4446 /* VIA VT82C586B (0xA1 returns 'F') */
#define KBC_VIA_VT82C686B 0x4546 /* VIA VT82C686B (0xA1 returns 'F') */
/* UMC */
#define KBC_UMC_UM8886 0x5048 /* UMC UM8886 'H' */
/* IBM-style controllers with inverted P1 video type bit polarity */
#define KBC_IBM_TYPE_1_XI8088 0x8000 /* Xi8088: IBM Type 1 */
/* AMI (this is the 0xA1 revision byte) with inverted P1 video type bit polarity */
#define KBC_ACER_V30_INV 0x8030 /* Acer (0xA1 returns nothing, 0xAF returns 0x00) */
/* Holtek with inverted P1 video type bit polarity */
#define KBC_HT_HT6542B_XI8088 0x9048 /* Xi8088: Holtek 'H' (Holtek HT6542B, BestKey) */
/* Award and clones with inverted P1 video type bit polarity */
#define KBC_VIA_VT82C4XN_XI8088 0xC246 /* Xi8088: VIA VT82C41N, VT82C4N (0xA1 returns 'F') */
#ifdef __cplusplus
extern "C" {
#endif
extern uint8_t keyboard_mode;
extern int keyboard_scan;
extern uint8_t keyboard_mode;
extern int keyboard_scan;
extern void (*keyboard_send)(uint16_t val);
extern void kbd_adddata_process(uint16_t val, void (*adddata)(uint16_t val));
extern void (*keyboard_send)(uint16_t val);
extern void kbd_adddata_process(uint16_t val, void (*adddata)(uint16_t val));
extern const scancode scancode_xt[512];
extern const scancode scancode_xt[512];
extern uint8_t keyboard_set3_flags[512];
extern uint8_t keyboard_set3_all_repeat;
extern uint8_t keyboard_set3_all_break;
extern int mouse_queue_start, mouse_queue_end;
extern int mouse_scan;
extern uint8_t keyboard_set3_flags[512];
extern uint8_t keyboard_set3_all_repeat;
extern uint8_t keyboard_set3_all_break;
extern int mouse_queue_start;
extern int mouse_queue_end;
extern int mouse_cmd_queue_start;
extern int mouse_cmd_queue_end;
extern int mouse_scan;
extern kbc_at_port_t *kbc_at_ports[2];
#ifdef EMU_DEVICE_H
extern const device_t keyboard_pc_device;
extern const device_t keyboard_pc82_device;
extern const device_t keyboard_xt_device;
extern const device_t keyboard_xt86_device;
extern const device_t keyboard_xt_compaq_device;
extern const device_t keyboard_tandy_device;
#if defined(DEV_BRANCH) && defined(USE_LASERXT)
extern const device_t keyboard_xt_lxt3_device;
#endif
extern const device_t keyboard_xt_olivetti_device;
extern const device_t keyboard_xt_zenith_device;
extern const device_t keyboard_at_device;
extern const device_t keyboard_at_ami_device;
extern const device_t keyboard_at_toshiba_device;
extern const device_t keyboard_at_olivetti_device;
extern const device_t keyboard_at_ncr_device;
extern const device_t keyboard_ps2_device;
extern const device_t keyboard_ps2_ps1_device;
extern const device_t keyboard_ps2_ps1_pci_device;
extern const device_t keyboard_ps2_xi8088_device;
extern const device_t keyboard_ps2_ami_device;
extern const device_t keyboard_ps2_olivetti_device;
extern const device_t keyboard_ps2_mca_device;
extern const device_t keyboard_ps2_mca_2_device;
extern const device_t keyboard_ps2_quadtel_device;
extern const device_t keyboard_ps2_pci_device;
extern const device_t keyboard_ps2_ami_pci_device;
extern const device_t keyboard_ps2_intel_ami_pci_device;
extern const device_t keyboard_ps2_acer_pci_device;
#endif
extern const device_t keyboard_pc_device;
extern const device_t keyboard_pc82_device;
extern const device_t keyboard_pravetz_device;
extern const device_t keyboard_xt_device;
extern const device_t keyboard_xt86_device;
extern const device_t keyboard_xt_compaq_device;
extern const device_t keyboard_xt_t1x00_device;
extern const device_t keyboard_tandy_device;
# if defined(DEV_BRANCH) && defined(USE_LASERXT)
extern const device_t keyboard_xt_lxt3_device;
# endif /*defined(DEV_BRANCH) && defined(USE_LASERXT) */
extern const device_t keyboard_xt_olivetti_device;
extern const device_t keyboard_xt_zenith_device;
extern const device_t keyboard_xt_hyundai_device;
extern const device_t keyboard_xtclone_device;
extern const device_t keyboard_at_device;
extern const device_t keyboard_at_siemens_device;
extern const device_t keyboard_at_ami_device;
extern const device_t keyboard_at_tg_ami_device;
extern const device_t keyboard_at_toshiba_device;
extern const device_t keyboard_at_olivetti_device;
extern const device_t keyboard_at_ncr_device;
extern const device_t keyboard_at_compaq_device;
extern const device_t keyboard_ps2_device;
extern const device_t keyboard_ps2_ps1_device;
extern const device_t keyboard_ps2_ps1_pci_device;
extern const device_t keyboard_ps2_xi8088_device;
extern const device_t keyboard_ps2_ami_device;
extern const device_t keyboard_ps2_tg_ami_device;
extern const device_t keyboard_ps2_tg_ami_green_device;
extern const device_t keyboard_ps2_olivetti_device;
extern const device_t keyboard_ps2_mca_2_device;
extern const device_t keyboard_ps2_quadtel_device;
extern const device_t keyboard_ps2_pci_device;
extern const device_t keyboard_ps2_ami_pci_device;
extern const device_t keyboard_ps2_intel_ami_pci_device;
extern const device_t keyboard_ps2_acer_pci_device;
extern const device_t keyboard_ps2_ali_pci_device;
extern const device_t keyboard_ps2_tg_ami_pci_device;
extern void keyboard_init(void);
extern void keyboard_close(void);
extern void keyboard_set_table(const scancode *ptr);
extern void keyboard_poll_host(void);
extern void keyboard_process(void);
extern uint16_t keyboard_convert(int ch);
extern void keyboard_input(int down, uint16_t scan);
extern void keyboard_update_states(uint8_t cl, uint8_t nl, uint8_t sl);
extern uint8_t keyboard_get_shift(void);
extern void keyboard_get_states(uint8_t *cl, uint8_t *nl, uint8_t *sl);
extern void keyboard_set_states(uint8_t cl, uint8_t nl, uint8_t sl);
extern int keyboard_recv(uint16_t key);
extern int keyboard_isfsexit(void);
extern int keyboard_ismsexit(void);
extern void keyboard_set_is_amstrad(int ams);
extern const device_t keyboard_at_generic_device;
#endif /*EMU_DEVICE_H*/
extern void keyboard_at_adddata_mouse(uint8_t val);
extern void keyboard_at_adddata_mouse_direct(uint8_t val);
extern void keyboard_at_adddata_mouse_cmd(uint8_t val);
extern void keyboard_at_mouse_reset(void);
extern uint8_t keyboard_at_mouse_pos(void);
extern int keyboard_at_fixed_channel(void);
extern void keyboard_at_set_mouse(void (*mouse_write)(uint8_t val,void *), void *);
extern void keyboard_at_set_a20_key(int state);
extern void keyboard_at_set_mode(int ps2);
extern uint8_t keyboard_at_get_mouse_scan(void);
extern void keyboard_at_set_mouse_scan(uint8_t val);
extern void keyboard_at_reset(void);
extern void keyboard_init(void);
extern void keyboard_close(void);
extern void keyboard_set_table(const scancode *ptr);
extern void keyboard_poll_host(void);
extern void keyboard_process(void);
extern uint16_t keyboard_convert(int ch);
extern void keyboard_input(int down, uint16_t scan);
extern void keyboard_update_states(uint8_t cl, uint8_t nl, uint8_t sl);
extern uint8_t keyboard_get_shift(void);
extern void keyboard_get_states(uint8_t *cl, uint8_t *nl, uint8_t *sl);
extern void keyboard_set_states(uint8_t cl, uint8_t nl, uint8_t sl);
extern int keyboard_recv(uint16_t key);
extern int keyboard_isfsenter(void);
extern int keyboard_isfsenter_up(void);
extern int keyboard_isfsexit(void);
extern int keyboard_isfsexit_up(void);
extern int keyboard_ismsexit(void);
extern void keyboard_set_is_amstrad(int ams);
extern uint8_t kbc_at_dev_queue_pos(atkbc_dev_t *dev, uint8_t main);
extern void kbc_at_dev_queue_add(atkbc_dev_t *dev, uint8_t val, uint8_t main);
extern void kbc_at_dev_reset(atkbc_dev_t *dev, int do_fa);
extern atkbc_dev_t *kbc_at_dev_init(uint8_t inst);
#ifdef __cplusplus
}
#endif
#endif /*EMU_KEYBOARD_H*/
#endif /*EMU_KEYBOARD_H*/

View File

@@ -1,258 +1,284 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Definitions for the language management module.
*
* NOTE: FIXME: Strings 2176 and 2193 are same.
* Definitions for the language management module.
*
*
*
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2017,2018 Fred N. van Kempen.
* Copyright 2017-2018 Fred N. van Kempen.
* Copyright 2022 Jasmine Iwanek.
*/
#ifndef LANG_UAGE_H
# define LANG_UAGE_H
#ifndef LANG_UAGE_H
#define LANG_UAGE_H
/* String IDs. */
#define IDS_STRINGS 2048 // "86Box"
#define IDS_2049 2049 // "Error"
#define IDS_2050 2050 // "Fatal error"
#define IDS_2051 2051 // " - PAUSED"
#define IDS_2052 2052 // "Press Ctrl+Alt+PgDn..."
#define IDS_2053 2053 // "Speed"
#define IDS_2054 2054 // "ZIP %i (%03i): %ls"
#define IDS_2055 2055 // "ZIP images (*.IM?)\0*.IM..."
#define IDS_2056 2056 // "No usable ROM images found!"
#define IDS_2057 2057 // "(empty)"
#define IDS_2058 2058 // "ZIP images (*.IM?)\0*.IM..."
#define IDS_2059 2059 // "(Turbo)"
#define IDS_2060 2060 // "On"
#define IDS_2061 2061 // "Off"
#define IDS_2062 2062 // "All floppy images (*.DSK..."
#define IDS_2063 2063 // "Machine ""%hs"" is not..."
#define IDS_2064 2064 // "Video card ""%hs"" is not..."
#define IDS_2065 2065 // "Machine"
#define IDS_2066 2066 // "Display"
#define IDS_2067 2067 // "Input devices"
#define IDS_2068 2068 // "Sound"
#define IDS_2069 2069 // "Network"
#define IDS_2070 2070 // "Ports (COM & LPT)"
#define IDS_2071 2071 // "Storage controllers"
#define IDS_2072 2072 // "Hard disks"
#define IDS_2073 2073 // "Floppy and CD-ROM drives"
#define IDS_2074 2074 // "Other removable devices"
#define IDS_2075 2075 // "Other peripherals"
#define IDS_2076 2076 // "Surface-based images (*.8.."
#define IDS_2077 2077 // "Click to capture mouse"
#define IDS_2078 2078 // "Press F12-F8 to release mouse"
#define IDS_2079 2079 // "Press F12-F8 or middle button.."
#define IDS_2080 2080 // "Unable to initialize Flui.."
#define IDS_2081 2081 // "Bus"
#define IDS_2082 2082 // "File"
#define IDS_2083 2083 // "C"
#define IDS_2084 2084 // "H"
#define IDS_2085 2085 // "S"
#define IDS_2086 2086 // "MB"
#define IDS_2087 2087 // "Check BPB"
#define IDS_2088 2088 // "KB"
#define IDS_2089 2089 // "Could not initialize the video..."
#define IDS_2090 2090 // "Default"
#define IDS_2091 2091 // "%i Wait state(s)"
#define IDS_2092 2092 // "Type"
#define IDS_2093 2093 // "PCap failed to set up.."
#define IDS_2094 2094 // "No PCap devices found"
#define IDS_2095 2095 // "Invalid PCap device"
#define IDS_2096 2096 // "Standard 2-button joystick(s)"
#define IDS_2097 2097 // "Standard 4-button joystick"
#define IDS_2098 2098 // "Standard 6-button joystick"
#define IDS_2099 2099 // "Standard 8-button joystick"
#define IDS_2100 2100 // "CH Flightstick Pro"
#define IDS_2101 2101 // "Microsoft SideWinder Pad"
#define IDS_2102 2102 // "Thrustmaster Flight Cont.."
#define IDS_2103 2103 // "None"
#define IDS_2104 2104 // "Unable to load keyboard..."
#define IDS_2105 2105 // "Unable to register raw input."
#define IDS_2106 2106 // "%u"
#define IDS_2107 2107 // "%u MB (CHS: %i, %i, %i)"
#define IDS_2108 2108 // "Floppy %i (%s): %ls"
#define IDS_2109 2109 // "All floppy images (*.0??;*.."
#define IDS_2110 2110 // "Unable to initialize Free.."
#define IDS_2111 2111 // "Unable to initialize SDL..."
#define IDS_2112 2112 // "Are you sure you want to..."
#define IDS_2113 2113 // "Are you sure you want to..."
#define IDS_2114 2114 // "Unable to initialize Ghostscript..."
#define IDS_2115 2115 // "MO %i (%03i): %ls"
#define IDS_2116 2116 // "MO images (*.IM?)\0*.IM..."
#define IDS_2117 2117 // "Welcome to 86Box!"
#define IDS_2118 2118 // "Internal controller"
#define IDS_2119 2119 // "Exit"
#define IDS_2120 2120 // "No ROMs found"
#define IDS_2121 2121 // "Do you want to save the settings?"
#define IDS_2122 2122 // "This will hard reset the emulated..."
#define IDS_2123 2123 // "Save"
#define IDS_2124 2124 // "About 86Box"
#define IDS_2125 2125 // "86Box v" EMU_VERSION
#define IDS_2126 2126 // "An emulator of old computers..."
#define IDS_2127 2127 // "OK"
#define IDS_2128 2128 // "Hardware not available"
#define IDS_2129 2129 // "Make sure " LIB_NAME_PCAP "..."
#define IDS_2130 2130 // "Invalid configuration"
#define IDS_2131 2131 // LIB_NAME_FREETYPE " is required..."
#define IDS_2132 2132 // LIB_NAME_GS " is required for...
#define IDS_2133 2133 // LIB_NAME_FLUIDSYNTH " is required..."
#define IDS_2134 2134 // "Entering fullscreen mode"
#define IDS_2135 2135 // "Don't show this message again"
#define IDS_2136 2136 // "Don't exit"
#define IDS_2137 2137 // "Reset"
#define IDS_2138 2138 // "Don't reset"
#define IDS_2139 2139 // "MO images (*.IM?)\0*.IM?..."
#define IDS_2140 2140 // "CD-ROM images (*.ISO;*.CU.."
#define IDS_2141 2141 // "%hs Device Configuration"
#define IDS_2142 2142 // "Monitor in sleep mode"
#define IDS_2143 2143 // "OpenGL Shaders (*.GLSL)..."
#define IDS_2144 2144 // "OpenGL options"
#define IDS_2145 2145 // "You are loading an unsupported..."
#define IDS_2146 2146 // "CPU type filtering based on..."
#define IDS_2147 2147 // "Continue"
#define IDS_2148 2148 // "Cassette: %s"
#define IDS_2149 2149 // "Cassette images (*.PCM;*.RAW;*..."
#define IDS_2150 2150 // "Cartridge %i: %ls"
#define IDS_2151 2151 // "Cartridge images (*.JRC)\0*.JRC\0..."
#define IDS_2152 2152 // "Error initializing renderer"
#define IDS_2153 2153 // "OpenGL (3.0 Core) renderer could not be initialized. Use another renderer."
#define IDS_2154 2154 // "Resume execution"
#define IDS_2155 2155 // "Pause execution"
#define IDS_2156 2156 // "Press Ctrl+Alt+Del"
#define IDS_2157 2157 // "Press Ctrl+Alt+Esc"
#define IDS_2158 2158 // "Hard reset"
#define IDS_2159 2159 // "ACPI shutdown"
#define IDS_2160 2160 // "Settings"
#define IDS_STRINGS 2048 // "86Box"
#define IDS_2049 2049 // "Error"
#define IDS_2050 2050 // "Fatal error"
#define IDS_2051 2051 // " - PAUSED"
#define IDS_2052 2052 // "Press Ctrl+Alt+PgDn..."
#define IDS_2053 2053 // "Speed"
#define IDS_2054 2054 // "ZIP %i (%03i): %ls"
#define IDS_2055 2055 // "ZIP images (*.IM?)\0*.IM..."
#define IDS_2056 2056 // "No usable ROM images found!"
#define IDS_2057 2057 // "(empty)"
#define IDS_2058 2058 // "ZIP images (*.IM?)\0*.IM..."
#define IDS_2059 2059 // "(Turbo)"
#define IDS_2060 2060 // "On"
#define IDS_2061 2061 // "Off"
#define IDS_2062 2062 // "All floppy images (*.DSK..."
#define IDS_2063 2063 // "Machine ""%hs"" is not..."
#define IDS_2064 2064 // "Video card ""%hs"" is not..."
#define IDS_2065 2065 // "Machine"
#define IDS_2066 2066 // "Display"
#define IDS_2067 2067 // "Input devices"
#define IDS_2068 2068 // "Sound"
#define IDS_2069 2069 // "Network"
#define IDS_2070 2070 // "Ports (COM & LPT)"
#define IDS_2071 2071 // "Storage controllers"
#define IDS_2072 2072 // "Hard disks"
#define IDS_2073 2073 // "Floppy and CD-ROM drives"
#define IDS_2074 2074 // "Other removable devices"
#define IDS_2075 2075 // "Other peripherals"
#define IDS_2076 2076 // "Surface-based images (*.8.."
#define IDS_2077 2077 // "Click to capture mouse"
#define IDS_2078 2078 // "Press F12-F8 to release mouse"
#define IDS_2079 2079 // "Press F12-F8 or middle button.."
#define IDS_2081 2081 // "Bus"
#define IDS_BUS IDS_2081 // "Bus"
#define IDS_2082 2082 // "File"
#define IDS_2083 2083 // "C"
#define IDS_2084 2084 // "H"
#define IDS_2085 2085 // "S"
#define IDS_2086 2086 // "MB"
#define IDS_MB IDS_2086 // "MB"
#define IDS_2087 2087 // "Speed"
#define IDS_4096 4096 // "Hard disk (%s)"
#define IDS_4097 4097 // "%01i:%01i"
#define IDS_4098 4098 // "%i"
#define IDS_4099 4099 // "MFM/RLL or ESDI CD-ROM driv.."
#define IDS_4100 4100 // "Custom..."
#define IDS_4101 4101 // "Custom (large)..."
#define IDS_4102 4102 // "Add New Hard Disk"
#define IDS_4103 4103 // "Add Existing Hard Disk"
#define IDS_4104 4104 // "HDI disk images cannot be..."
#define IDS_4105 4105 // "Disk images cannot be larger..."
#define IDS_4106 4106 // "Hard disk images (*.HDI;*.HD.."
#define IDS_4107 4107 // "Unable to open the file for read"
#define IDS_4108 4108 // "Unable to open the file for write"
#define IDS_4109 4109 // "HDI or HDX image with a sect.."
#define IDS_4110 4110 // "USB is not yet supported"
#define IDS_4111 4111 // "Disk image file already exists"
#define IDS_4112 4112 // "Please specify a valid file name."
#define IDS_4113 4113 // "Remember to partition and fo.."
#define IDS_4114 4114 // "Make sure the file exists and..."
#define IDS_4115 4115 // "Make sure the file is being..."
#define IDS_4116 4116 // "Disk image too large"
#define IDS_4117 4117 // "Remember to partition and format..."
#define IDS_4118 4118 // "The selected file will be..."
#define IDS_4119 4119 // "Unsupported disk image"
#define IDS_4120 4120 // "Overwrite"
#define IDS_4121 4121 // "Don't overwrite"
#define IDS_4122 4122 // "Raw image (.img)"
#define IDS_4123 4123 // "HDI image (.hdi)"
#define IDS_4124 4124 // "HDX image (.hdx)"
#define IDS_4125 4125 // "Fixed-size VHD (.vhd)"
#define IDS_4126 4126 // "Dynamic-size VHD (.vhd)"
#define IDS_4127 4127 // "Differencing VHD (.vhd)"
#define IDS_4128 4128 // "Large blocks (2 MB)"
#define IDS_4129 4129 // "Small blocks (512 KB)"
#define IDS_4130 4130 // "VHD files (*.VHD)\0*.VHD\0All..."
#define IDS_4131 4131 // "Select the parent VHD"
#define IDS_4132 4132 // "This could mean that the parent..."
#define IDS_4133 4133 // "Parent and child disk timestamps..."
#define IDS_4134 4134 // "Could not fix VHD timestamp."
#define IDS_4135 4135 // "%01i:%02i"
#define IDS_2088 2088 // "Check BPB"
#define IDS_BPB IDS_2088 // "Check BPB"
#define IDS_4352 4352 // "MFM/RLL"
#define IDS_4353 4353 // "XT IDE"
#define IDS_4354 4354 // "ESDI"
#define IDS_4355 4355 // "IDE"
#define IDS_4356 4356 // "ATAPI"
#define IDS_4357 4357 // "SCSI"
#define IDS_2089 2089 // "KB"
#define IDS_KB IDS_2089 // "KB"
#define IDS_4608 4608 // "MFM/RLL (%01i:%01i)"
#define IDS_4609 4609 // "XT IDE (%01i:%01i)"
#define IDS_4610 4610 // "ESDI (%01i:%01i)"
#define IDS_4611 4611 // "IDE (%01i:%01i)"
#define IDS_4612 4612 // "ATAPI (%01i:%01i)"
#define IDS_4613 4613 // "SCSI (%02i:%02i)"
#define IDS_2090 2090 // "Could not initialize the video..."
#define IDS_5120 5120 // "CD-ROM %i (%s): %s"
#define IDS_2091 2091 // "Default"
#define IDS_DEFAULT IDS_2091 // "Default"
#define IDS_5376 5376 // "Disabled"
#define IDS_5377 5377 // <Reserved>
#define IDS_5378 5378 // <Reserved>
#define IDS_5379 5379 // <Reserved>
#define IDS_5380 5380 // <Reserved>
#define IDS_5381 5381 // "ATAPI"
#define IDS_5382 5382 // "SCSI"
#define IDS_2092 2092 // "%i Wait state(s)"
#define IDS_WS IDS_2092 // "%i Wait state(s)"
#define IDS_5632 5632 // "Disabled"
#define IDS_5633 5633 // <Reserved>
#define IDS_5634 5634 // <Reserved>
#define IDS_5635 5635 // <Reserved>
#define IDS_5636 5636 // <Reserved>
#define IDS_5637 5637 // "ATAPI (%01i:%01i)"
#define IDS_5638 5638 // "SCSI (%02i:%02i)"
#define IDS_2093 2093 // "Type"
#define IDS_TYPE IDS_2093 // "Type"
#define IDS_5888 5888 // "160 kB"
#define IDS_5889 5889 // "180 kB"
#define IDS_5890 5890 // "320 kB"
#define IDS_5891 5891 // "360 kB"
#define IDS_5892 5892 // "640 kB"
#define IDS_5893 5893 // "720 kB"
#define IDS_5894 5894 // "1.2 MB"
#define IDS_5895 5895 // "1.25 MB"
#define IDS_5896 5896 // "1.44 MB"
#define IDS_5897 5897 // "DMF (cluster 1024)"
#define IDS_5898 5898 // "DMF (cluster 2048)"
#define IDS_5899 5899 // "2.88 MB"
#define IDS_5900 5900 // "ZIP 100"
#define IDS_5901 5901 // "ZIP 250"
#define IDS_5902 5902 // "3.5\" 128 MB (ISO 10090)"
#define IDS_5903 5903 // "3.5\" 230 MB (ISO 13963)"
#define IDS_5904 5904 // "3.5\" 540 MB (ISO 15498)"
#define IDS_5905 5905 // "3.5\" 640 MB (ISO 15498)"
#define IDS_5906 5906 // "3.5\" 1.3 GB (GigaMO)"
#define IDS_5907 5907 // "3.5\" 2.3 GB (GigaMO 2)"
#define IDS_5908 5908 // "5.25\" 600 MB"
#define IDS_5909 5909 // "5.25\" 650 MB"
#define IDS_5910 5910 // "5.25\" 1 GB"
#define IDS_5911 5911 // "5.25\" 1.3 GB"
/* TODO */
#define IDS_2094 2094 // "PCap failed to set up.."
#define IDS_2095 2095 // "No PCap devices found"
#define IDS_2096 2096 // "Invalid PCap device"
#define IDS_2097 2097 // "Standard 2-button joystick(s)"
#define IDS_2098 2098 // "Standard 4-button joystick"
#define IDS_2099 2099 // "Standard 6-button joystick"
#define IDS_2100 2100 // "Standard 8-button joystick"
#define IDS_2101 2101 // "CH Flightstick Pro"
#define IDS_2102 2102 // "Microsoft SideWinder Pad"
#define IDS_2103 2103 // "Thrustmaster Flight Cont.."
#define IDS_2104 2104 // "None"
#define IDS_2105 2105 // "Unable to load keyboard..."
#define IDS_2106 2106 // "Unable to register raw input."
#define IDS_2107 2107 // "%u"
#define IDS_2108 2108 // "%u MB (CHS: %i, %i, %i)"
#define IDS_2109 2109 // "Floppy %i (%s): %ls"
#define IDS_2110 2110 // "All floppy images (*.0??;*.."
#define IDS_2112 2112 // "Unable to initialize SDL..."
#define IDS_2113 2113 // "Are you sure you want to..."
#define IDS_2114 2114 // "Are you sure you want to..."
#define IDS_2115 2115 // "Unable to initialize Ghostscript..."
#define IDS_2116 2116 // "MO %i (%03i): %ls"
#define IDS_2117 2117 // "MO images (*.IM?)\0*.IM..."
#define IDS_2118 2118 // "Welcome to 86Box!"
#define IDS_2119 2119 // "Internal controller"
#define IDS_2120 2120 // "Exit"
#define IDS_2121 2121 // "No ROMs found"
#define IDS_2122 2122 // "Do you want to save the settings?"
#define IDS_2123 2123 // "This will hard reset the emulated..."
#define IDS_2124 2124 // "Save"
#define IDS_2125 2125 // "About 86Box"
#define IDS_2126 2126 // "86Box v" EMU_VERSION
#define IDS_2127 2127 // "An emulator of old computers..."
#define IDS_2128 2128 // "OK"
#define IDS_2129 2129 // "Hardware not available"
#define IDS_2130 2130 // "Make sure " LIB_NAME_PCAP "..."
#define IDS_2131 2131 // "Invalid configuration"
#define IDS_2133 2133 // LIB_NAME_GS " is required for...
#define IDS_2135 2135 // "Entering fullscreen mode"
#define IDS_2136 2136 // "Don't show this message again"
#define IDS_2137 2137 // "Don't exit"
#define IDS_2138 2138 // "Reset"
#define IDS_2139 2139 // "Don't reset"
#define IDS_2140 2140 // "MO images (*.IM?)\0*.IM?..."
#define IDS_2141 2141 // "CD-ROM images (*.ISO;*.CU.."
#define IDS_2142 2142 // "%hs Device Configuration"
#define IDS_2143 2143 // "Monitor in sleep mode"
#define IDS_2144 2144 // "OpenGL Shaders (*.GLSL)..."
#define IDS_2145 2145 // "OpenGL options"
#define IDS_2146 2146 // "You are loading an unsupported..."
#define IDS_2147 2147 // "CPU type filtering based on..."
#define IDS_2148 2148 // "Continue"
#define IDS_2149 2149 // "Cassette: %s"
#define IDS_2150 2150 // "Cassette images (*.PCM;*.RAW;*..."
#define IDS_2151 2151 // "Cartridge %i: %ls"
#define IDS_2152 2152 // "Cartridge images (*.JRC)\0*.JRC\0..."
#define IDS_2153 2153 // "Error initializing renderer"
#define IDS_2154 2154 // "OpenGL (3.0 Core) renderer could not be initialized. Use another renderer."
#define IDS_2155 2155 // "Resume execution"
#define IDS_2156 2156 // "Pause execution"
#define IDS_2157 2157 // "Press Ctrl+Alt+Del"
#define IDS_2158 2158 // "Press Ctrl+Alt+Esc"
#define IDS_2159 2159 // "Hard reset"
#define IDS_2160 2160 // "ACPI shutdown"
#define IDS_2161 2161 // "Settings"
#define IDS_2162 2162 // "Early drive"
#define IDS_2163 2163 // "no dynarec"
#define IDS_2164 2164 // "old dynarec"
#define IDS_2165 2165 // "new dynarec"
#ifdef USE_DYNAREC
# ifdef USE_NEW_DYNAREC
# define IDS_DYNAREC IDS_2165
# else
# define IDS_DYNAREC IDS_2164
# endif
#else
# define IDS_DYNAREC IDS_2163
#endif
#define IDS_2166 2166 // "Video card #2 ""%hs"" is not..."
#define IDS_2167 2167 // "Network driver initialization failed"
#define IDS_2168 2168 // "The network configuration will be switched to the null driver"
#define IDS_6144 6144 // "Perfect RPM"
#define IDS_6145 6145 // "1%% below perfect RPM"
#define IDS_6146 6146 // "1.5%% below perfect RPM"
#define IDS_6147 6147 // "2%% below perfect RPM"
#define IDS_4096 4096 // "Hard disk (%s)"
#define IDS_4097 4097 // "%01i:%01i"
#define IDS_4098 4098 // "%i"
#define IDS_4099 4099 // "MFM/RLL or ESDI CD-ROM driv.."
#define IDS_4100 4100 // "Custom..."
#define IDS_4101 4101 // "Custom (large)..."
#define IDS_4102 4102 // "Add New Hard Disk"
#define IDS_4103 4103 // "Add Existing Hard Disk"
#define IDS_4104 4104 // "HDI disk images cannot be..."
#define IDS_4105 4105 // "Disk images cannot be larger..."
#define IDS_4106 4106 // "Hard disk images (*.HDI;*.HD.."
#define IDS_4107 4107 // "Unable to open the file for read"
#define IDS_4108 4108 // "Unable to open the file for write"
#define IDS_4109 4109 // "HDI or HDX image with a sect.."
#define IDS_4110 4110 // "USB is not yet supported"
#define IDS_4111 4111 // "Disk image file already exists"
#define IDS_4112 4112 // "Please specify a valid file name."
#define IDS_4113 4113 // "Remember to partition and fo.."
#define IDS_4114 4114 // "Make sure the file exists and..."
#define IDS_4115 4115 // "Make sure the file is being..."
#define IDS_4116 4116 // "Disk image too large"
#define IDS_4117 4117 // "Remember to partition and format..."
#define IDS_4118 4118 // "The selected file will be..."
#define IDS_4119 4119 // "Unsupported disk image"
#define IDS_4120 4120 // "Overwrite"
#define IDS_4121 4121 // "Don't overwrite"
#define IDS_4122 4122 // "Raw image (.img)"
#define IDS_4123 4123 // "HDI image (.hdi)"
#define IDS_4124 4124 // "HDX image (.hdx)"
#define IDS_4125 4125 // "Fixed-size VHD (.vhd)"
#define IDS_4126 4126 // "Dynamic-size VHD (.vhd)"
#define IDS_4127 4127 // "Differencing VHD (.vhd)"
#define IDS_4128 4128 // "Large blocks (2 MB)"
#define IDS_4129 4129 // "Small blocks (512 KB)"
#define IDS_4130 4130 // "VHD files (*.VHD)\0*.VHD\0All..."
#define IDS_4131 4131 // "Select the parent VHD"
#define IDS_4132 4132 // "This could mean that the parent..."
#define IDS_4133 4133 // "Parent and child disk timestamps..."
#define IDS_4134 4134 // "Could not fix VHD timestamp."
#define IDS_4135 4135 // "%01i:%02i"
#define IDS_7168 7168 // "(System Default)"
#define IDS_4352 4352 // "MFM/RLL"
#define IDS_4353 4353 // "XT IDE"
#define IDS_4354 4354 // "ESDI"
#define IDS_4355 4355 // "IDE"
#define IDS_4356 4356 // "ATAPI"
#define IDS_4357 4357 // "SCSI"
#define IDS_LANG_ENUS IDS_7168
#define IDS_4608 4608 // "MFM/RLL (%01i:%01i)"
#define IDS_4609 4609 // "XT IDE (%01i:%01i)"
#define IDS_4610 4610 // "ESDI (%01i:%01i)"
#define IDS_4611 4611 // "IDE (%01i:%01i)"
#define IDS_4612 4612 // "ATAPI (%01i:%01i)"
#define IDS_4613 4613 // "SCSI (%02i:%02i)"
#define STR_NUM_2048 106
#define STR_NUM_3072 11
#define STR_NUM_4096 40
#define STR_NUM_4352 6
#define STR_NUM_4608 6
#define STR_NUM_5120 1
#define STR_NUM_5376 7
#define STR_NUM_5632 7
#define STR_NUM_5888 24
#define STR_NUM_6144 4
#define STR_NUM_7168 1
#define IDS_5120 5120 // "CD-ROM %i (%s): %s"
#define IDS_5376 5376 // "Disabled"
#define IDS_5377 5377 // <Reserved>
#define IDS_5378 5378 // <Reserved>
#define IDS_5379 5379 // <Reserved>
#define IDS_5380 5380 // <Reserved>
#define IDS_5381 5381 // "ATAPI"
#define IDS_5382 5382 // "SCSI"
#endif /*LANG_UAGE_H*/
#define IDS_5632 5632 // "Disabled"
#define IDS_5633 5633 // <Reserved>
#define IDS_5634 5634 // <Reserved>
#define IDS_5635 5635 // <Reserved>
#define IDS_5636 5636 // <Reserved>
#define IDS_5637 5637 // "ATAPI (%01i:%01i)"
#define IDS_5638 5638 // "SCSI (%02i:%02i)"
#define IDS_5888 5888 // "160 kB"
#define IDS_5889 5889 // "180 kB"
#define IDS_5890 5890 // "320 kB"
#define IDS_5891 5891 // "360 kB"
#define IDS_5892 5892 // "640 kB"
#define IDS_5893 5893 // "720 kB"
#define IDS_5894 5894 // "1.2 MB"
#define IDS_5895 5895 // "1.25 MB"
#define IDS_5896 5896 // "1.44 MB"
#define IDS_5897 5897 // "DMF (cluster 1024)"
#define IDS_5898 5898 // "DMF (cluster 2048)"
#define IDS_5899 5899 // "2.88 MB"
#define IDS_5900 5900 // "ZIP 100"
#define IDS_5901 5901 // "ZIP 250"
#define IDS_5902 5902 // "3.5\" 128 MB (ISO 10090)"
#define IDS_5903 5903 // "3.5\" 230 MB (ISO 13963)"
#define IDS_5904 5904 // "3.5\" 540 MB (ISO 15498)"
#define IDS_5905 5905 // "3.5\" 640 MB (ISO 15498)"
#define IDS_5906 5906 // "3.5\" 1.3 GB (GigaMO)"
#define IDS_5907 5907 // "3.5\" 2.3 GB (GigaMO 2)"
#define IDS_5908 5908 // "5.25\" 600 MB"
#define IDS_5909 5909 // "5.25\" 650 MB"
#define IDS_5910 5910 // "5.25\" 1 GB"
#define IDS_5911 5911 // "5.25\" 1.3 GB"
#define IDS_6144 6144 // "Perfect RPM"
#define IDS_6145 6145 // "1%% below perfect RPM"
#define IDS_6146 6146 // "1.5%% below perfect RPM"
#define IDS_6147 6147 // "2%% below perfect RPM"
#define IDS_7168 7168 // "(System Default)"
#define IDS_LANG_ENUS IDS_7168
#define STR_NUM_2048 121
// UNUSED: #define STR_NUM_3072 11
#define STR_NUM_4096 40
#define STR_NUM_4352 6
#define STR_NUM_4608 6
#define STR_NUM_5120 1
#define STR_NUM_5376 7
#define STR_NUM_5632 7
#define STR_NUM_5888 24
#define STR_NUM_6144 4
#define STR_NUM_7168 1
#endif /*LANG_UAGE_H*/

View File

@@ -1,46 +1,47 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Main include file for the application.
* Main include file for the application.
*
*
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
* Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2021 Miran Grca.
* Copyright 2021 Fred N. van Kempen.
* Copyright 2021 Miran Grca.
* Copyright 2021 Fred N. van Kempen.
*/
#ifndef EMU_LOG_H
# define EMU_LOG_H
#define EMU_LOG_H
#ifndef RELEASE_BUILD
#ifdef __cplusplus
# ifdef __cplusplus
extern "C" {
#endif
# endif
/* Function prototypes. */
extern void log_set_suppr_seen(void *priv, int suppr_seen);
extern void log_set_dev_name(void *priv, char *dev_name);
#ifdef HAVE_STDARG_H
extern void log_out(void *priv, const char *fmt, va_list);
extern void log_fatal(void *priv, const char *fmt, ...);
#endif
extern void * log_open(char *dev_name);
extern void log_close(void *priv);
extern void log_set_suppr_seen(void *priv, int suppr_seen);
extern void log_set_dev_name(void *priv, char *dev_name);
# ifdef HAVE_STDARG_H
extern void log_out(void *priv, const char *fmt, va_list);
extern void log_fatal(void *priv, const char *fmt, ...);
# endif
extern void *log_open(char *dev_name);
extern void log_close(void *priv);
#ifdef __cplusplus
# ifdef __cplusplus
}
#endif
# endif
#else
#define log_fatal(priv, fmt, ...) fatal(fmt, ...)
#endif /*RELEASE_BUILD*/
# define log_fatal(priv, fmt, ...) fatal(fmt, ...)
#endif /*RELEASE_BUILD*/
#endif /*EMU_LOG_H*/
#endif /*EMU_LOG_H*/

View File

@@ -1,77 +1,95 @@
#ifndef EMU_LPT_H
# define EMU_LPT_H
#define EMU_LPT_H
typedef struct
{
#define LPT1_ADDR 0x0378
#define LPT1_IRQ 7
#define LPT2_ADDR 0x0278
#define LPT2_IRQ 5
// LPT 1 on machines when installed
#define LPT_MDA_ADDR 0x03bc
#define LPT_MDA_IRQ 7
#define LPT4_ADDR 0x0268
#define LPT4_IRQ 5
#if 0
#define LPT5_ADDR 0x027c
#define LPT5_IRQ 7
#define LPT6_ADDR 0x026c
#define LPT6_IRQ 5
#endif
typedef struct lpt_device_t {
const char *name;
const char *internal_name;
void * (*init)(void *lpt);
void (*close)(void *p);
void (*write_data)(uint8_t val, void *p);
void (*write_ctrl)(uint8_t val, void *p);
uint8_t (*read_data)(void *p);
uint8_t (*read_status)(void *p);
uint8_t (*read_ctrl)(void *p);
void *(*init)(void *lpt);
void (*close)(void *priv);
void (*write_data)(uint8_t val, void *priv);
void (*write_ctrl)(uint8_t val, void *priv);
uint8_t (*read_data)(void *priv);
uint8_t (*read_status)(void *priv);
uint8_t (*read_ctrl)(void *priv);
} lpt_device_t;
extern void lpt_init(void);
extern void lpt_port_init(int i, uint16_t port);
extern void lpt_port_irq(int i, uint8_t irq);
extern void lpt_port_remove(int i);
extern void lpt1_remove_ams(void);
#define lpt1_init(a) lpt_port_init(0, a)
#define lpt1_irq(a) lpt_port_irq(0, a)
#define lpt1_remove() lpt_port_remove(0)
#define lpt1_init(a) lpt_port_init(0, a)
#define lpt1_irq(a) lpt_port_irq(0, a)
#define lpt1_remove() lpt_port_remove(0)
#define lpt2_init(a) lpt_port_init(1, a)
#define lpt2_irq(a) lpt_port_irq(1, a)
#define lpt2_remove() lpt_port_remove(1)
#define lpt2_init(a) lpt_port_init(1, a)
#define lpt2_irq(a) lpt_port_irq(1, a)
#define lpt2_remove() lpt_port_remove(1)
#define lpt3_init(a) lpt_port_init(2, a)
#define lpt3_irq(a) lpt_port_irq(2, a)
#define lpt3_remove() lpt_port_remove(2)
#define lpt3_init(a) lpt_port_init(2, a)
#define lpt3_irq(a) lpt_port_irq(2, a)
#define lpt3_remove() lpt_port_remove(2)
#define lpt4_init(a) lpt_port_init(3, a)
#define lpt4_irq(a) lpt_port_irq(3, a)
#define lpt4_remove() lpt_port_remove(3)
#define lpt4_init(a) lpt_port_init(3, a)
#define lpt4_irq(a) lpt_port_irq(3, a)
#define lpt4_remove() lpt_port_remove(3)
/*
#define lpt5_init(a) lpt_port_init(4, a)
#define lpt5_irq(a) lpt_port_irq(4, a)
#define lpt5_remove() lpt_port_remove(4)
#define lpt6_init(a) lpt_port_init(5, a)
#define lpt6_irq(a) lpt_port_irq(5, a)
#define lpt6_remove() lpt_port_remove(5)
*/
#if 0
#define lpt5_init(a) lpt_port_init(4, a)
#define lpt5_irq(a) lpt_port_irq(4, a)
#define lpt5_remove() lpt_port_remove(4)
#define lpt6_init(a) lpt_port_init(5, a)
#define lpt6_irq(a) lpt_port_irq(5, a)
#define lpt6_remove() lpt_port_remove(5)
#endif
void lpt_devices_init(void);
void lpt_devices_close(void);
typedef struct {
uint8_t enabled, irq,
dat, ctrl;
uint16_t addr, pad0;
int device, enable_irq;
lpt_device_t * dt;
void * priv;
typedef struct lpt_port_t {
uint8_t enabled;
uint8_t irq;
uint8_t dat;
uint8_t ctrl;
uint16_t addr;
uint16_t pad0;
int device;
int enable_irq;
lpt_device_t *dt;
void *priv;
} lpt_port_t;
extern lpt_port_t lpt_ports[PARALLEL_MAX];
extern lpt_port_t lpt_ports[PARALLEL_MAX];
extern void lpt_write(uint16_t port, uint8_t val, void *priv);
extern uint8_t lpt_read(uint16_t port, void *priv);
extern void lpt_write(uint16_t port, uint8_t val, void *priv);
extern uint8_t lpt_read(uint16_t port, void *priv);
extern void lpt_irq(void *priv, int raise);
extern uint8_t lpt_read_status(int port);
extern void lpt_irq(void *priv, int raise);
extern char * lpt_device_get_name(int id);
extern char * lpt_device_get_internal_name(int id);
extern const char *lpt_device_get_name(int id);
extern const char *lpt_device_get_internal_name(int id);
extern int lpt_device_get_from_internal_name(char *s);
extern int lpt_device_get_from_internal_name(char *s);
extern const lpt_device_t lpt_dac_device;
extern const lpt_device_t lpt_dac_stereo_device;

View File

@@ -1,26 +1,31 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Header of the emulation of the Amstrad series of PC's:
* PC1512, PC1640 and PC200, including their keyboard, mouse and
* video devices, as well as the PC2086 and PC3086 systems.
* Header of the emulation of the Amstrad series of PC's:
* PC1512, PC1640 and PC200, including their keyboard, mouse and
* video devices, as well as the PC2086 and PC3086 systems.
*
*
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
*
* Copyright 2008-2019 Sarah Walker.
* Copyright 2008-2019 Sarah Walker.
*/
extern int amstrad_latch;
enum
{
#ifndef MACHINE_AMSTRAD_H
#define MACHINE_AMSTRAD_H
extern uint32_t amstrad_latch;
enum {
AMSTRAD_NOLATCH,
AMSTRAD_SW9,
AMSTRAD_SW10
};
#endif /*MACHINE_AMSTRAD.H*/

View File

@@ -1,22 +1,22 @@
/*
* VARCem Virtual ARchaeological Computer EMulator.
* An emulator of (mostly) x86-based PC systems and devices,
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
* spanning the era between 1981 and 1995.
* 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 VARCem Project.
* This file is part of the 86Box distribution.
*
* Definitions for the Toshiba T3100e system.
* Definitions for the Toshiba T3100e system.
*
*
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
* Sarah Walker, <tommowalker@tommowalker.co.uk>
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
* John Elliott, <jce@seasip.info>
*
* Copyright 2017,2018 Fred N. van Kempen.
* Copyright 2016-2018 Miran Grca.
* Copyright 2008-2018 Sarah Walker.
* Copyright 2017-2018 Fred N. van Kempen.
* Copyright 2016-2018 Miran Grca.
* Copyright 2008-2018 John Elliott.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -36,23 +36,21 @@
* Boston, MA 02111-1307
* USA.
*/
#ifndef MACHINE_T3100E_H
# define MACHINE_T3100E_H
#ifndef MACHINE_T3100E_H
#define MACHINE_T3100E_H
extern const device_t t3100e_device;
extern void t3100e_notify_set(uint8_t value);
extern void t3100e_display_set(uint8_t value);
extern uint8_t t3100e_display_get(void);
extern uint8_t t3100e_config_get(void);
extern void t3100e_turbo_set(uint8_t value);
extern uint8_t t3100e_mono_get(void);
extern void t3100e_mono_set(uint8_t value);
extern void t3100e_notify_set(uint8_t value);
extern void t3100e_display_set(uint8_t value);
extern uint8_t t3100e_display_get(void);
extern uint8_t t3100e_config_get(void);
extern void t3100e_turbo_set(uint8_t value);
extern uint8_t t3100e_mono_get(void);
extern void t3100e_mono_set(uint8_t value);
extern void t3100e_video_options_set(uint8_t options);
extern void t3100e_display_set(uint8_t internal);
extern void t3100e_video_options_set(uint8_t options);
extern void t3100e_display_set(uint8_t internal);
#endif /*MACHINE_T3100E_H*/
#endif /*MACHINE_T3100E_H*/

View File

@@ -1,22 +1,22 @@
/*
* VARCem Virtual ARchaeological Computer EMulator.
* An emulator of (mostly) x86-based PC systems and devices,
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
* spanning the era between 1981 and 1995.
* 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 VARCem Project.
* This file is part of the 86Box distribution.
*
* Definitions for the Toshiba T1000/T1200 machines.
* Definitions for the Toshiba T1000/T1200 machines.
*
*
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
* Sarah Walker, <tommowalker@tommowalker.co.uk>
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
* John Elliott, <jce@seasip.info>
*
* Copyright 2017,2018 Fred N. van Kempen.
* Copyright 2016-2018 Miran Grca.
* Copyright 2008-2018 Sarah Walker.
* Copyright 2017-2018 Fred N. van Kempen.
* Copyright 2016-2018 Miran Grca.
* Copyright 2008-2018 John Elliott.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -36,25 +36,23 @@
* Boston, MA 02111-1307
* USA.
*/
#ifndef MACHINE_T1000_H
# define MACHINE_T1000_H
#ifndef MACHINE_T1000_H
#define MACHINE_T1000_H
extern const device_t t1000_video_device;
extern const device_t t1200_video_device;
extern void t1000_video_options_set(uint8_t options);
extern void t1000_video_options_set(uint8_t options);
extern void t1000_video_enable(uint8_t enabled);
extern void t1000_display_set(uint8_t internal);
extern void t1000_display_set(uint8_t internal);
extern void t1000_syskey(uint8_t amask, uint8_t omask, uint8_t xmask);
extern void t1000_syskey(uint8_t amask, uint8_t omask, uint8_t xmask);
extern void t1000_nvr_load(void);
extern void t1000_nvr_save(void);
extern void t1000_nvr_load(void);
extern void t1000_nvr_save(void);
extern void t1200_nvr_load(void);
extern void t1200_nvr_save(void);
extern void t1200_nvr_load(void);
extern void t1200_nvr_save(void);
#endif /*MACHINE_T1000_H*/
#endif /*MACHINE_T1000_H*/

View File

@@ -1,8 +1,13 @@
#ifndef MACHINE_XI80888_H
#define MACHINE_XI80888_H
#include <86box/device.h>
extern const device_t xi8088_device;
uint8_t xi8088_turbo_get();
void xi8088_turbo_set(uint8_t value);
void xi8088_bios_128kb_set(int val);
int xi8088_bios_128kb();
uint8_t xi8088_turbo_get(void);
void xi8088_turbo_set(uint8_t value);
void xi8088_bios_128kb_set(int val);
int xi8088_bios_128kb(void);
#endif /*MACHINE_XI80888_H*/

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,32 @@
#ifndef EMU_MACHINE_STATUS_H
#define EMU_MACHINE_STATUS_H
typedef struct dev_status_empty_active_t {
atomic_bool_t empty;
atomic_bool_t active;
} dev_status_empty_active_t;
typedef struct dev_status_active_t {
atomic_bool_t active;
} dev_status_active_t;
typedef struct dev_status_empty_t {
atomic_bool_t empty;
} dev_status_empty_t;
typedef struct machine_status_t {
dev_status_empty_active_t fdd[FDD_NUM];
dev_status_empty_active_t cdrom[CDROM_NUM];
dev_status_empty_active_t zip[ZIP_NUM];
dev_status_empty_active_t mo[MO_NUM];
dev_status_empty_active_t cassette;
dev_status_active_t hdd[HDD_BUS_USB];
dev_status_empty_active_t net[NET_CARD_MAX];
dev_status_empty_t cartridge[2];
} machine_status_t;
extern machine_status_t machine_status;
extern void machine_status_init(void);
#endif /*EMU_MACHINE_STATUS_H*/

View File

@@ -1,9 +1,16 @@
extern void mca_init(int nr_cards);
extern void mca_add(uint8_t (*read)(int addr, void *priv), void (*write)(int addr, uint8_t val, void *priv), uint8_t (*feedb)(void *priv), void (*reset)(void *priv), void *priv);
extern void mca_set_index(int index);
extern uint8_t mca_read(uint16_t port);
extern void mca_write(uint16_t port, uint8_t val);
extern uint8_t mca_feedb(void);
extern void mca_reset(void);
#ifndef EMU_MCA_H
#define EMU_MCA_H
extern void ps2_cache_clean(void);
extern void mca_init(int nr_cards);
extern void mca_add(uint8_t (*read)(int addr, void *priv), void (*write)(int addr, uint8_t val, void *priv), uint8_t (*feedb)(void *priv), void (*reset)(void *priv), void *priv);
extern void mca_set_index(int index);
extern uint8_t mca_read(uint16_t port);
extern uint8_t mca_read_index(uint16_t port, int index);
extern void mca_write(uint16_t port, uint8_t val);
extern uint8_t mca_feedb(void);
extern int mca_get_nr_cards(void);
extern void mca_reset(void);
extern void ps2_cache_clean(void);
#endif /*EMU_MCA_H*/

View File

@@ -1,77 +1,77 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Definitions for the memory interface.
* Definitions for the memory interface.
*
*
*
* Authors: Sarah Walker, <tommowalker@tommowalker.co.uk>
* Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
* Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
*
* Copyright 2008-2020 Sarah Walker.
* Copyright 2017-2020 Fred N. van Kempen.
* Copyright 2016-2020 Miran Grca.
* Copyright 2008-2020 Sarah Walker.
* Copyright 2017-2020 Fred N. van Kempen.
* Copyright 2016-2020 Miran Grca.
*/
#ifndef EMU_MEM_H
# define EMU_MEM_H
#ifndef EMU_MEM_H
#define EMU_MEM_H
#define MEM_MAP_TO_SHADOW_RAM_MASK 1
#define MEM_MAP_TO_RAM_ADDR_MASK 2
#define STATE_CPU 0
#define STATE_BUS 2
#define STATE_CPU 0
#define STATE_BUS 2
#define ACCESS_CPU 1 /* Update CPU non-SMM access. */
#define ACCESS_CPU_SMM 2 /* Update CPU SMM access. */
#define ACCESS_BUS 4 /* Update bus access. */
#define ACCESS_BUS_SMM 8 /* Update bus SMM access. */
#define ACCESS_NORMAL 5 /* Update CPU and bus non-SMM accesses. */
#define ACCESS_SMM 10 /* Update CPU and bus SMM accesses. */
#define ACCESS_CPU_BOTH 3 /* Update CPU non-SMM and SMM accesses. */
#define ACCESS_BUS_BOTH 12 /* Update bus non-SMM and SMM accesses. */
#define ACCESS_ALL 15 /* Update all accesses. */
#define ACCESS_CPU 1 /* Update CPU non-SMM access. */
#define ACCESS_CPU_SMM 2 /* Update CPU SMM access. */
#define ACCESS_BUS 4 /* Update bus access. */
#define ACCESS_BUS_SMM 8 /* Update bus SMM access. */
#define ACCESS_NORMAL 5 /* Update CPU and bus non-SMM accesses. */
#define ACCESS_SMM 10 /* Update CPU and bus SMM accesses. */
#define ACCESS_CPU_BOTH 3 /* Update CPU non-SMM and SMM accesses. */
#define ACCESS_BUS_BOTH 12 /* Update bus non-SMM and SMM accesses. */
#define ACCESS_ALL 15 /* Update all accesses. */
#define ACCESS_INTERNAL 1
#define ACCESS_ROMCS 2
#define ACCESS_SMRAM 4
#define ACCESS_CACHE 8
#define ACCESS_DISABLED 16
#define ACCESS_INTERNAL 1
#define ACCESS_ROMCS 2
#define ACCESS_SMRAM 4
#define ACCESS_CACHE 8
#define ACCESS_DISABLED 16
#define ACCESS_X_INTERNAL 1
#define ACCESS_X_ROMCS 2
#define ACCESS_X_SMRAM 4
#define ACCESS_X_CACHE 8
#define ACCESS_X_DISABLED 16
#define ACCESS_W_INTERNAL 32
#define ACCESS_W_ROMCS 64
#define ACCESS_W_SMRAM 128
#define ACCESS_W_CACHE 256
#define ACCESS_W_DISABLED 512
#define ACCESS_R_INTERNAL 1024
#define ACCESS_R_ROMCS 2048
#define ACCESS_R_SMRAM 4096
#define ACCESS_R_CACHE 8192
#define ACCESS_R_DISABLED 16384
#define ACCESS_X_INTERNAL 1
#define ACCESS_X_ROMCS 2
#define ACCESS_X_SMRAM 4
#define ACCESS_X_CACHE 8
#define ACCESS_X_DISABLED 16
#define ACCESS_W_INTERNAL 32
#define ACCESS_W_ROMCS 64
#define ACCESS_W_SMRAM 128
#define ACCESS_W_CACHE 256
#define ACCESS_W_DISABLED 512
#define ACCESS_R_INTERNAL 1024
#define ACCESS_R_ROMCS 2048
#define ACCESS_R_SMRAM 4096
#define ACCESS_R_CACHE 8192
#define ACCESS_R_DISABLED 16384
#define ACCESS_EXECUTE 0
#define ACCESS_READ 1
#define ACCESS_WRITE 2
#define ACCESS_EXECUTE 0
#define ACCESS_READ 1
#define ACCESS_WRITE 2
#define ACCESS_SMRAM_OFF 0
#define ACCESS_SMRAM_X 1
#define ACCESS_SMRAM_W 2
#define ACCESS_SMRAM_WX 3
#define ACCESS_SMRAM_R 4
#define ACCESS_SMRAM_RX 5
#define ACCESS_SMRAM_RW 6
#define ACCESS_SMRAM_RWX 7
#define ACCESS_SMRAM_OFF 0
#define ACCESS_SMRAM_X 1
#define ACCESS_SMRAM_W 2
#define ACCESS_SMRAM_WX 3
#define ACCESS_SMRAM_R 4
#define ACCESS_SMRAM_RX 5
#define ACCESS_SMRAM_RW 6
#define ACCESS_SMRAM_RWX 7
/* Conversion #define's - we need these to seamlessly convert the old mem_set_mem_state() calls to
the new stuff in order to make this a drop in replacement.
@@ -79,406 +79,431 @@
Read here includes execute access since the old code also used read access for execute access,
with some exceptions. */
#define MEM_READ_DISABLED (ACCESS_X_DISABLED | ACCESS_R_DISABLED)
#define MEM_READ_INTERNAL (ACCESS_X_INTERNAL | ACCESS_R_INTERNAL)
#define MEM_READ_EXTERNAL 0
#define MEM_READ_DISABLED (ACCESS_X_DISABLED | ACCESS_R_DISABLED)
#define MEM_READ_INTERNAL (ACCESS_X_INTERNAL | ACCESS_R_INTERNAL)
#define MEM_READ_EXTERNAL 0
/* These two are going to be identical - on real hardware, chips that don't care about ROMCS#,
are not magically disabled. */
#define MEM_READ_ROMCS (ACCESS_X_ROMCS | ACCESS_R_ROMCS)
#define MEM_READ_EXTANY MEM_READ_ROMCS
#define MEM_READ_ROMCS (ACCESS_X_ROMCS | ACCESS_R_ROMCS)
#define MEM_READ_EXTANY MEM_READ_ROMCS
/* Internal execute access, external read access. */
#define MEM_READ_EXTERNAL_EX 0
#define MEM_READ_SMRAM (ACCESS_X_SMRAM | ACCESS_R_SMRAM)
#define MEM_READ_CACHE (ACCESS_X_CACHE | ACCESS_R_CACHE)
#define MEM_READ_SMRAM_EX (ACCESS_X_SMRAM)
#define MEM_EXEC_SMRAM MEM_READ_SMRAM_EX
#define MEM_READ_SMRAM_2 (ACCESS_R_SMRAM)
#define MEM_READ_EXTERNAL_EX 0
#define MEM_READ_SMRAM (ACCESS_X_SMRAM | ACCESS_R_SMRAM)
#define MEM_READ_CACHE (ACCESS_X_CACHE | ACCESS_R_CACHE)
#define MEM_READ_SMRAM_EX (ACCESS_X_SMRAM)
#define MEM_EXEC_SMRAM MEM_READ_SMRAM_EX
#define MEM_READ_SMRAM_2 (ACCESS_R_SMRAM)
/* Theese two are going to be identical. */
#define MEM_READ_DISABLED_EX MEM_READ_DISABLED
#define MEM_READ_MASK 0x7c1f
#define MEM_READ_DISABLED_EX MEM_READ_DISABLED
#define MEM_READ_MASK 0x7c1f
#define MEM_WRITE_DISABLED (ACCESS_W_DISABLED)
#define MEM_WRITE_INTERNAL (ACCESS_W_INTERNAL)
#define MEM_WRITE_EXTERNAL 0
#define MEM_WRITE_DISABLED (ACCESS_W_DISABLED)
#define MEM_WRITE_INTERNAL (ACCESS_W_INTERNAL)
#define MEM_WRITE_EXTERNAL 0
/* These two are going to be identical - on real hardware, chips that don't care about ROMCS#,
are not magically disabled. */
#define MEM_WRITE_ROMCS (ACCESS_W_ROMCS)
#define MEM_WRITE_EXTANY (ACCESS_W_ROMCS)
#define MEM_WRITE_SMRAM (ACCESS_W_SMRAM)
#define MEM_WRITE_CACHE (ACCESS_W_CACHE)
#define MEM_WRITE_ROMCS (ACCESS_W_ROMCS)
#define MEM_WRITE_EXTANY (ACCESS_W_ROMCS)
#define MEM_WRITE_SMRAM (ACCESS_W_SMRAM)
#define MEM_WRITE_CACHE (ACCESS_W_CACHE)
/* Theese two are going to be identical. */
#define MEM_WRITE_DISABLED_EX MEM_READ_DISABLED
#define MEM_WRITE_MASK 0x03e0
#define MEM_WRITE_DISABLED_EX MEM_READ_DISABLED
#define MEM_WRITE_MASK 0x03e0
#define MEM_MAPPING_EXTERNAL 1 /* On external bus (ISA/PCI). */
#define MEM_MAPPING_INTERNAL 2 /* On internal bus (RAM). */
#define MEM_MAPPING_ROM_WS 4 /* Executing from ROM may involve additional wait states. */
#define MEM_MAPPING_IS_ROM 8 /* Responds to ROMCS#. */
#define MEM_MAPPING_ROM (MEM_MAPPING_ROM_WS | MEM_MAPPING_IS_ROM)
#define MEM_MAPPING_ROMCS 16 /* If it responds to ROMCS#, it requires ROMCS# asserted. */
#define MEM_MAPPING_SMRAM 32 /* On internal bus (RAM) but SMRAM. */
#define MEM_MAPPING_CACHE 64 /* Cache or MTRR - please avoid such mappings unless
stricly necessary (eg. for CoreBoot). */
#define MEM_MAPPING_EXTERNAL 1 /* On external bus (ISA/PCI). */
#define MEM_MAPPING_INTERNAL 2 /* On internal bus (RAM). */
#define MEM_MAPPING_ROM_WS 4 /* Executing from ROM may involve additional wait states. */
#define MEM_MAPPING_IS_ROM 8 /* Responds to ROMCS#. */
#define MEM_MAPPING_ROM (MEM_MAPPING_ROM_WS | MEM_MAPPING_IS_ROM)
#define MEM_MAPPING_ROMCS 16 /* If it responds to ROMCS#, it requires ROMCS# asserted. */
#define MEM_MAPPING_SMRAM 32 /* On internal bus (RAM) but SMRAM. */
#define MEM_MAPPING_CACHE 64 /* Cache or MTRR - please avoid such mappings unless \
stricly necessary (eg. for CoreBoot). */
/* #define's for memory granularity, currently 4k, less does
not work because of internal 4k pages. */
#define MEM_GRANULARITY_BITS 12
#define MEM_GRANULARITY_SIZE (1 << MEM_GRANULARITY_BITS)
#define MEM_GRANULARITY_HBOUND (MEM_GRANULARITY_SIZE - 2)
#define MEM_GRANULARITY_QBOUND (MEM_GRANULARITY_SIZE - 4)
#define MEM_GRANULARITY_MASK (MEM_GRANULARITY_SIZE - 1)
#define MEM_GRANULARITY_HMASK ((1 << (MEM_GRANULARITY_BITS - 1)) - 1)
#define MEM_GRANULARITY_QMASK ((1 << (MEM_GRANULARITY_BITS - 2)) - 1)
#define MEM_GRANULARITY_PMASK ((1 << (MEM_GRANULARITY_BITS - 3)) - 1)
#define MEM_MAPPINGS_NO ((0x100000 >> MEM_GRANULARITY_BITS) << 12)
#define MEM_GRANULARITY_PAGE (MEM_GRANULARITY_MASK & ~0xfff)
#define MEM_GRANULARITY_BASE (~MEM_GRANULARITY_MASK)
#define MEM_GRANULARITY_BITS 12
#define MEM_GRANULARITY_SIZE (1 << MEM_GRANULARITY_BITS)
#define MEM_GRANULARITY_HBOUND (MEM_GRANULARITY_SIZE - 2)
#define MEM_GRANULARITY_QBOUND (MEM_GRANULARITY_SIZE - 4)
#define MEM_GRANULARITY_MASK (MEM_GRANULARITY_SIZE - 1)
#define MEM_GRANULARITY_HMASK ((1 << (MEM_GRANULARITY_BITS - 1)) - 1)
#define MEM_GRANULARITY_QMASK ((1 << (MEM_GRANULARITY_BITS - 2)) - 1)
#define MEM_GRANULARITY_PMASK ((1 << (MEM_GRANULARITY_BITS - 3)) - 1)
#define MEM_MAPPINGS_NO ((0x100000 >> MEM_GRANULARITY_BITS) << 12)
#define MEM_GRANULARITY_PAGE (MEM_GRANULARITY_MASK & ~0xfff)
#define MEM_GRANULARITY_BASE (~MEM_GRANULARITY_MASK)
/* Compatibility #defines. */
#define mem_set_state(smm, mode, base, size, access) \
mem_set_access((smm ? ACCESS_SMM : ACCESS_NORMAL), mode, base, size, access)
mem_set_access((smm ? ACCESS_SMM : ACCESS_NORMAL), mode, base, size, access)
#define mem_set_mem_state_common(smm, base, size, access) \
mem_set_access((smm ? ACCESS_SMM : ACCESS_NORMAL), 0, base, size, access)
mem_set_access((smm ? ACCESS_SMM : ACCESS_NORMAL), 0, base, size, access)
#define mem_set_mem_state(base, size, access) \
mem_set_access(ACCESS_NORMAL, 0, base, size, access)
mem_set_access(ACCESS_NORMAL, 0, base, size, access)
#define mem_set_mem_state_smm(base, size, access) \
mem_set_access(ACCESS_SMM, 0, base, size, access)
mem_set_access(ACCESS_SMM, 0, base, size, access)
#define mem_set_mem_state_both(base, size, access) \
mem_set_access(ACCESS_ALL, 0, base, size, access)
mem_set_access(ACCESS_ALL, 0, base, size, access)
#define mem_set_mem_state_cpu_both(base, size, access) \
mem_set_access(ACCESS_CPU_BOTH, 0, base, size, access)
mem_set_access(ACCESS_CPU_BOTH, 0, base, size, access)
#define mem_set_mem_state_bus_both(base, size, access) \
mem_set_access(ACCESS_BUS_BOTH, 0, base, size, access)
mem_set_access(ACCESS_BUS_BOTH, 0, base, size, access)
#define mem_set_mem_state_smram(smm, base, size, is_smram) \
mem_set_access((smm ? ACCESS_SMM : ACCESS_NORMAL), 1, base, size, is_smram)
mem_set_access((smm ? ACCESS_SMM : ACCESS_NORMAL), 1, base, size, is_smram)
#define mem_set_mem_state_smram_ex(smm, base, size, is_smram) \
mem_set_access((smm ? ACCESS_SMM : ACCESS_NORMAL), 2, base, size, is_smram)
mem_set_access((smm ? ACCESS_SMM : ACCESS_NORMAL), 2, base, size, is_smram)
#define mem_set_access_smram_cpu(smm, base, size, is_smram) \
mem_set_access((smm ? ACCESS_CPU_SMM : ACCESS_CPU), 1, base, size, is_smram)
mem_set_access((smm ? ACCESS_CPU_SMM : ACCESS_CPU), 1, base, size, is_smram)
#define mem_set_access_smram_bus(smm, base, size, is_smram) \
mem_set_access((smm ? ACCESS_BUS_SMM : ACCESS_BUS), 1, base, size, is_smram)
#define flushmmucache_cr3 \
flushmmucache_nopc
mem_set_access((smm ? ACCESS_BUS_SMM : ACCESS_BUS), 1, base, size, is_smram)
typedef struct {
uint16_t x :5,
w :5,
r :5,
pad :1;
typedef struct state_t {
uint16_t x : 5;
uint16_t w : 5;
uint16_t r : 5;
uint16_t pad : 1;
} state_t;
typedef union {
uint16_t vals[4];
state_t states[4];
typedef union mem_state_t {
uint16_t vals[4];
state_t states[4];
} mem_state_t;
typedef struct _mem_mapping_ {
struct _mem_mapping_ *prev, *next;
struct _mem_mapping_ *prev;
struct _mem_mapping_ *next;
int enable;
int enable;
uint32_t base;
uint32_t size;
uint32_t base;
uint32_t size;
uint8_t (*read_b)(uint32_t addr, void *priv);
uint16_t (*read_w)(uint32_t addr, void *priv);
uint32_t (*read_l)(uint32_t addr, void *priv);
void (*write_b)(uint32_t addr, uint8_t val, void *priv);
void (*write_w)(uint32_t addr, uint16_t val, void *priv);
void (*write_l)(uint32_t addr, uint32_t val, void *priv);
uint32_t mask;
uint8_t *exec;
uint8_t (*read_b)(uint32_t addr, void *priv);
uint16_t (*read_w)(uint32_t addr, void *priv);
uint32_t (*read_l)(uint32_t addr, void *priv);
void (*write_b)(uint32_t addr, uint8_t val, void *priv);
void (*write_w)(uint32_t addr, uint16_t val, void *priv);
void (*write_l)(uint32_t addr, uint32_t val, void *priv);
uint32_t flags;
uint8_t *exec;
uint32_t flags;
/* There is never a needed to pass a pointer to the mapping itself, it is much preferable to
prepare a structure with the requires data (usually, the base address and mask) instead. */
void *p; /* backpointer to device */
void *priv; /* backpointer to device */
} mem_mapping_t;
#ifdef USE_NEW_DYNAREC
extern uint64_t *byte_dirty_mask;
extern uint64_t *byte_code_present_mask;
#define PAGE_BYTE_MASK_SHIFT 6
#define PAGE_BYTE_MASK_OFFSET_MASK 63
#define PAGE_BYTE_MASK_MASK 63
# define PAGE_BYTE_MASK_SHIFT 6
# define PAGE_BYTE_MASK_OFFSET_MASK 63
# define PAGE_BYTE_MASK_MASK 63
#define EVICT_NOT_IN_LIST ((uint32_t)-1)
typedef struct page_t
{
void (*write_b)(uint32_t addr, uint8_t val, struct page_t *p);
void (*write_w)(uint32_t addr, uint16_t val, struct page_t *p);
void (*write_l)(uint32_t addr, uint32_t val, struct page_t *p);
# define EVICT_NOT_IN_LIST ((uint32_t) -1)
typedef struct page_t {
void (*write_b)(uint32_t addr, uint8_t val, struct page_t *page);
void (*write_w)(uint32_t addr, uint16_t val, struct page_t *page);
void (*write_l)(uint32_t addr, uint32_t val, struct page_t *page);
uint8_t *mem;
uint8_t *mem;
uint16_t block, block_2;
uint16_t block, block_2;
/*Head of codeblock tree associated with this page*/
uint16_t head;
uint64_t code_present_mask, dirty_mask;
uint64_t code_present_mask;
uint64_t dirty_mask;
uint32_t evict_prev, evict_next;
uint32_t evict_prev;
uint32_t evict_next;
uint64_t *byte_dirty_mask;
uint64_t *byte_code_present_mask;
} page_t;
extern uint32_t purgable_page_list_head;
static inline int
page_in_evict_list(page_t *p)
__attribute__((always_inline)) static inline int
page_in_evict_list(page_t *page)
{
return (p->evict_prev != EVICT_NOT_IN_LIST);
return (page->evict_prev != EVICT_NOT_IN_LIST);
}
void page_remove_from_evict_list(page_t *p);
void page_add_to_evict_list(page_t *p);
void page_remove_from_evict_list(page_t *page);
void page_add_to_evict_list(page_t *page);
#else
typedef struct _page_ {
void (*write_b)(uint32_t addr, uint8_t val, struct _page_ *p);
void (*write_w)(uint32_t addr, uint16_t val, struct _page_ *p);
void (*write_l)(uint32_t addr, uint32_t val, struct _page_ *p);
void (*write_b)(uint32_t addr, uint8_t val, struct _page_ *page);
void (*write_w)(uint32_t addr, uint16_t val, struct _page_ *page);
void (*write_l)(uint32_t addr, uint32_t val, struct _page_ *page);
uint8_t *mem;
uint8_t *mem;
uint64_t code_present_mask[4],
dirty_mask[4];
uint64_t code_present_mask[4];
uint64_t dirty_mask[4];
struct codeblock_t *block[4], *block_2[4];
struct codeblock_t *block[4];
struct codeblock_t *block_2[4];
/*Head of codeblock tree associated with this page*/
struct codeblock_t *head;
} page_t;
#endif
extern uint8_t *ram;
extern uint8_t *ram2;
extern uint32_t rammask;
extern uint8_t *ram, *ram2;
extern uint32_t rammask;
extern uint8_t *rom;
extern uint32_t biosmask;
extern uint32_t biosaddr;
extern uint8_t *rom;
extern uint32_t biosmask, biosaddr;
extern int readlookup[256];
extern uintptr_t *readlookup2;
extern uintptr_t old_rl2;
extern uint8_t uncached;
extern int readlnext;
extern int writelookup[256];
extern uintptr_t *writelookup2;
extern int writelnext;
extern uint32_t ram_mapped_addr[64];
extern uint8_t page_ff[4096];
extern int readlookup[256];
extern uintptr_t * readlookup2;
extern uintptr_t old_rl2;
extern uint8_t uncached;
extern int readlnext;
extern int writelookup[256];
extern uintptr_t * writelookup2;
extern int writelnext;
extern uint32_t ram_mapped_addr[64];
extern mem_mapping_t ram_low_mapping,
extern mem_mapping_t ram_low_mapping;
#if 1
ram_mid_mapping,
extern mem_mapping_t ram_mid_mapping;
#endif
ram_remapped_mapping,
ram_high_mapping,
ram_2gb_mapping,
bios_mapping,
bios_high_mapping;
extern mem_mapping_t ram_remapped_mapping;
extern mem_mapping_t ram_high_mapping;
extern mem_mapping_t ram_2gb_mapping;
extern mem_mapping_t bios_mapping;
extern mem_mapping_t bios_high_mapping;
extern uint32_t mem_logical_addr;
extern uint32_t mem_logical_addr;
extern page_t *pages,
**page_lookup;
extern page_t *pages;
extern page_t **page_lookup;
extern uint32_t get_phys_virt, get_phys_phys;
extern uint32_t get_phys_virt;
extern uint32_t get_phys_phys;
extern int shadowbios,
shadowbios_write;
extern int readlnum,
writelnum;
extern int shadowbios;
extern int shadowbios_write;
extern int readlnum;
extern int writelnum;
extern int memspeed[11];
extern int memspeed[11];
extern int mmu_perm;
extern uint8_t high_page; /* if a high (> 4 gb) page was detected */
extern int mmu_perm;
extern uint8_t high_page; /* if a high (> 4 gb) page was detected */
extern int mem_a20_state,
mem_a20_alt,
mem_a20_key;
extern uint32_t pages_sz; /* #pages in table */
extern int mem_a20_state;
extern int mem_a20_alt;
extern int mem_a20_key;
extern uint8_t read_mem_b(uint32_t addr);
extern uint16_t read_mem_w(uint32_t addr);
extern void write_mem_b(uint32_t addr, uint8_t val);
extern void write_mem_w(uint32_t addr, uint16_t val);
extern uint8_t read_mem_b(uint32_t addr);
extern uint16_t read_mem_w(uint32_t addr);
extern void write_mem_b(uint32_t addr, uint8_t val);
extern void write_mem_w(uint32_t addr, uint16_t val);
extern uint8_t readmembl(uint32_t addr);
extern void writemembl(uint32_t addr, uint8_t val);
extern uint16_t readmemwl(uint32_t addr);
extern void writememwl(uint32_t addr, uint16_t val);
extern uint32_t readmemll(uint32_t addr);
extern void writememll(uint32_t addr, uint32_t val);
extern uint64_t readmemql(uint32_t addr);
extern void writememql(uint32_t addr, uint64_t val);
extern uint8_t readmembl(uint32_t addr);
extern void writemembl(uint32_t addr, uint8_t val);
extern uint16_t readmemwl(uint32_t addr);
extern void writememwl(uint32_t addr, uint16_t val);
extern uint32_t readmemll(uint32_t addr);
extern void writememll(uint32_t addr, uint32_t val);
extern uint64_t readmemql(uint32_t addr);
extern void writememql(uint32_t addr, uint64_t val);
extern uint8_t readmembl_no_mmut(uint32_t addr, uint32_t a64);
extern void writemembl_no_mmut(uint32_t addr, uint32_t a64, uint8_t val);
extern uint16_t readmemwl_no_mmut(uint32_t addr, uint32_t *a64);
extern void writememwl_no_mmut(uint32_t addr, uint32_t *a64, uint16_t val);
extern uint32_t readmemll_no_mmut(uint32_t addr, uint32_t *a64);
extern void writememll_no_mmut(uint32_t addr, uint32_t *a64, uint32_t val);
extern uint8_t readmembl_no_mmut(uint32_t addr, uint32_t a64);
extern void writemembl_no_mmut(uint32_t addr, uint32_t a64, uint8_t val);
extern uint16_t readmemwl_no_mmut(uint32_t addr, uint32_t *a64);
extern void writememwl_no_mmut(uint32_t addr, uint32_t *a64, uint16_t val);
extern uint32_t readmemll_no_mmut(uint32_t addr, uint32_t *a64);
extern void writememll_no_mmut(uint32_t addr, uint32_t *a64, uint32_t val);
extern void do_mmutranslate(uint32_t addr, uint32_t *a64, int num, int write);
extern void do_mmutranslate(uint32_t addr, uint32_t *a64, int num, int write);
extern uint8_t *getpccache(uint32_t a);
extern uint64_t mmutranslatereal(uint32_t addr, int rw);
extern uint32_t mmutranslatereal32(uint32_t addr, int rw);
extern void addreadlookup(uint32_t virt, uint32_t phys);
extern void addwritelookup(uint32_t virt, uint32_t phys);
extern uint8_t readmembl_2386(uint32_t addr);
extern void writemembl_2386(uint32_t addr, uint8_t val);
extern uint16_t readmemwl_2386(uint32_t addr);
extern void writememwl_2386(uint32_t addr, uint16_t val);
extern uint32_t readmemll_2386(uint32_t addr);
extern void writememll_2386(uint32_t addr, uint32_t val);
extern uint64_t readmemql_2386(uint32_t addr);
extern void writememql_2386(uint32_t addr, uint64_t val);
extern void mem_mapping_set(mem_mapping_t *,
uint32_t base,
uint32_t size,
uint8_t (*read_b)(uint32_t addr, void *p),
uint16_t (*read_w)(uint32_t addr, void *p),
uint32_t (*read_l)(uint32_t addr, void *p),
void (*write_b)(uint32_t addr, uint8_t val, void *p),
void (*write_w)(uint32_t addr, uint16_t val, void *p),
void (*write_l)(uint32_t addr, uint32_t val, void *p),
uint8_t *exec,
uint32_t flags,
void *p);
extern void mem_mapping_add(mem_mapping_t *,
uint32_t base,
uint32_t size,
uint8_t (*read_b)(uint32_t addr, void *p),
uint16_t (*read_w)(uint32_t addr, void *p),
uint32_t (*read_l)(uint32_t addr, void *p),
void (*write_b)(uint32_t addr, uint8_t val, void *p),
void (*write_w)(uint32_t addr, uint16_t val, void *p),
void (*write_l)(uint32_t addr, uint32_t val, void *p),
uint8_t *exec,
uint32_t flags,
void *p);
extern uint8_t readmembl_no_mmut_2386(uint32_t addr, uint32_t a64);
extern void writemembl_no_mmut_2386(uint32_t addr, uint32_t a64, uint8_t val);
extern uint16_t readmemwl_no_mmut_2386(uint32_t addr, uint32_t *a64);
extern void writememwl_no_mmut_2386(uint32_t addr, uint32_t *a64, uint16_t val);
extern uint32_t readmemll_no_mmut_2386(uint32_t addr, uint32_t *a64);
extern void writememll_no_mmut_2386(uint32_t addr, uint32_t *a64, uint32_t val);
extern void mem_mapping_set_handler(mem_mapping_t *,
uint8_t (*read_b)(uint32_t addr, void *p),
uint16_t (*read_w)(uint32_t addr, void *p),
uint32_t (*read_l)(uint32_t addr, void *p),
void (*write_b)(uint32_t addr, uint8_t val, void *p),
void (*write_w)(uint32_t addr, uint16_t val, void *p),
void (*write_l)(uint32_t addr, uint32_t val, void *p));
extern void do_mmutranslate_2386(uint32_t addr, uint32_t *a64, int num, int write);
extern void mem_mapping_set_p(mem_mapping_t *, void *p);
extern uint8_t *getpccache(uint32_t a);
extern uint64_t mmutranslatereal(uint32_t addr, int rw);
extern uint32_t mmutranslatereal32(uint32_t addr, int rw);
extern void addreadlookup(uint32_t virt, uint32_t phys);
extern void addwritelookup(uint32_t virt, uint32_t phys);
extern void mem_mapping_set_addr(mem_mapping_t *,
uint32_t base, uint32_t size);
extern void mem_mapping_set_exec(mem_mapping_t *, uint8_t *exec);
extern void mem_mapping_disable(mem_mapping_t *);
extern void mem_mapping_enable(mem_mapping_t *);
extern void mem_mapping_recalc(uint64_t base, uint64_t size);
extern void mem_mapping_set(mem_mapping_t *,
uint32_t base,
uint32_t size,
uint8_t (*read_b)(uint32_t addr, void *priv),
uint16_t (*read_w)(uint32_t addr, void *priv),
uint32_t (*read_l)(uint32_t addr, void *priv),
void (*write_b)(uint32_t addr, uint8_t val, void *priv),
void (*write_w)(uint32_t addr, uint16_t val, void *priv),
void (*write_l)(uint32_t addr, uint32_t val, void *priv),
uint8_t *exec,
uint32_t flags,
void *priv);
extern void mem_mapping_add(mem_mapping_t *,
uint32_t base,
uint32_t size,
uint8_t (*read_b)(uint32_t addr, void *priv),
uint16_t (*read_w)(uint32_t addr, void *priv),
uint32_t (*read_l)(uint32_t addr, void *priv),
void (*write_b)(uint32_t addr, uint8_t val, void *priv),
void (*write_w)(uint32_t addr, uint16_t val, void *priv),
void (*write_l)(uint32_t addr, uint32_t val, void *priv),
uint8_t *exec,
uint32_t flags,
void *priv);
extern void mem_set_access(uint8_t bitmap, int mode, uint32_t base, uint32_t size, uint16_t access);
extern void mem_mapping_set_handler(mem_mapping_t *,
uint8_t (*read_b)(uint32_t addr, void *priv),
uint16_t (*read_w)(uint32_t addr, void *priv),
uint32_t (*read_l)(uint32_t addr, void *priv),
void (*write_b)(uint32_t addr, uint8_t val, void *priv),
void (*write_w)(uint32_t addr, uint16_t val, void *priv),
void (*write_l)(uint32_t addr, uint32_t val, void *priv));
extern uint8_t mem_readb_phys(uint32_t addr);
extern uint16_t mem_readw_phys(uint32_t addr);
extern uint32_t mem_readl_phys(uint32_t addr);
extern void mem_read_phys(void *dest, uint32_t addr, int tranfer_size);
extern void mem_writeb_phys(uint32_t addr, uint8_t val);
extern void mem_writew_phys(uint32_t addr, uint16_t val);
extern void mem_writel_phys(uint32_t addr, uint32_t val);
extern void mem_write_phys(void *src, uint32_t addr, int tranfer_size);
extern void mem_mapping_set_p(mem_mapping_t *, void *priv);
extern uint8_t mem_read_ram(uint32_t addr, void *priv);
extern uint16_t mem_read_ramw(uint32_t addr, void *priv);
extern uint32_t mem_read_raml(uint32_t addr, void *priv);
extern void mem_write_ram(uint32_t addr, uint8_t val, void *priv);
extern void mem_write_ramw(uint32_t addr, uint16_t val, void *priv);
extern void mem_write_raml(uint32_t addr, uint32_t val, void *priv);
extern void mem_mapping_set_addr(mem_mapping_t *,
uint32_t base, uint32_t size);
extern void mem_mapping_set_exec(mem_mapping_t *, uint8_t *exec);
extern void mem_mapping_set_mask(mem_mapping_t *, uint32_t mask);
extern void mem_mapping_disable(mem_mapping_t *);
extern void mem_mapping_enable(mem_mapping_t *);
extern void mem_mapping_recalc(uint64_t base, uint64_t size);
extern uint8_t mem_read_ram_2gb(uint32_t addr, void *priv);
extern uint16_t mem_read_ram_2gbw(uint32_t addr, void *priv);
extern uint32_t mem_read_ram_2gbl(uint32_t addr, void *priv);
extern void mem_write_ram_2gb(uint32_t addr, uint8_t val, void *priv);
extern void mem_write_ram_2gbw(uint32_t addr, uint16_t val, void *priv);
extern void mem_write_ram_2gbl(uint32_t addr, uint32_t val, void *priv);
extern void mem_set_access(uint8_t bitmap, int mode, uint32_t base, uint32_t size, uint16_t access);
extern int mem_addr_is_ram(uint32_t addr);
extern uint8_t mem_readb_phys(uint32_t addr);
extern uint16_t mem_readw_phys(uint32_t addr);
extern uint32_t mem_readl_phys(uint32_t addr);
extern void mem_read_phys(void *dest, uint32_t addr, int tranfer_size);
extern void mem_writeb_phys(uint32_t addr, uint8_t val);
extern void mem_writew_phys(uint32_t addr, uint16_t val);
extern void mem_writel_phys(uint32_t addr, uint32_t val);
extern void mem_write_phys(void *src, uint32_t addr, int tranfer_size);
extern uint64_t mmutranslate_noabrt(uint32_t addr, int rw);
extern uint8_t mem_read_ram(uint32_t addr, void *priv);
extern uint16_t mem_read_ramw(uint32_t addr, void *priv);
extern uint32_t mem_read_raml(uint32_t addr, void *priv);
extern void mem_write_ram(uint32_t addr, uint8_t val, void *priv);
extern void mem_write_ramw(uint32_t addr, uint16_t val, void *priv);
extern void mem_write_raml(uint32_t addr, uint32_t val, void *priv);
extern void mem_invalidate_range(uint32_t start_addr, uint32_t end_addr);
extern uint8_t mem_read_ram_2gb(uint32_t addr, void *priv);
extern uint16_t mem_read_ram_2gbw(uint32_t addr, void *priv);
extern uint32_t mem_read_ram_2gbl(uint32_t addr, void *priv);
extern void mem_write_ram_2gb(uint32_t addr, uint8_t val, void *priv);
extern void mem_write_ram_2gbw(uint32_t addr, uint16_t val, void *priv);
extern void mem_write_ram_2gbl(uint32_t addr, uint32_t val, void *priv);
extern void mem_write_ramb_page(uint32_t addr, uint8_t val, page_t *p);
extern void mem_write_ramw_page(uint32_t addr, uint16_t val, page_t *p);
extern void mem_write_raml_page(uint32_t addr, uint32_t val, page_t *p);
extern void mem_flush_write_page(uint32_t addr, uint32_t virt);
extern int mem_addr_is_ram(uint32_t addr);
extern void mem_reset_page_blocks(void);
extern uint64_t mmutranslate_noabrt(uint32_t addr, int rw);
extern void flushmmucache(void);
extern void flushmmucache_nopc(void);
extern void mmu_invalidate(uint32_t addr);
extern void mem_invalidate_range(uint32_t start_addr, uint32_t end_addr);
extern void mem_a20_init(void);
extern void mem_a20_recalc(void);
extern void mem_write_ramb_page(uint32_t addr, uint8_t val, page_t *page);
extern void mem_write_ramw_page(uint32_t addr, uint16_t val, page_t *page);
extern void mem_write_raml_page(uint32_t addr, uint32_t val, page_t *page);
extern void mem_flush_write_page(uint32_t addr, uint32_t virt);
extern void mem_init(void);
extern void mem_close(void);
extern void mem_reset(void);
extern void mem_remap_top(int kb);
extern void mem_reset_page_blocks(void);
extern void flushmmucache(void);
extern void flushmmucache_nopc(void);
extern void mem_a20_init(void);
extern void mem_a20_recalc(void);
extern void mem_init(void);
extern void mem_close(void);
extern void mem_reset(void);
extern void mem_remap_top(int kb);
extern mem_mapping_t *read_mapping[MEM_MAPPINGS_NO];
extern mem_mapping_t *write_mapping[MEM_MAPPINGS_NO];
#ifdef EMU_CPU_H
static __inline uint32_t get_phys(uint32_t addr)
static __inline uint32_t
get_phys(uint32_t addr)
{
uint64_t pa64;
if (!((addr ^ get_phys_virt) & ~0xfff))
return get_phys_phys | (addr & 0xfff);
return get_phys_phys | (addr & 0xfff);
get_phys_virt = addr;
if (!(cr0 >> 31)) {
get_phys_phys = (addr & rammask) & ~0xfff;
return addr & rammask;
get_phys_phys = (addr & rammask) & ~0xfff;
return addr & rammask;
}
if (((int) (readlookup2[addr >> 12])) != -1)
get_phys_phys = ((uintptr_t)readlookup2[addr >> 12] + (addr & ~0xfff)) - (uintptr_t)ram;
get_phys_phys = ((uintptr_t) readlookup2[addr >> 12] + (addr & ~0xfff)) - (uintptr_t) ram;
else {
pa64 = mmutranslatereal(addr, 0);
if (pa64 > 0xffffffffULL)
get_phys_phys = 0xffffffff;
else
get_phys_phys = (uint32_t) pa64;
get_phys_phys = (get_phys_phys & rammask) & ~0xfff;
if (!cpu_state.abrt && mem_addr_is_ram(get_phys_phys))
addreadlookup(get_phys_virt, get_phys_phys);
pa64 = mmutranslatereal(addr, 0);
if (pa64 > 0xffffffffULL)
get_phys_phys = 0xffffffff;
else
get_phys_phys = (uint32_t) pa64;
get_phys_phys = (get_phys_phys & rammask) & ~0xfff;
if (!cpu_state.abrt && mem_addr_is_ram(get_phys_phys))
addreadlookup(get_phys_virt, get_phys_phys);
}
return get_phys_phys | (addr & 0xfff);
}
static __inline uint32_t get_phys_noabrt(uint32_t addr)
static __inline uint32_t
get_phys_noabrt(uint32_t addr)
{
uint64_t phys_addr;
uint32_t phys_addr32;
if (!(cr0 >> 31))
return addr & rammask;
return addr & rammask;
if (((int) (readlookup2[addr >> 12])) != -1)
return ((uintptr_t)readlookup2[addr >> 12] + addr) - (uintptr_t)ram;
return ((uintptr_t) readlookup2[addr >> 12] + addr) - (uintptr_t) ram;
phys_addr = mmutranslate_noabrt(addr, 0);
phys_addr = mmutranslate_noabrt(addr, 0);
phys_addr32 = (uint32_t) phys_addr;
if ((phys_addr != 0xffffffffffffffffULL) && (phys_addr <= 0xffffffffULL) &&
mem_addr_is_ram(phys_addr32 & rammask))
addreadlookup(addr, phys_addr32 & rammask);
if ((phys_addr != 0xffffffffffffffffULL) && (phys_addr <= 0xffffffffULL) && mem_addr_is_ram(phys_addr32 & rammask))
addreadlookup(addr, phys_addr32 & rammask);
if (phys_addr > 0xffffffffULL)
phys_addr32 = 0xffffffff;
phys_addr32 = 0xffffffff;
return phys_addr32;
}
#endif
#endif /*EMU_MEM_H*/
#endif /*EMU_MEM_H*/

View File

@@ -1,109 +1,116 @@
#ifndef EMU_SOUND_MIDI_H
# define EMU_SOUND_MIDI_H
#define EMU_SOUND_MIDI_H
#define SYSEX_SIZE 8192
extern uint8_t MIDI_InSysexBuf[SYSEX_SIZE];
extern uint8_t MIDI_evt_len[256];
extern int midi_device_current;
extern int midi_output_device_current;
extern int midi_input_device_current;
extern void (*input_msg)(void *p, uint8_t *msg, uint32_t len);
extern int (*input_sysex)(void *p, uint8_t *buf, uint32_t len, int abort);
extern void (*input_msg)(void *priv, uint8_t *msg, uint32_t len);
extern int (*input_sysex)(void *priv, uint8_t *buf, uint32_t len, int abort);
extern void *midi_in_p;
extern int midi_device_available(int card);
extern int midi_in_device_available(int card);
extern int midi_out_device_available(int card);
extern int midi_in_device_available(int card);
#ifdef EMU_DEVICE_H
const device_t *midi_device_getdevice(int card);
const device_t *midi_out_device_getdevice(int card);
const device_t *midi_in_device_getdevice(int card);
#endif
extern int midi_device_has_config(int card);
extern int midi_in_device_has_config(int card);
extern char * midi_device_get_internal_name(int card);
extern char * midi_in_device_get_internal_name(int card);
extern int midi_device_get_from_internal_name(char *s);
extern int midi_in_device_get_from_internal_name(char *s);
extern void midi_device_init();
extern void midi_in_device_init();
extern int midi_out_device_has_config(int card);
extern int midi_in_device_has_config(int card);
extern const char *midi_out_device_get_internal_name(int card);
extern const char *midi_in_device_get_internal_name(int card);
extern int midi_out_device_get_from_internal_name(char *s);
extern int midi_in_device_get_from_internal_name(char *s);
extern void midi_out_device_init(void);
extern void midi_in_device_init(void);
typedef struct midi_device_t
{
typedef struct midi_device_t {
void (*play_sysex)(uint8_t *sysex, unsigned int len);
void (*play_msg)(uint8_t *msg);
void (*poll)();
void (*poll)(void);
int (*write)(uint8_t val);
} midi_device_t;
typedef struct midi_in_handler_t
{
typedef struct midi_in_handler_t {
uint8_t *buf;
int cnt;
int cnt;
uint32_t len;
void (*msg)(void *p, uint8_t *msg, uint32_t len);
int (*sysex)(void *p, uint8_t *buffer, uint32_t len, int abort);
struct midi_in_handler_t *p;
struct midi_in_handler_t *prev, *next;
void (*msg)(void *priv, uint8_t *msg, uint32_t len);
int (*sysex)(void *priv, uint8_t *buffer, uint32_t len, int abort);
struct midi_in_handler_t *priv;
struct midi_in_handler_t *prev;
struct midi_in_handler_t *next;
} midi_in_handler_t;
typedef struct midi_t
{
uint8_t midi_rt_buf[8], midi_cmd_buf[8],
midi_status, midi_sysex_data[SYSEX_SIZE];
int midi_cmd_pos, midi_cmd_len, midi_cmd_r,
midi_realtime, thruchan, midi_clockout;
unsigned int midi_sysex_start, midi_sysex_delay,
midi_pos;
midi_device_t *m_out_device, *m_in_device;
typedef struct midi_t {
uint8_t midi_rt_buf[8];
uint8_t midi_cmd_buf[8];
uint8_t midi_status;
uint8_t midi_sysex_data[SYSEX_SIZE];
int midi_cmd_pos;
int midi_cmd_len;
int midi_cmd_r;
int midi_realtime;
int thruchan;
int midi_clockout;
unsigned int midi_sysex_start;
unsigned int midi_sysex_delay;
unsigned int midi_pos;
midi_device_t *m_out_device;
midi_device_t *m_in_device;
} midi_t;
extern midi_t *midi, *midi_in;
extern midi_t *midi_out;
extern midi_t *midi_in;
extern void midi_init(midi_device_t* device);
extern void midi_in_init(midi_device_t* device, midi_t **mididev);
extern void midi_close();
extern void midi_in_close(void);
extern void midi_raw_out_rt_byte(uint8_t val);
extern void midi_raw_out_thru_rt_byte(uint8_t val);
extern void midi_raw_out_byte(uint8_t val);
extern void midi_clear_buffer(void);
extern void midi_poll();
extern void midi_out_init(midi_device_t *device);
extern void midi_in_init(midi_device_t *device, midi_t **mididev);
extern void midi_out_close(void);
extern void midi_in_close(void);
extern void midi_raw_out_rt_byte(uint8_t val);
extern void midi_raw_out_thru_rt_byte(uint8_t val);
extern void midi_raw_out_byte(uint8_t val);
extern void midi_clear_buffer(void);
extern void midi_poll(void);
extern void midi_in_handler(int set, void (*msg)(void *p, uint8_t *msg, uint32_t len), int (*sysex)(void *p, uint8_t *buffer, uint32_t len, int abort), void *p);
extern void midi_in_handlers_clear(void);
extern void midi_in_msg(uint8_t *msg, uint32_t len);
extern void midi_in_sysex(uint8_t *buffer, uint32_t len);
extern void midi_in_handler(int set, void (*msg)(void *priv, uint8_t *msg, uint32_t len), int (*sysex)(void *priv, uint8_t *buffer, uint32_t len, int abort), void *priv);
extern void midi_in_handlers_clear(void);
extern void midi_in_msg(uint8_t *msg, uint32_t len);
extern void midi_in_sysex(uint8_t *buffer, uint32_t len);
#if 0
#ifdef _WIN32
#define SYSTEM_MIDI_NAME "Windows MIDI"
#define SYSTEM_MIDI_INTERNAL_NAME "windows_midi"
# ifdef _WIN32
# define SYSTEM_MIDI_NAME "Windows MIDI"
# define SYSTEM_MIDI_INTERNAL_NAME "windows_midi"
# else
# define SYSTEM_MIDI_NAME "System MIDI"
# define SYSTEM_MIDI_INTERNAL_NAME "system_midi"
# endif
#else
#define SYSTEM_MIDI_NAME "System MIDI"
#define SYSTEM_MIDI_INTERNAL_NAME "system_midi"
#endif
#else
#define SYSTEM_MIDI_NAME "System MIDI"
#define SYSTEM_MIDI_INTERNAL_NAME "system_midi"
# define SYSTEM_MIDI_NAME "System MIDI"
# define SYSTEM_MIDI_INTERNAL_NAME "system_midi"
#endif
#define MIDI_INPUT_NAME "MIDI Input Device"
#define MIDI_INPUT_NAME "MIDI Input Device"
#define MIDI_INPUT_INTERNAL_NAME "midi_in"
#ifdef EMU_DEVICE_H
extern const device_t rtmidi_device;
extern const device_t rtmidi_output_device;
extern const device_t rtmidi_input_device;
#ifdef USE_FLUIDSYNTH
# ifdef USE_FLUIDSYNTH
extern const device_t fluidsynth_device;
#endif
#ifdef USE_MUNT
extern const device_t mt32_device;
# endif
# ifdef USE_MUNT
extern const device_t mt32_old_device;
extern const device_t mt32_new_device;
extern const device_t cm32l_device;
#endif
extern const device_t cm32ln_device;
# endif
#endif
#endif /*EMU_SOUND_MIDI_H*/
#endif /*EMU_SOUND_MIDI_H*/

View File

@@ -1,13 +1,17 @@
#ifndef EMU_SOUND_RTMIDI_H
#define EMU_SOUND_RTMIDI_H
#ifdef __cplusplus
extern "C"
{
extern "C" {
#endif
extern int rtmidi_get_num_devs(void);
extern void rtmidi_get_dev_name(int num, char *s);
extern int rtmidi_in_get_num_devs(void);
extern void rtmidi_in_get_dev_name(int num, char *s);
extern int rtmidi_out_get_num_devs(void);
extern void rtmidi_out_get_dev_name(int num, char *s);
extern int rtmidi_in_get_num_devs(void);
extern void rtmidi_in_get_dev_name(int num, char *s);
#ifdef __cplusplus
}
#endif
#endif
#endif /*EMU_SOUND_RTMIDI*/

View File

@@ -1,181 +1,208 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Implementation of a generic Magneto-Optical Disk drive
* commands, for both ATAPI and SCSI usage.
* Implementation of a generic Magneto-Optical Disk drive
* commands, for both ATAPI and SCSI usage.
*
*
*
* Authors: Natalia Portillo <claunia@claunia.com>
* Authors: Natalia Portillo <claunia@claunia.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
* Miran Grca, <mgrca8@gmail.com>
*
* Copyright 2020 Miran Grca.
* Copyright 2020 Miran Grca.
*/
#ifndef EMU_MO_H
#define EMU_MO_H
#define MO_NUM 4
#define MO_NUM 4
#define BUF_SIZE 32768
#define MO_TIME 10.0
#define MO_TIME 10.0
#define MO_IMAGE_HISTORY 4
typedef struct {
uint32_t sectors;
uint16_t bytes_per_sector;
typedef struct mo_type_t {
uint32_t sectors;
uint16_t bytes_per_sector;
} mo_type_t;
#define KNOWN_MO_TYPES 10
static const mo_type_t mo_types[KNOWN_MO_TYPES] = {
// 3.5" standard M.O. disks
{ 248826, 512 },
{ 446325, 512 },
{ 1041500, 512 },
{ 310352, 2048 },
{ 605846, 2048 },
{ 1063146, 2048 },
// 5.25" M.O. disks
{573624, 512 },
{314568, 1024 },
{904995, 512 },
{637041, 1024 },
// 3.5" standard M.O. disks
{ 248826, 512 },
{ 446325, 512 },
{ 1041500, 512 },
{ 310352, 2048 },
{ 605846, 2048 },
{ 1063146, 2048 },
// 5.25" M.O. disks
{ 573624, 512 },
{ 314568, 1024 },
{ 904995, 512 },
{ 637041, 1024 },
};
typedef struct
{
typedef struct mo_drive_type_t {
const char vendor[9];
const char model[16];
const char revision[5];
int8_t supported_media[KNOWN_MO_TYPES];
int8_t supported_media[KNOWN_MO_TYPES];
} mo_drive_type_t;
#define KNOWN_MO_DRIVE_TYPES 22
static const mo_drive_type_t mo_drive_types[KNOWN_MO_DRIVE_TYPES] = {
{"86BOX", "MAGNETO OPTICAL", "1.00",{1, 1, 1, 1, 1, 1, 1, 1, 1, 1}},
{"FUJITSU", "M2512A", "1314",{1, 1, 0, 0, 0, 0, 0, 0, 0}},
{"FUJITSU", "M2513-MCC3064SS", "1.00",{1, 1, 1, 1, 0, 0, 0, 0, 0, 0}},
{"FUJITSU", "MCE3130SS", "0070",{1, 1, 1, 1, 1, 0, 0, 0, 0, 0}},
{"FUJITSU", "MCF3064SS", "0030",{1, 1, 1, 1, 0, 0, 0, 0, 0, 0}},
{"FUJITSU", "MCJ3230UB-S", "0040",{1, 1, 1, 1, 1, 1, 0, 0, 0, 0}},
{"HP", "S6300.65", "1.00",{0, 0, 0, 0, 0, 0, 1, 1, 0, 0}},
{"HP", "C1716C", "1.00",{0, 0, 0, 0, 0, 0, 1, 1, 0, 1}},
{"IBM", "0632AAA", "1.00",{0, 0, 0, 0, 0, 0, 1, 1, 0, 0}},
{"IBM", "0632CHC", "1.00",{0, 0, 0, 0, 0, 0, 1, 1, 0, 1}},
{"IBM", "0632CHX", "1.00",{0, 0, 0, 0, 0, 0, 1, 1, 0, 1}},
{"IBM", "MD3125A", "1.00",{1, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
{"IBM", "MD3125B", "1.00",{1, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
{"IBM", "MTA-3127", "1.00",{1, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
{"IBM", "MTA-3230", "1.00",{1, 1, 0, 0, 0, 0, 0, 0, 0, 0}},
{"MATSHITA", "LF-3000", "1.00",{1, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
{"MOST", "RMD-5100", "1.00",{1, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
{"RICOH", "RO-5031E", "1.00",{0, 0, 0, 0, 0, 0, 1, 1, 0, 0}},
{"SONY", "SMO-C301", "1.00",{1, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
{"SONY", "SMO-C501", "1.00",{0, 0, 0, 0, 0, 0, 1, 1, 0, 0}},
{"TEAC", "OD-3000", "1.00",{1, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
{"TOSHIBA", "OD-D300", "1.00",{1, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
{"86BOX", "MAGNETO OPTICAL", "1.00", { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }},
{ "FUJITSU", "M2512A", "1314", { 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 }},
{ "FUJITSU", "M2513-MCC3064SS", "1.00", { 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 }},
{ "FUJITSU", "MCE3130SS", "0070", { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 }},
{ "FUJITSU", "MCF3064SS", "0030", { 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 }},
{ "FUJITSU", "MCJ3230UB-S", "0040", { 1, 1, 1, 1, 1, 1, 0, 0, 0, 0 }},
{ "HP", "S6300.65", "1.00", { 0, 0, 0, 0, 0, 0, 1, 1, 0, 0 }},
{ "HP", "C1716C", "1.00", { 0, 0, 0, 0, 0, 0, 1, 1, 0, 1 }},
{ "IBM", "0632AAA", "1.00", { 0, 0, 0, 0, 0, 0, 1, 1, 0, 0 }},
{ "IBM", "0632CHC", "1.00", { 0, 0, 0, 0, 0, 0, 1, 1, 0, 1 }},
{ "IBM", "0632CHX", "1.00", { 0, 0, 0, 0, 0, 0, 1, 1, 0, 1 }},
{ "IBM", "MD3125A", "1.00", { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }},
{ "IBM", "MD3125B", "1.00", { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }},
{ "IBM", "MTA-3127", "1.00", { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }},
{ "IBM", "MTA-3230", "1.00", { 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 }},
{ "MATSHITA", "LF-3000", "1.00", { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }},
{ "MOST", "RMD-5100", "1.00", { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }},
{ "RICOH", "RO-5031E", "1.00", { 0, 0, 0, 0, 0, 0, 1, 1, 0, 0 }},
{ "SONY", "SMO-C301", "1.00", { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }},
{ "SONY", "SMO-C501", "1.00", { 0, 0, 0, 0, 0, 0, 1, 1, 0, 0 }},
{ "TEAC", "OD-3000", "1.00", { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }},
{ "TOSHIBA", "OD-D300", "1.00", { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }},
};
enum {
MO_BUS_DISABLED = 0,
MO_BUS_ATAPI = 5,
MO_BUS_SCSI,
MO_BUS_USB
MO_BUS_ATAPI = 5,
MO_BUS_SCSI = 6,
MO_BUS_USB = 7
};
typedef struct {
uint8_t id;
typedef struct mo_drive_t {
uint8_t id;
union {
uint8_t res, res0, /* Reserved for other ID's. */
res1,
ide_channel, scsi_device_id;
uint8_t res;
uint8_t res0; /* Reserved for other ID's. */
uint8_t res1;
uint8_t ide_channel;
uint8_t scsi_device_id;
};
uint8_t bus_type, /* 0 = ATAPI, 1 = SCSI */
bus_mode, /* Bit 0 = PIO suported;
Bit 1 = DMA supportd. */
read_only, /* Struct variable reserved for
media status. */
pad, pad0;
uint8_t bus_type; /* 0 = ATAPI, 1 = SCSI */
uint8_t bus_mode; /* Bit 0 = PIO suported;
Bit 1 = DMA supportd. */
uint8_t read_only; /* Struct variable reserved for
media status. */
uint8_t pad;
uint8_t pad0;
FILE *f;
void *priv;
FILE *fp;
void *priv;
char image_path[1024],
prev_image_path[1024];
char image_path[1024];
char prev_image_path[1024];
uint32_t type, medium_size,
base;
uint16_t sector_size;
char *image_history[MO_IMAGE_HISTORY];
uint32_t type;
uint32_t medium_size;
uint32_t base;
uint16_t sector_size;
} mo_drive_t;
typedef struct {
mode_sense_pages_t ms_pages_saved;
typedef struct mo_t {
mode_sense_pages_t ms_pages_saved;
mo_drive_t *drv;
#ifdef EMU_IDE_H
ide_tf_t * tf;
#else
void * tf;
#endif
uint8_t *buffer,
atapi_cdb[16],
current_cdb[16],
sense[256];
uint8_t *buffer;
uint8_t atapi_cdb[16];
uint8_t current_cdb[16];
uint8_t sense[256];
uint8_t status, phase,
error, id,
features, cur_lun,
pad0, pad1;
#ifdef ANCIENT_CODE
/* Task file. */
uint8_t features;
uint8_t phase;
uint16_t request_length;
uint8_t status;
uint8_t error;
uint16_t pad;
uint32_t pos;
#endif
uint16_t request_length, max_transfer_len;
uint8_t id;
uint8_t cur_lun;
uint8_t pad0;
uint8_t pad1;
int requested_blocks, packet_status,
total_length, do_page_save,
unit_attention, request_pos,
old_len, pad3;
uint16_t max_transfer_len;
uint16_t pad2;
uint32_t sector_pos, sector_len,
packet_len, pos;
int requested_blocks;
int packet_status;
int total_length;
int do_page_save;
int unit_attention;
int request_pos;
int old_len;
int pad3;
uint32_t sector_pos;
uint32_t sector_len;
uint32_t packet_len;
double callback;
} mo_t;
extern mo_t *mo[MO_NUM];
extern mo_drive_t mo_drives[MO_NUM];
extern uint8_t atapi_mo_drives[8];
extern uint8_t scsi_mo_drives[16];
extern mo_t *mo[MO_NUM];
extern mo_drive_t mo_drives[MO_NUM];
#if 0
extern uint8_t atapi_mo_drives[8];
extern uint8_t scsi_mo_drives[16];
#endif
#define mo_sense_error dev->sense[0]
#define mo_sense_key dev->sense[2]
#define mo_asc dev->sense[12]
#define mo_ascq dev->sense[13]
#define mo_sense_key dev->sense[2]
#define mo_asc dev->sense[12]
#define mo_ascq dev->sense[13]
#ifdef __cplusplus
extern "C" {
#endif
extern void mo_disk_close(mo_t *dev);
extern void mo_disk_reload(mo_t *dev);
extern void mo_insert(mo_t *dev);
extern void mo_disk_close(mo_t *dev);
extern void mo_disk_reload(mo_t *dev);
extern void mo_insert(mo_t *dev);
extern void mo_global_init(void);
extern void mo_hard_reset(void);
extern void mo_global_init(void);
extern void mo_hard_reset(void);
extern void mo_reset(scsi_common_t *sc);
extern int mo_load(mo_t *dev, char *fn);
extern void mo_close();
extern void mo_reset(scsi_common_t *sc);
extern int mo_load(mo_t *dev, char *fn);
extern void mo_close(void);
#ifdef __cplusplus
}
#endif
#endif /*EMU_MO_H*/
#endif /*EMU_MO_H*/

View File

@@ -1,92 +1,127 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Definitions for the mouse driver.
* Definitions for the mouse driver.
*
*
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
* Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2016-2019 Miran Grca.
* Copyright 2017-2019 Fred N. van Kempen.
* Copyright 2016-2019 Miran Grca.
* Copyright 2017-2019 Fred N. van Kempen.
*/
#ifndef EMU_MOUSE_H
# define EMU_MOUSE_H
#define EMU_MOUSE_H
#define MOUSE_TYPE_NONE 0 /* no mouse configured */
#define MOUSE_TYPE_INTERNAL 1 /* machine has internal mouse */
#define MOUSE_TYPE_LOGIBUS 2 /* Logitech/ATI Bus Mouse */
#define MOUSE_TYPE_INPORT 3 /* Microsoft InPort Mouse */
#if 0
# define MOUSE_TYPE_GENIBUS 4 /* Genius Bus Mouse */
#ifndef __cplusplus
/* Yes, a big no-no, but I'm saving myself time here. */
#include <stdatomic.h>
#endif
#define MOUSE_TYPE_MSYSTEMS 5 /* Mouse Systems mouse */
#define MOUSE_TYPE_MICROSOFT 6 /* Microsoft 2-button Serial Mouse */
#define MOUSE_TYPE_MS3BUTTON 7 /* Microsoft 3-button Serial Mouse */
#define MOUSE_TYPE_MSWHEEL 8 /* Microsoft Serial Wheel Mouse */
#define MOUSE_TYPE_LOGITECH 9 /* Logitech 2-button Serial Mouse */
#define MOUSE_TYPE_LT3BUTTON 10 /* Logitech 3-button Serial Mouse */
#define MOUSE_TYPE_PS2 11 /* PS/2 series Bus Mouse */
#define MOUSE_TYPE_ONBOARD 0x80 /* Mouse is an on-board version of one of the above. */
#define MOUSE_TYPE_NONE 0 /* no mouse configured */
#define MOUSE_TYPE_INTERNAL 1 /* achine has internal mouse */
#define MOUSE_TYPE_LOGIBUS 2 /* Logitech/ATI Bus Mouse */
#define MOUSE_TYPE_INPORT 3 /* Microsoft InPort Mouse */
#if 0
# define MOUSE_TYPE_GENIBUS 4 /* Genius Bus Mouse */
#endif
#define MOUSE_TYPE_MSYSTEMS 5 /* Mouse Systems mouse */
#define MOUSE_TYPE_MICROSOFT 6 /* Microsoft 2-button Serial Mouse */
#define MOUSE_TYPE_MS3BUTTON 7 /* Microsoft 3-button Serial Mouse */
#define MOUSE_TYPE_MSWHEEL 8 /* Microsoft Serial Wheel Mouse */
#define MOUSE_TYPE_LOGITECH 9 /* Logitech 2-button Serial Mouse */
#define MOUSE_TYPE_LT3BUTTON 10 /* Logitech 3-button Serial Mouse */
#define MOUSE_TYPE_PS2 11 /* PS/2 series Bus Mouse */
#define MOUSE_TYPE_WACOM 12 /* WACOM tablet */
#define MOUSE_TYPE_WACOMARTP 13 /* WACOM tablet (ArtPad) */
#define MOUSE_TYPE_ONBOARD 0x80 /* Mouse is an on-board version of one of the above. */
#ifdef __cplusplus
extern "C" {
#endif
extern int mouse_type;
extern int mouse_x, mouse_y, mouse_z;
extern int mouse_buttons;
extern int mouse_type;
extern int mouse_input_mode; /* 1 = Absolute, 0 = Relative */
extern int mouse_timed; /* 1 = Timed, 0 = Constant */
extern int mouse_tablet_in_proximity;
extern double mouse_x_abs;
extern double mouse_y_abs;
extern int tablet_tool_type;
extern double mouse_sensitivity;
#ifdef EMU_DEVICE_H
extern const device_t *mouse_get_device(int mouse);
extern void *mouse_ps2_init(const device_t *);
extern void *mouse_ps2_init(const device_t *);
extern const device_t mouse_logibus_device;
extern const device_t mouse_logibus_onboard_device;
extern const device_t mouse_msinport_device;
#if 0
extern const device_t mouse_genibus_device;
#endif
extern const device_t mouse_mssystems_device;
extern const device_t mouse_msserial_device;
extern const device_t mouse_ltserial_device;
extern const device_t mouse_ps2_device;
extern const device_t mouse_logibus_device;
extern const device_t mouse_logibus_onboard_device;
extern const device_t mouse_msinport_device;
# ifdef USE_GENIBUS
extern const device_t mouse_genibus_device;
# endif
extern const device_t mouse_mssystems_device;
extern const device_t mouse_msserial_device;
extern const device_t mouse_ltserial_device;
extern const device_t mouse_ps2_device;
extern const device_t mouse_wacom_device;
extern const device_t mouse_wacom_artpad_device;
#endif
extern void mouse_init(void);
extern void mouse_close(void);
extern void mouse_reset(void);
extern void mouse_set_buttons(int buttons);
extern void mouse_process(void);
extern void mouse_set_poll(int (*f)(int,int,int,int,void *), void *);
extern void mouse_poll(void);
extern void mouse_clear_x(void);
extern void mouse_clear_y(void);
extern void mouse_clear_coords(void);
extern void mouse_clear_buttons(void);
extern void mouse_subtract_x(int *delta_x, int *o_x, int min, int max, int abs);
extern void mouse_subtract_y(int *delta_y, int *o_y, int min, int max, int invert, int abs);
extern void mouse_subtract_coords(int *delta_x, int *delta_y, int *o_x, int *o_y,
int min, int max, int invert, int abs);
extern int mouse_wheel_moved(void);
extern int mouse_moved(void);
extern int mouse_state_changed(void);
extern int mouse_mbut_changed(void);
extern void mouse_scale_fx(double x);
extern void mouse_scale_fy(double y);
extern void mouse_scale_x(int x);
extern void mouse_scale_y(int y);
extern void mouse_scalef(double x, double y);
extern void mouse_scale(int x, int y);
extern void mouse_set_z(int z);
extern void mouse_clear_z(void);
extern void mouse_subtract_z(int *delta_z, int min, int max, int invert);
extern void mouse_set_buttons_ex(int b);
extern int mouse_get_buttons_ex(void);
extern void mouse_set_sample_rate(double new_rate);
extern void mouse_set_buttons(int buttons);
extern void mouse_get_abs_coords(double *x_abs, double *y_abs);
extern void mouse_process(void);
extern void mouse_set_poll_ex(void (*poll_ex)(void));
extern void mouse_set_poll(int (*f)(void *), void *);
extern const char * mouse_get_name(int mouse);
extern const char * mouse_get_internal_name(int mouse);
extern int mouse_get_from_internal_name(char *s);
extern int mouse_has_config(int mouse);
#ifdef EMU_DEVICE_H
extern const device_t *mouse_get_device(int mouse);
#endif
extern int mouse_get_buttons(void);
extern int mouse_get_ndev(void);
extern void mouse_set_raw(int raw);
extern void mouse_reset(void);
extern void mouse_close(void);
extern void mouse_init(void);
extern void mouse_bus_set_irq(void *priv, int irq);
extern char *mouse_get_name(int mouse);
extern char *mouse_get_internal_name(int mouse);
extern int mouse_get_from_internal_name(char *s);
extern int mouse_has_config(int mouse);
extern int mouse_get_type(int mouse);
extern int mouse_get_ndev(void);
extern int mouse_get_buttons(void);
extern void mouse_clear_data(void *priv);
extern void mouse_bus_set_irq(void *priv, int irq);
#ifdef __cplusplus
}
#endif
#endif /*EMU_MOUSE_H*/
#endif /*EMU_MOUSE_H*/

View File

@@ -0,0 +1,45 @@
/*
* 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 Project.
*
* Implementation of the following network controller:
* - 3Com Etherlink 3c500/3c501 (ISA 8-bit).
*
*
*
* Based on @(#)Dev3C501.cpp Oracle (VirtualBox)
*
* Authors: TheCollector1995, <mariogplayer@gmail.com>
* Oracle
*
* Copyright 2022 TheCollector1995.
* Portions Copyright (C) 2022 Oracle and/or its affilitates.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the:
*
* Free Software Foundation, Inc.
* 59 Temple Place - Suite 330
* Boston, MA 02111-1307
* USA.
*/
#ifndef NET_3C501_H
#define NET_3C501_H
extern const device_t threec501_device;
#endif /*NET_3C501_H*/

View File

@@ -1,7 +1,49 @@
/*
* 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.
*
* Implementation of the following network controllers:
* - 3Com Etherlink II 3c503 (ISA 8-bit).
*
*
*
* Based on @(#)3c503.cpp Carl (MAME)
*
* Authors: TheCollector1995, <mariogplayer@gmail.com>
* Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
* Carl, <unknown e-mail address>
*
* Copyright 2018 TheCollector1995.
* Copyright 2018 Miran Grca.
* Copyright 2017-2018 Fred N. van Kempen.
* Portions Copyright (C) 2018 MAME Project
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the:
*
* Free Software Foundation, Inc.
* 59 Temple Place - Suite 330
* Boston, MA 02111-1307
* USA.
*/
#ifndef NET_3C503_H
# define NET_3C503_H
#define NET_3C503_H
extern const device_t threec503_device;
extern const device_t threec503_device;
#endif /*NET_3C503_H*/
#endif /*NET_3C503_H*/

View File

@@ -1,152 +1,153 @@
/*
* 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.
* 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.
*
* Header of the emulation of the DP8390 Network Interface
* Controller used by the WD family, NE1000/NE2000 family, and
* 3Com 3C503 NIC's.
* Header of the emulation of the DP8390 Network Interface
* Controller used by the WD family, NE1000/NE2000 family, and
* 3Com 3C503 NIC's.
*
*
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Bochs project,
* Authors: Miran Grca, <mgrca8@gmail.com>
* Bochs project,
*
* Copyright 2016-2018 Miran Grca.
* Copyright 2008-2018 Bochs project.
* Copyright 2016-2018 Miran Grca.
* Copyright 2008-2018 Bochs project.
*/
#ifndef NET_DP8390_H
# define NET_DP8390_H
#define NET_DP8390_H
/* Never completely fill the ne2k ring so that we never
hit the unclear completely full buffer condition. */
#define DP8390_NEVER_FULL_RING (1)
#define DP8390_DWORD_MEMSIZ (32*1024)
#define DP8390_DWORD_MEMSTART (16*1024)
#define DP8390_DWORD_MEMEND (DP8390_DWORD_MEMSTART+DP8390_DWORD_MEMSIZ)
#define DP8390_DWORD_MEMSIZ (32 * 1024)
#define DP8390_DWORD_MEMSTART (16 * 1024)
#define DP8390_DWORD_MEMEND (DP8390_DWORD_MEMSTART + DP8390_DWORD_MEMSIZ)
#define DP8390_WORD_MEMSIZ (16*1024)
#define DP8390_WORD_MEMSTART (8*1024)
#define DP8390_WORD_MEMEND (DP8390_WORD_MEMSTART+DP8390_WORD_MEMSIZ)
#define DP8390_WORD_MEMSIZ (16 * 1024)
#define DP8390_WORD_MEMSTART (8 * 1024)
#define DP8390_WORD_MEMEND (DP8390_WORD_MEMSTART + DP8390_WORD_MEMSIZ)
#define DP8390_FLAG_EVEN_MAC 0x01
#define DP8390_FLAG_CHECK_CR 0x02
#define DP8390_FLAG_CLEAR_IRQ 0x04
#define DP8390_FLAG_EVEN_MAC 0x01
#define DP8390_FLAG_CHECK_CR 0x02
#define DP8390_FLAG_CLEAR_IRQ 0x04
typedef struct {
typedef struct dp8390_t {
/* Page 0 */
/* Command Register - 00h read/write */
struct CR_t {
int stop; /* STP - Software Reset command */
int start; /* START - start the NIC */
int tx_packet; /* TXP - initiate packet transmission */
uint8_t rdma_cmd; /* RD0,RD1,RD2 - Remote DMA command */
uint8_t pgsel; /* PS0,PS1 - Page select */
} CR;
int stop; /* STP - Software Reset command */
int start; /* START - start the NIC */
int tx_packet; /* TXP - initiate packet transmission */
uint8_t rdma_cmd; /* RD0,RD1,RD2 - Remote DMA command */
uint8_t pgsel; /* PS0,PS1 - Page select */
} CR;
/* Interrupt Status Register - 07h read/write */
struct ISR_t {
int pkt_rx; /* PRX - packet received with no errors */
int pkt_tx; /* PTX - packet txed with no errors */
int rx_err; /* RXE - packet rxed with 1 or more errors */
int tx_err; /* TXE - packet txed " " " " " */
int overwrite; /* OVW - rx buffer resources exhausted */
int cnt_oflow; /* CNT - network tally counter MSB's set */
int rdma_done; /* RDC - remote DMA complete */
int reset; /* RST - reset status */
} ISR;
int pkt_rx; /* PRX - packet received with no errors */
int pkt_tx; /* PTX - packet txed with no errors */
int rx_err; /* RXE - packet rxed with 1 or more errors */
int tx_err; /* TXE - packet txed " " " " " */
int overwrite; /* OVW - rx buffer resources exhausted */
int cnt_oflow; /* CNT - network tally counter MSB's set */
int rdma_done; /* RDC - remote DMA complete */
int reset; /* RST - reset status */
} ISR;
/* Interrupt Mask Register - 0fh write */
struct IMR_t {
int rx_inte; /* PRXE - packet rx interrupt enable */
int tx_inte; /* PTXE - packet tx interrput enable */
int rxerr_inte; /* RXEE - rx error interrupt enable */
int txerr_inte; /* TXEE - tx error interrupt enable */
int overw_inte; /* OVWE - overwrite warn int enable */
int cofl_inte; /* CNTE - counter o'flow int enable */
int rdma_inte; /* RDCE - remote DMA complete int enable */
int reserved; /* D7 - reserved */
} IMR;
int rx_inte; /* PRXE - packet rx interrupt enable */
int tx_inte; /* PTXE - packet tx interrput enable */
int rxerr_inte; /* RXEE - rx error interrupt enable */
int txerr_inte; /* TXEE - tx error interrupt enable */
int overw_inte; /* OVWE - overwrite warn int enable */
int cofl_inte; /* CNTE - counter o'flow int enable */
int rdma_inte; /* RDCE - remote DMA complete int enable */
int reserved; /* D7 - reserved */
} IMR;
/* Data Configuration Register - 0eh write */
struct DCR_t {
int wdsize; /* WTS - 8/16-bit select */
int endian; /* BOS - byte-order select */
int longaddr; /* LAS - long-address select */
int loop; /* LS - loopback select */
int auto_rx; /* AR - auto-remove rx pkts with remote DMA */
uint8_t fifo_size; /* FT0,FT1 - fifo threshold */
} DCR;
int wdsize; /* WTS - 8/16-bit select */
int endian; /* BOS - byte-order select */
int longaddr; /* LAS - long-address select */
int loop; /* LS - loopback select */
int auto_rx; /* AR - auto-remove rx pkts with remote DMA */
uint8_t fifo_size; /* FT0,FT1 - fifo threshold */
} DCR;
/* Transmit Configuration Register - 0dh write */
struct TCR_t {
int crc_disable; /* CRC - inhibit tx CRC */
uint8_t loop_cntl; /* LB0,LB1 - loopback control */
int ext_stoptx; /* ATD - allow tx disable by external mcast */
int coll_prio; /* OFST - backoff algorithm select */
uint8_t reserved; /* D5,D6,D7 - reserved */
} TCR;
int crc_disable; /* CRC - inhibit tx CRC */
uint8_t loop_cntl; /* LB0,LB1 - loopback control */
int ext_stoptx; /* ATD - allow tx disable by external mcast */
int coll_prio; /* OFST - backoff algorithm select */
uint8_t reserved; /* D5,D6,D7 - reserved */
} TCR;
/* Transmit Status Register - 04h read */
struct TSR_t {
int tx_ok; /* PTX - tx complete without error */
int reserved; /* D1 - reserved */
int collided; /* COL - tx collided >= 1 times */
int aborted; /* ABT - aborted due to excessive collisions */
int no_carrier; /* CRS - carrier-sense lost */
int fifo_ur; /* FU - FIFO underrun */
int cd_hbeat; /* CDH - no tx cd-heartbeat from transceiver */
int ow_coll; /* OWC - out-of-window collision */
} TSR;
int tx_ok; /* PTX - tx complete without error */
int reserved; /* D1 - reserved */
int collided; /* COL - tx collided >= 1 times */
int aborted; /* ABT - aborted due to excessive collisions */
int no_carrier; /* CRS - carrier-sense lost */
int fifo_ur; /* FU - FIFO underrun */
int cd_hbeat; /* CDH - no tx cd-heartbeat from transceiver */
int ow_coll; /* OWC - out-of-window collision */
} TSR;
/* Receive Configuration Register - 0ch write */
struct RCR_t {
int errors_ok; /* SEP - accept pkts with rx errors */
int runts_ok; /* AR - accept < 64-byte runts */
int broadcast; /* AB - accept eth broadcast address */
int multicast; /* AM - check mcast hash array */
int promisc; /* PRO - accept all packets */
int monitor; /* MON - check pkts, but don't rx */
uint8_t reserved; /* D6,D7 - reserved */
} RCR;
int errors_ok; /* SEP - accept pkts with rx errors */
int runts_ok; /* AR - accept < 64-byte runts */
int broadcast; /* AB - accept eth broadcast address */
int multicast; /* AM - check mcast hash array */
int promisc; /* PRO - accept all packets */
int monitor; /* MON - check pkts, but don't rx */
uint8_t reserved; /* D6,D7 - reserved */
} RCR;
/* Receive Status Register - 0ch read */
struct RSR_t {
int rx_ok; /* PRX - rx complete without error */
int bad_crc; /* CRC - Bad CRC detected */
int bad_falign; /* FAE - frame alignment error */
int fifo_or; /* FO - FIFO overrun */
int rx_missed; /* MPA - missed packet error */
int rx_mbit; /* PHY - unicast or mcast/bcast address match */
int rx_disabled; /* DIS - set when in monitor mode */
int deferred; /* DFR - collision active */
} RSR;
int rx_ok; /* PRX - rx complete without error */
int bad_crc; /* CRC - Bad CRC detected */
int bad_falign; /* FAE - frame alignment error */
int fifo_or; /* FO - FIFO overrun */
int rx_missed; /* MPA - missed packet error */
int rx_mbit; /* PHY - unicast or mcast/bcast address match */
int rx_disabled; /* DIS - set when in monitor mode */
int deferred; /* DFR - collision active */
} RSR;
uint16_t local_dma; /* 01,02h read ; current local DMA addr */
uint8_t page_start; /* 01h write ; page start regr */
uint8_t page_stop; /* 02h write ; page stop regr */
uint8_t bound_ptr; /* 03h read/write ; boundary pointer */
uint8_t tx_page_start; /* 04h write ; transmit page start reg */
uint8_t num_coll; /* 05h read ; number-of-collisions reg */
uint16_t tx_bytes; /* 05,06h write ; transmit byte-count reg */
uint8_t fifo; /* 06h read ; FIFO */
uint16_t remote_dma; /* 08,09h read ; current remote DMA addr */
uint16_t remote_start; /* 08,09h write ; remote start address reg */
uint16_t remote_bytes; /* 0a,0bh write ; remote byte-count reg */
uint8_t tallycnt_0; /* 0dh read ; tally ctr 0 (frame align errs) */
uint8_t tallycnt_1; /* 0eh read ; tally ctr 1 (CRC errors) */
uint8_t tallycnt_2; /* 0fh read ; tally ctr 2 (missed pkt errs) */
uint16_t local_dma; /* 01,02h read ; current local DMA addr */
uint8_t page_start; /* 01h write ; page start regr */
uint8_t page_stop; /* 02h write ; page stop regr */
uint8_t bound_ptr; /* 03h read/write ; boundary pointer */
uint8_t tx_page_start; /* 04h write ; transmit page start reg */
uint8_t num_coll; /* 05h read ; number-of-collisions reg */
uint16_t tx_bytes; /* 05,06h write ; transmit byte-count reg */
uint8_t fifo; /* 06h read ; FIFO */
uint16_t remote_dma; /* 08,09h read ; current remote DMA addr */
uint16_t remote_start; /* 08,09h write ; remote start address reg */
uint16_t remote_bytes; /* 0a,0bh write ; remote byte-count reg */
uint8_t tallycnt_0; /* 0dh read ; tally ctr 0 (frame align errs) */
uint8_t tallycnt_1; /* 0eh read ; tally ctr 1 (CRC errors) */
uint8_t tallycnt_2; /* 0fh read ; tally ctr 2 (missed pkt errs) */
/* Page 1 */
/* Command Register 00h (repeated) */
uint8_t physaddr[6]; /* 01-06h read/write ; MAC address */
uint8_t curr_page; /* 07h read/write ; current page register */
uint8_t mchash[8]; /* 08-0fh read/write ; multicast hash array */
uint8_t physaddr[6]; /* 01-06h read/write ; MAC address */
uint8_t curr_page; /* 07h read/write ; current page register */
uint8_t mchash[8]; /* 08-0fh read/write ; multicast hash array */
/* Page 2 - diagnostic use only */
@@ -161,55 +162,58 @@ typedef struct {
* Data Configuration Register 0eh read (repeated)
* Interrupt Mask Register 0fh read (repeated)
*/
uint8_t rempkt_ptr; /* 03h read/write ; rmt next-pkt ptr */
uint8_t localpkt_ptr; /* 05h read/write ; lcl next-pkt ptr */
uint16_t address_cnt; /* 06,07h read/write ; address cter */
uint8_t rempkt_ptr; /* 03h read/write ; rmt next-pkt ptr */
uint8_t localpkt_ptr; /* 05h read/write ; lcl next-pkt ptr */
uint16_t address_cnt; /* 06,07h read/write ; address cter */
/* Page 3 - should never be modified. */
/* DP8390 memory */
uint8_t *mem; /* on-chip packet memory */
uint8_t *mem; /* on-chip packet memory */
uint8_t macaddr[32]; /* ASIC ROM'd MAC address, even bytes */
uint8_t macaddr_size, /* Defaults to 16 but can be 32 */
flags, /* Flags affecting some behaviors. */
id0, /* 0x50 for the Realtek NIC's, otherwise
0xFF. */
id1; /* 0x70 for the RTL8019AS, 0x43 for the
RTL8029AS, otherwise 0xFF. */
int mem_size, mem_start, mem_end;
uint8_t macaddr[32]; /* ASIC ROM'd MAC address, even bytes */
uint8_t macaddr_size, /* Defaults to 16 but can be 32 */
flags, /* Flags affecting some behaviors. */
id0, /* 0x50 for the Realtek NIC's, otherwise
0xFF. */
id1; /* 0x70 for the RTL8019AS, 0x43 for the
RTL8029AS, otherwise 0xFF. */
uint32_t mem_size;
uint32_t mem_start;
uint32_t mem_end;
uint32_t mem_wrap;
int tx_timer_index;
int tx_timer_active;
int tx_timer_index;
int tx_timer_active;
void *priv;
void *priv;
netcard_t *card;
void (*interrupt)(void *priv, int set);
void (*interrupt)(void *priv, int set);
} dp8390_t;
extern const device_t dp8390_device;
extern const device_t dp8390_device;
extern int dp3890_inst;
extern uint32_t dp8390_chipmem_read(dp8390_t *dev, uint32_t addr, unsigned int len);
extern void dp8390_chipmem_write(dp8390_t *dev, uint32_t addr, uint32_t val, unsigned len);
extern uint32_t dp8390_chipmem_read(dp8390_t *dev, uint32_t addr, unsigned int len);
extern void dp8390_chipmem_write(dp8390_t *dev, uint32_t addr, uint32_t val, unsigned len);
extern uint32_t dp8390_read_cr(dp8390_t *dev);
extern void dp8390_write_cr(dp8390_t *dev, uint32_t val);
extern uint32_t dp8390_read_cr(dp8390_t *dev);
extern void dp8390_write_cr(dp8390_t *dev, uint32_t val);
extern int dp8390_rx(void *priv, uint8_t *buf, int io_len);
extern int dp8390_rx(void *priv, uint8_t *buf, int io_len);
extern uint32_t dp8390_page0_read(dp8390_t *dev, uint32_t off, unsigned int len);
extern void dp8390_page0_write(dp8390_t *dev, uint32_t off, uint32_t val, unsigned len);
extern uint32_t dp8390_page1_read(dp8390_t *dev, uint32_t off, unsigned int len);
extern void dp8390_page1_write(dp8390_t *dev, uint32_t off, uint32_t val, unsigned len);
extern uint32_t dp8390_page2_read(dp8390_t *dev, uint32_t off, unsigned int len);
extern void dp8390_page2_write(dp8390_t *dev, uint32_t off, uint32_t val, unsigned len);
extern void dp8390_set_defaults(dp8390_t *dev, uint8_t flags);
extern void dp8390_mem_alloc(dp8390_t *dev, uint32_t start, uint32_t size);
extern void dp8390_set_id(dp8390_t *dev, uint8_t id0, uint8_t id1);
extern void dp8390_reset(dp8390_t *dev);
extern void dp8390_soft_reset(dp8390_t *dev);
extern uint32_t dp8390_page0_read(dp8390_t *dev, uint32_t off, unsigned int len);
extern void dp8390_page0_write(dp8390_t *dev, uint32_t off, uint32_t val, unsigned len);
extern uint32_t dp8390_page1_read(dp8390_t *dev, uint32_t off, unsigned int len);
extern void dp8390_page1_write(dp8390_t *dev, uint32_t off, uint32_t val, unsigned len);
extern uint32_t dp8390_page2_read(dp8390_t *dev, uint32_t off, unsigned int len);
extern void dp8390_page2_write(dp8390_t *dev, uint32_t off, uint32_t val, unsigned len);
extern void dp8390_set_defaults(dp8390_t *dev, uint8_t flags);
extern void dp8390_mem_alloc(dp8390_t *dev, uint32_t start, uint32_t size);
extern void dp8390_set_id(dp8390_t *dev, uint8_t id0, uint8_t id1);
extern void dp8390_reset(dp8390_t *dev);
extern void dp8390_soft_reset(dp8390_t *dev);
#endif /*NET_DP8390_H*/

View File

@@ -0,0 +1,22 @@
#ifndef EMU_NET_EVENT_H
#define EMU_NET_EVENT_H
typedef struct net_evt_t {
#ifdef _WIN32
HANDLE handle;
#else
int fds[2];
#endif
} net_evt_t;
extern void net_event_init(net_evt_t *event);
extern void net_event_set(net_evt_t *event);
extern void net_event_clear(net_evt_t *event);
extern void net_event_close(net_evt_t *event);
#ifdef _WIN32
extern HANDLE net_event_get_handle(net_evt_t *event);
#else
extern int net_event_get_fd(net_evt_t *event);
#endif
#endif

View File

@@ -1,18 +1,18 @@
/*
* VARCem Virtual ARchaeological Computer EMulator.
* An emulator of (mostly) x86-based PC systems and devices,
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
* spanning the era between 1981 and 1995.
* 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 VARCem Project.
* This file is part of the 86Box distribution.
*
* Definitions for the NE2000 ethernet controller.
* Definitions for the NE2000 ethernet controller.
*
*
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2017,2018 Fred N. van Kempen.
* Copyright 2017-2018 Fred N. van Kempen.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -32,25 +32,23 @@
* Boston, MA 02111-1307
* USA.
*/
#ifndef NET_NE2000_H
# define NET_NE2000_H
#ifndef NET_NE2000_H
#define NET_NE2000_H
enum {
NE2K_NONE = 0,
NE2K_NE1000 = 1, /* 8-bit ISA NE1000 */
NE2K_NE2000 = 2, /* 16-bit ISA NE2000 */
NE2K_ETHERNEXT_MC = 3, /* 16-bit MCA EtherNext/MC */
NE2K_RTL8019AS = 4, /* 16-bit ISA PnP Realtek 8019AS */
NE2K_RTL8029AS = 5 /* 32-bit PCI Realtek 8029AS */
NE2K_NONE = 0,
NE2K_NE1000 = 1, /* 8-bit ISA NE1000 */
NE2K_NE2000 = 2, /* 16-bit ISA NE2000 */
NE2K_ETHERNEXT_MC = 3, /* 16-bit MCA EtherNext/MC */
NE2K_RTL8019AS = 4, /* 16-bit ISA PnP Realtek 8019AS */
NE2K_RTL8029AS = 5 /* 32-bit PCI Realtek 8029AS */
};
extern const device_t ne1000_device;
extern const device_t ne2000_device;
extern const device_t ethernext_mc_device;
extern const device_t rtl8019as_device;
extern const device_t rtl8029as_device;
extern const device_t ne1000_device;
extern const device_t ne2000_device;
extern const device_t ethernext_mc_device;
extern const device_t rtl8019as_device;
extern const device_t rtl8029as_device;
#endif /*NET_NE2000_H*/
#endif /*NET_NE2000_H*/

View File

@@ -1,40 +1,40 @@
/*
* 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.
* 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.
*
* Emulation of the AMD PCnet LANCE NIC controller for both the ISA
* and PCI buses.
* Emulation of the AMD PCnet LANCE NIC controller for both the ISA
* and PCI buses.
*
*
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* TheCollector1995, <mariogplayer@gmail.com>
* Antony T Curtis
* Authors: Miran Grca, <mgrca8@gmail.com>
* TheCollector1995, <mariogplayer@gmail.com>
* Antony T Curtis
*
* Copyright 2004-2019 Antony T Curtis
* Copyright 2016-2019 Miran Grca.
* Copyright 2004-2019 Antony T Curtis
* Copyright 2016-2019 Miran Grca.
*/
#ifndef NET_PCNET_H
# define NET_PCNET_H
#define NET_PCNET_H
enum {
DEV_NONE = 0,
DEV_AM79C960 = 1, /* PCnet-ISA (ISA, 10 Mbps, NE2100/NE1500T compatible) */
DEV_NONE = 0,
DEV_AM79C960 = 1, /* PCnet-ISA (ISA, 10 Mbps, NE2100/NE1500T compatible) */
DEV_AM79C960_EB = 2, /* PCnet-ISA (ISA, 10 Mbps, Racal InterLan EtherBlaster compatible) */
DEV_AM79C960_VLB = 3, /* PCnet-VLB (VLB, 10 Mbps, NE2100/NE1500T compatible) */
DEV_AM79C961 = 4, /* PCnet-ISA+ (ISA, 10 Mbps, NE2100/NE1500T compatible, Plug and Play) */
DEV_AM79C970A = 5, /* PCnet-PCI II (PCI, 10 Mbps) */
DEV_AM79C973 = 6 /* PCnet-FAST III (PCI, 10/100 Mbps) */
DEV_AM79C961 = 4, /* PCnet-ISA+ (ISA, 10 Mbps, NE2100/NE1500T compatible, Plug and Play) */
DEV_AM79C970A = 5, /* PCnet-PCI II (PCI, 10 Mbps) */
DEV_AM79C973 = 6 /* PCnet-FAST III (PCI, 10/100 Mbps) */
};
extern const device_t pcnet_am79c960_device;
extern const device_t pcnet_am79c960_eb_device;
extern const device_t pcnet_am79c960_vlb_device;
extern const device_t pcnet_am79c961_device;
extern const device_t pcnet_am79c970a_device;
extern const device_t pcnet_am79c973_device;
extern const device_t pcnet_am79c960_device;
extern const device_t pcnet_am79c960_eb_device;
extern const device_t pcnet_am79c960_vlb_device;
extern const device_t pcnet_am79c961_device;
extern const device_t pcnet_am79c970a_device;
extern const device_t pcnet_am79c973_device;
#endif /*NET_PCNET_H*/
#endif /*NET_PCNET_H*/

View File

@@ -1,24 +1,26 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Definitions for the PLIP parallel port network device.
* Definitions for the PLIP parallel port network device.
*
*
*
* Author: RichardG, <richardg867@gmail.com>
* Copyright 2020 RichardG.
* Authors: RichardG, <richardg867@gmail.com>
*
* Copyright 2020 RichardG.
*/
#ifndef NET_PLIP_H
# define NET_PLIP_H
# include <86box/device.h>
# include <86box/lpt.h>
#define NET_PLIP_H
#include <86box/device.h>
#include <86box/lpt.h>
extern const lpt_device_t lpt_plip_device;
extern const device_t plip_device;
extern const device_t plip_device;
#endif /*NET_PLIP_H*/

View File

@@ -1,26 +1,26 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Implementation of the following network controllers:
* - SMC/WD 8003E (ISA 8-bit);
* - SMC/WD 8013EBT (ISA 16-bit);
* - SMC/WD 8013EP/A (MCA).
* Implementation of the following network controllers:
* - SMC/WD 8003E (ISA 8-bit);
* - SMC/WD 8013EBT (ISA 16-bit);
* - SMC/WD 8013EP/A (MCA).
*
*
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* TheCollector1995, <mariogplayer@gmail.com>
* Miran Grca, <mgrca8@gmail.com>
* Peter Grehan, <grehan@iprg.nokia.com>
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* TheCollector1995, <mariogplayer@gmail.com>
* Miran Grca, <mgrca8@gmail.com>
* Peter Grehan, <grehan@iprg.nokia.com>
*
* Copyright 2017,2018 Fred N. van Kempen.
* Copyright 2016-2018 Miran Grca.
* Portions Copyright (C) 2002 MandrakeSoft S.A.
* Copyright 2017-2018 Fred N. van Kempen.
* Copyright 2016-2018 Miran Grca.
* Portions Copyright (C) 2002 MandrakeSoft S.A.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -40,22 +40,25 @@
* Boston, MA 02111-1307
* USA.
*/
#ifndef NET_WD8003_H
# define NET_WD8003_H
#define NET_WD8003_H
enum {
WD_NONE = 0,
WD8003E, /* WD8003E : 8-bit ISA, no interface chip */
WD8003EB, /* WD8003EB : 8-bit ISA, 5x3 interface chip */
WD8013EBT, /* WD8013EBT : 16-bit ISA, no interface chip */
WD8003ETA, /* WD8003ET/A: 16-bit MCA, no interface chip */
WD8003EA /* WD8003E/A : 16-bit MCA, 5x3 interface chip */
WD_NONE = 0,
WD8003E = 1, /* WD8003E : 8-bit ISA, no interface chip */
WD8003EB = 2, /* WD8003EB : 8-bit ISA, 5x3 interface chip */
WD8013EBT = 3, /* WD8013EBT : 16-bit ISA, no interface chip */
WD8003ETA = 4, /* WD8003ET/A: 16-bit MCA, no interface chip */
WD8003EA = 5, /* WD8003E/A : 16-bit MCA, 5x3 interface chip */
WD8013EPA = 6
};
extern const device_t wd8003e_device;
extern const device_t wd8003eb_device;
extern const device_t wd8013ebt_device;
extern const device_t wd8003eta_device;
extern const device_t wd8003ea_device;
extern const device_t wd8003e_device;
extern const device_t wd8003eb_device;
extern const device_t wd8013ebt_device;
extern const device_t wd8003eta_device;
extern const device_t wd8003ea_device;
extern const device_t wd8013epa_device;
#endif /*NET_WD8003_H*/
#endif /*NET_WD8003_H*/

View File

@@ -1,36 +1,34 @@
/*
* VARCem Virtual ARchaeological Computer EMulator.
* An emulator of (mostly) x86-based PC systems and devices,
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
* spanning the era between 1981 and 1995.
* VARCem Virtual ARchaeological Computer EMulator.
* An emulator of (mostly) x86-based PC systems and devices,
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
* spanning the era between 1981 and 1995.
*
* This file is part of the VARCem Project.
*
* Definitions for the network module.
* Definitions for the network module.
*
*
*
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2017-2019 Fred N. van Kempen.
* Copyright 2017-2019 Fred N. van Kempen.
*
* Redistribution and use in source and binary forms, with
* or without modification, are permitted provided that the
* following conditions are met:
* Redistribution and use in source and binary forms, with
* or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the entire
* above notice, this list of conditions and the following
* disclaimer.
* 1. Redistributions of source code must retain the entire
* above notice, this list of conditions and the following
* disclaimer.
*
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names
* of its contributors may be used to endorse or promote
* products derived from this software without specific
* prior written permission.
* 3. Neither the name of the copyright holder nor the names
* of its contributors may be used to endorse or promote
* products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
@@ -44,108 +42,164 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef EMU_NETWORK_H
# define EMU_NETWORK_H
# include <stdint.h>
#ifndef EMU_NETWORK_H
#define EMU_NETWORK_H
#include <stdint.h>
/* Network provider types. */
#define NET_TYPE_NONE 0 /* networking disabled */
#define NET_TYPE_PCAP 1 /* use the (Win)Pcap API */
#define NET_TYPE_SLIRP 2 /* use the SLiRP port forwarder */
#define NET_TYPE_NONE 0 /* use the null network driver */
#define NET_TYPE_SLIRP 1 /* use the SLiRP port forwarder */
#define NET_TYPE_PCAP 2 /* use the (Win)Pcap API */
#define NET_TYPE_VDE 3 /* use the VDE plug API */
#define NET_MAX_FRAME 1518
/* Queue size must be a power of 2 */
#define NET_QUEUE_LEN 16
#define NET_QUEUE_LEN_MASK (NET_QUEUE_LEN - 1)
#define NET_QUEUE_COUNT 3
#define NET_CARD_MAX 4
#define NET_HOST_INTF_MAX 64
#define NET_PERIOD_10M 0.8
#define NET_PERIOD_100M 0.08
/* Error buffers for network driver init */
#define NET_DRV_ERRBUF_SIZE 384
/* Supported network cards. */
enum {
NONE = 0,
NE1000,
NE2000,
RTL8019AS,
RTL8029AS
NET_LINK_DOWN = (1 << 1),
NET_LINK_TEMP_DOWN = (1 << 2),
NET_LINK_10_HD = (1 << 3),
NET_LINK_10_FD = (1 << 4),
NET_LINK_100_HD = (1 << 5),
NET_LINK_100_FD = (1 << 6),
NET_LINK_1000_HD = (1 << 7),
NET_LINK_1000_FD = (1 << 8),
};
enum {
NET_NONE = 0,
NET_INTERNAL
};
enum {
NET_QUEUE_RX = 0,
NET_QUEUE_TX_VM = 1,
NET_QUEUE_TX_HOST = 2
};
typedef struct netcard_conf_t {
uint16_t device_num;
int net_type;
char host_dev_name[128];
uint32_t link_state;
} netcard_conf_t;
extern netcard_conf_t net_cards_conf[NET_CARD_MAX];
extern uint16_t net_card_current;
typedef int (*NETRXCB)(void *, uint8_t *, int);
typedef int (*NETWAITCB)(void *);
typedef int (*NETSETLINKSTATE)(void *);
typedef int (*NETSETLINKSTATE)(void *, uint32_t link_state);
typedef struct netpkt {
void *priv;
uint8_t data[65536]; /* Maximum length + 1 to round up to the nearest power of 2. */
int len;
struct netpkt *prev, *next;
uint8_t *data;
int len;
} netpkt_t;
typedef struct {
const device_t *device;
void *priv;
int (*poll)(void *);
NETRXCB rx;
NETWAITCB wait;
NETSETLINKSTATE set_link_state;
} netcard_t;
typedef struct netqueue_t {
netpkt_t packets[NET_QUEUE_LEN];
int head;
int tail;
} netqueue_t;
typedef struct _netcard_t netcard_t;
typedef struct netdrv_t {
void (*notify_in)(void *priv);
void *(*init)(const netcard_t *card, const uint8_t *mac_addr, void *priv, char *netdrv_errbuf);
void (*close)(void *priv);
void *priv;
} netdrv_t;
extern const netdrv_t net_pcap_drv;
extern const netdrv_t net_slirp_drv;
extern const netdrv_t net_vde_drv;
extern const netdrv_t net_null_drv;
struct _netcard_t {
const device_t *device;
void *card_drv;
struct netdrv_t host_drv;
NETRXCB rx;
NETSETLINKSTATE set_link_state;
netqueue_t queues[NET_QUEUE_COUNT];
netpkt_t queued_pkt;
mutex_t *tx_mutex;
mutex_t *rx_mutex;
pc_timer_t timer;
uint16_t card_num;
double byte_period;
uint32_t led_timer;
uint32_t led_state;
uint32_t link_state;
};
typedef struct {
char device[128];
char description[128];
char device[128];
char description[128];
} netdev_t;
typedef struct {
int has_slirp;
int has_pcap;
int has_vde;
} network_devmap_t;
#define HAS_NOSLIRP_NET(x) (x.has_pcap || x.has_vde)
#ifdef __cplusplus
extern "C" {
#endif
/* Global variables. */
extern int nic_do_log; /* config */
extern int network_ndev;
extern int network_rx_pause;
extern netdev_t network_devs[32];
extern int nic_do_log; // config
extern network_devmap_t network_devmap;
extern int network_ndev; // Number of pcap devices
extern network_devmap_t network_devmap; // Bitmap of available network types
extern netdev_t network_devs[NET_HOST_INTF_MAX];
/* Function prototypes. */
extern void network_wait(uint8_t wait);
extern void network_poll(void);
extern void network_busy(uint8_t set);
extern void network_end(void);
extern void network_init(void);
extern netcard_t *network_attach(void *card_drv, uint8_t *mac, NETRXCB rx, NETSETLINKSTATE set_link_state);
extern void netcard_close(netcard_t *card);
extern void network_close(void);
extern void network_reset(void);
extern int network_available(void);
extern void network_tx(netcard_t *card, uint8_t *, int);
extern void network_init(void);
extern void network_attach(void *, uint8_t *, NETRXCB, NETWAITCB, NETSETLINKSTATE);
extern void network_close(void);
extern void network_reset(void);
extern int network_available(void);
extern void network_tx(uint8_t *, int);
extern void network_do_tx(void);
extern int network_tx_queue_check(void);
extern int net_pcap_prepare(netdev_t *);
extern int net_vde_prepare(void);
extern int net_pcap_prepare(netdev_t *);
extern int net_pcap_init(void);
extern int net_pcap_reset(const netcard_t *, uint8_t *);
extern void net_pcap_close(void);
extern void net_pcap_in(uint8_t *, int);
extern int net_slirp_init(void);
extern int net_slirp_reset(const netcard_t *, uint8_t *);
extern void net_slirp_close(void);
extern void net_slirp_in(uint8_t *, int);
extern int network_dev_to_id(char *);
extern int network_card_available(int);
extern int network_card_has_config(int);
extern char *network_card_get_internal_name(int);
extern int network_card_get_from_internal_name(char *);
extern const device_t *network_card_getdevice(int);
extern void network_set_wait(int wait);
extern int network_get_wait(void);
extern void network_timer_stop(void);
extern void network_queue_put(int tx, void *priv, uint8_t *data, int len);
extern void network_connect(int id, int connect);
extern int network_is_connected(int id);
extern int network_dev_available(int);
extern int network_dev_to_id(char *);
extern int network_card_available(int);
extern int network_card_has_config(int);
extern const char *network_card_get_internal_name(int);
extern int network_card_get_from_internal_name(char *);
extern const device_t *network_card_getdevice(int);
extern int network_tx_pop(netcard_t *card, netpkt_t *out_pkt);
extern int network_tx_popv(netcard_t *card, netpkt_t *pkt_vec, int vec_size);
extern int network_rx_put(netcard_t *card, uint8_t *bufp, int len);
extern int network_rx_put_pkt(netcard_t *card, netpkt_t *pkt);
#ifdef __cplusplus
}
#endif
#endif /*EMU_NETWORK_H*/
#endif /*EMU_NETWORK_H*/

View File

@@ -1,11 +1,16 @@
/* Copyright holders: Sarah Walker
see COPYING for more details
*/
#ifndef EMU_NMI_H
#define EMU_NMI_H
extern int nmi_mask;
extern int nmi;
extern int nmi_auto_clear;
extern void nmi_init(void);
extern void nmi_write(uint16_t port, uint8_t val, void *p);
extern void nmi_write(uint16_t port, uint8_t val, void *priv);
#endif /*EMU_NMI_H*/

View File

@@ -1,130 +1,134 @@
/*
* VARCem Virtual ARchaeological Computer EMulator.
* An emulator of (mostly) x86-based PC systems and devices,
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
* spanning the era between 1981 and 1995.
*
* This file is part of the VARCem Project.
*
* Definitions for the generic NVRAM/CMOS driver.
*
*
*
* Author: Fred N. van Kempen, <decwiz@yahoo.com>,
* David Hrdlička, <hrdlickadavid@outlook.com>
*
* Copyright 2017-2020 Fred N. van Kempen.
* Copyright 2018-2020 David Hrdlička.
*
* Redistribution and use in source and binary forms, with
* or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the entire
* above notice, this list of conditions and the following
* disclaimer.
*
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names
* of its contributors may be used to endorse or promote
* products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef EMU_NVR_H
# define EMU_NVR_H
#define NVR_MAXSIZE 512 /* max size of NVR data */
/* Conversion from BCD to Binary and vice versa. */
#define RTC_BCD(x) (((x) % 10) | (((x) / 10) << 4))
#define RTC_DCB(x) ((((x) & 0xf0) >> 4) * 10 + ((x) & 0x0f))
#define RTC_BCDINC(x,y) RTC_BCD(RTC_DCB(x) + y)
/* Time sync options */
#define TIME_SYNC_DISABLED 0
#define TIME_SYNC_ENABLED 1
#define TIME_SYNC_UTC 2
/* Define a generic RTC/NVRAM device. */
typedef struct _nvr_ {
char *fn; /* pathname of image file */
uint16_t size; /* device configuration */
int8_t irq, is_new;
uint8_t onesec_cnt;
pc_timer_t onesec_time;
void *data; /* local data */
/* Hooks to device functions. */
void (*reset)(struct _nvr_ *);
void (*start)(struct _nvr_ *);
void (*tick)(struct _nvr_ *);
void (*ven_save)(void);
uint8_t regs[NVR_MAXSIZE]; /* these are the registers */
} nvr_t;
extern int nvr_dosave;
#ifdef EMU_DEVICE_H
extern const device_t at_nvr_old_device;
extern const device_t at_nvr_device;
extern const device_t ps_nvr_device;
extern const device_t amstrad_nvr_device;
extern const device_t ibmat_nvr_device;
extern const device_t piix4_nvr_device;
extern const device_t ami_1992_nvr_device;
extern const device_t ami_1994_nvr_device;
extern const device_t ami_1995_nvr_device;
extern const device_t via_nvr_device;
extern const device_t p6rp4_nvr_device;
#endif
extern void rtc_tick(void);
extern void nvr_init(nvr_t *);
extern char *nvr_path(char *str);
extern FILE *nvr_fopen(char *str, char *mode);
extern int nvr_load(void);
extern void nvr_close(void);
extern void nvr_set_ven_save(void (*ven_save)(void));
extern int nvr_save(void);
extern int nvr_is_leap(int year);
extern int nvr_get_days(int month, int year);
extern void nvr_time_sync();
extern void nvr_time_get(struct tm *);
extern void nvr_time_set(struct tm *);
extern void nvr_reg_write(uint16_t reg, uint8_t val, void *priv);
extern void nvr_at_handler(int set, uint16_t base, nvr_t *nvr);
extern void nvr_at_sec_handler(int set, uint16_t base, nvr_t *nvr);
extern void nvr_read_addr_set(int set, nvr_t *nvr);
extern void nvr_wp_set(int set, int h, nvr_t *nvr);
extern void nvr_via_wp_set(int set, int reg, nvr_t *nvr);
extern void nvr_bank_set(int base, uint8_t bank, nvr_t *nvr);
extern void nvr_lock_set(int base, int size, int lock, nvr_t *nvr);
extern void nvr_irq_set(int irq, nvr_t *nvr);
#endif /*EMU_NVR_H*/
/*
* VARCem Virtual ARchaeological Computer EMulator.
* An emulator of (mostly) x86-based PC systems and devices,
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
* spanning the era between 1981 and 1995.
*
* Definitions for the generic NVRAM/CMOS driver.
*
*
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>,
* David Hrdlička, <hrdlickadavid@outlook.com>
*
* Copyright 2017-2020 Fred N. van Kempen.
* Copyright 2018-2020 David Hrdlička.
*
* Redistribution and use in source and binary forms, with
* or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the entire
* above notice, this list of conditions and the following
* disclaimer.
*
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names
* of its contributors may be used to endorse or promote
* products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef EMU_NVR_H
#define EMU_NVR_H
#define NVR_MAXSIZE 512 /* max size of NVR data */
/* Conversion from BCD to Binary and vice versa. */
#define RTC_BCD(x) (((x) % 10) | (((x) / 10) << 4))
#define RTC_DCB(x) ((((x) &0xf0) >> 4) * 10 + ((x) &0x0f))
#define RTC_BCDINC(x, y) RTC_BCD(RTC_DCB(x) + y)
/* Time sync options */
#define TIME_SYNC_DISABLED 0
#define TIME_SYNC_ENABLED 1
#define TIME_SYNC_UTC 2
/* Define a generic RTC/NVRAM device. */
typedef struct _nvr_ {
char *fn; /* pathname of image file */
uint16_t size; /* device configuration */
int8_t irq;
int8_t is_new;
uint8_t onesec_cnt;
pc_timer_t onesec_time;
void *data; /* local data */
/* Hooks to device functions. */
void (*reset)(struct _nvr_ *);
void (*start)(struct _nvr_ *);
void (*tick)(struct _nvr_ *);
void (*ven_save)(void);
uint8_t regs[NVR_MAXSIZE]; /* these are the registers */
} nvr_t;
extern int nvr_dosave;
#ifdef EMU_DEVICE_H
extern const device_t at_nvr_old_device;
extern const device_t at_nvr_device;
extern const device_t at_mb_nvr_device;
extern const device_t ps_nvr_device;
extern const device_t amstrad_nvr_device;
extern const device_t amstrad_megapc_nvr_device;
extern const device_t ibmat_nvr_device;
extern const device_t piix4_nvr_device;
extern const device_t ps_no_nmi_nvr_device;
extern const device_t amstrad_no_nmi_nvr_device;
extern const device_t ami_1992_nvr_device;
extern const device_t ami_1994_nvr_device;
extern const device_t ami_1995_nvr_device;
extern const device_t via_nvr_device;
extern const device_t p6rp4_nvr_device;
extern const device_t elt_nvr_device;
#endif
extern void rtc_tick(void);
extern void nvr_init(nvr_t *);
extern char *nvr_path(char *str);
extern FILE *nvr_fopen(char *str, char *mode);
extern int nvr_load(void);
extern void nvr_close(void);
extern void nvr_set_ven_save(void (*ven_save)(void));
extern int nvr_save(void);
extern int nvr_is_leap(int year);
extern int nvr_get_days(int month, int year);
extern void nvr_time_sync(void);
extern void nvr_time_get(struct tm *);
extern void nvr_time_set(struct tm *);
extern void nvr_reg_write(uint16_t reg, uint8_t val, void *priv);
extern void nvr_at_handler(int set, uint16_t base, nvr_t *nvr);
extern void nvr_at_sec_handler(int set, uint16_t base, nvr_t *nvr);
extern void nvr_at_index_read_handler(int set, uint16_t base, nvr_t *nvr);
extern void nvr_read_addr_set(int set, nvr_t *nvr);
extern void nvr_wp_set(int set, int h, nvr_t *nvr);
extern void nvr_via_wp_set(int set, int reg, nvr_t *nvr);
extern void nvr_bank_set(int base, uint8_t bank, nvr_t *nvr);
extern void nvr_lock_set(int base, int size, int lock, nvr_t *nvr);
extern void nvr_irq_set(int irq, nvr_t *nvr);
extern void nvr_smi_enable(int enable, nvr_t *nvr);
extern uint8_t nvr_smi_status(nvr_t *nvr);
extern void nvr_smi_status_clear(nvr_t *nvr);
#endif /*EMU_NVR_H*/

View File

@@ -1,20 +1,20 @@
/*
* VARCem Virtual ARchaeological Computer EMulator.
* An emulator of (mostly) x86-based PC systems and devices,
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
* spanning the era between 1981 and 1995.
* 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 VARCem Project.
* This file is part of the 86Box distribution.
*
* Definitions for the PS/2 cmos/nvr device.
* Definitions for the PS/2 cmos/nvr device.
*
*
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Sarah Walker, <tommowalker@tommowalker.co.uk>
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Sarah Walker, <https://pcem-emulator.co.uk/>
*
* Copyright 2017,2018 Fred N. van Kempen.
* Copyright 2008-2018 Sarah Walker.
* Copyright 2017-2018 Fred N. van Kempen.
* Copyright 2008-2018 Sarah Walker.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -34,11 +34,11 @@
* Boston, MA 02111-1307
* USA.
*/
#ifndef EMU_NVRPS2_H
# define EMU_NVRPS2_H
#define EMU_NVRPS2_H
extern const device_t ps2_nvr_device;
extern const device_t ps2_nvr_55ls_device;
extern const device_t ps2_nvr_device;
#endif /*EMU_NVRPS2_H*/
#endif /*EMU_NVRPS2_H*/

8
src/include/86box/path.h Normal file
View File

@@ -0,0 +1,8 @@
extern void path_get_dirname(char *dest, const char *path);
extern char *path_get_filename(char *s);
extern char *path_get_extension(char *s);
extern void path_append_filename(char *dest, const char *s1, const char *s2);
extern void path_slash(char *path);
extern const char *path_get_slash(char *path);
extern void path_normalize(char *path);
extern int path_abs(char *path);

View File

@@ -1,132 +1,277 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Definitions for the PCI handler module.
* Definitions for the PCI handler module.
*
*
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
* Sarah Walker, <tommowalker@tommowalker.co.uk>
* Authors: Miran Grca, <mgrca8@gmail.com>
*
* Copyright 2016-2020 Miran Grca.
* Copyright 2017-2020 Fred N. van Kempen.
* Copyright 2008-2020 Sarah Walker.
* Copyright 2023 Miran Grca.
*/
#ifndef EMU_PCI_H
# define EMU_PCI_H
#define EMU_PCI_H
#define PCI_REG_VENDOR_ID_L 0x00
#define PCI_REG_VENDOR_ID_H 0x01
#define PCI_REG_DEVICE_ID_L 0x02
#define PCI_REG_DEVICE_ID_H 0x03
#define PCI_REG_COMMAND_L 0x04
#define PCI_REG_COMMAND_H 0x05
#define PCI_REG_STATUS_L 0x06
#define PCI_REG_STATUS_H 0x07
#define PCI_REG_REVISION 0x08
#define PCI_REG_PROG_IF 0x09
#define PCI_REG_SUBCLASS 0x0a
#define PCI_REG_CLASS 0x0b
#define PCI_REG_CACHELINE_SIZE 0x0c
#define PCI_REG_LATENCY_TIMER 0x0d
#define PCI_REG_HEADER_TYPE 0x0e
#define PCI_REG_BIST 0x0f
#define PCI_REG_COMMAND 0x04
#define PCI_COMMAND_L_IO 0x01
#define PCI_COMMAND_L_MEM 0x02
#define PCI_COMMAND_L_BM 0x04
#define PCI_COMMAND_L_SPECIAL 0x08
#define PCI_COMMAND_L_MEM_WIEN 0x10
#define PCI_COMMAND_L_VGASNOOP 0x20
#define PCI_COMMAND_L_PARITY 0x40
#define PCI_COMMAND_IO 0x01
#define PCI_COMMAND_MEM 0x02
#define PCI_COMMAND_H_SERR 0x01
#define PCI_COMMAND_H_FAST_B2B 0x02
#define PCI_COMMAND_H_INT_DIS 0x04
#define PCI_NO_IRQ_STEERING 0x8000
#define PCI_CAN_SWITCH_TYPE 0x10000
#define PCI_NO_BRIDGES 0x20000
#define PCI_STATUS_L_INT 0x08
#define PCI_STATUS_L_CAPAB 0x10
#define PCI_STATUS_L_66MHZ 0x20
#define PCI_STATUS_L_FAST_B2B 0x80
#define PCI_CONFIG_TYPE_1 1
#define PCI_CONFIG_TYPE_2 2
#define PCI_STATUS_H_MDPERR 0x01 /* Master Data Parity Error */
#define PCI_STATUS_H_DEVSEL 0x06
#define PCI_STATUS_H_STA 0x08 /* Signaled Target Abort */
#define PCI_STATUS_H_RTA 0x10 /* Received Target Abort */
#define PCI_STATUS_H_RMA 0x20 /* Received Master Abort */
#define PCI_STATUS_H_SSE 0x40 /* Signaled System Error */
#define PCI_STATUS_H_DPERR 0x80 /* Detected Parity Error */
#define PCI_CONFIG_TYPE_MASK 0x7fff
#define PCI_DEVSEL_FAST 0x00
#define PCI_DEVSEL_MEDIUM 0x02
#define PCI_DEVSEL_SLOW 0x04
#define PCI_INTA 1
#define PCI_INTB 2
#define PCI_INTC 3
#define PCI_INTD 4
#define FLAG_MECHANISM_1 0x00000001
#define FLAG_MECHANISM_2 0x00000002
#define FLAG_MECHANISM_SWITCH 0x00000004
#define FLAG_CONFIG_IO_ON 0x00000008
#define FLAG_CONFIG_DEV0_IO_ON 0x00000010
#define FLAG_CONFIG_M1_IO_ON 0x00000020
#define FLAG_NO_IRQ_STEERING 0x00000040
#define FLAG_NO_BRIDGES 0x00000080
#define PCI_MIRQ0 0
#define PCI_MIRQ1 1
#define PCI_MIRQ2 2
#define PCI_MIRQ3 3
#define PCI_MIRQ4 4
#define PCI_MIRQ5 5
#define PCI_MIRQ6 6
#define PCI_MIRQ7 7
#define FLAG_MECHANISM_MASK FLAG_MECHANISM_1 | FLAG_MECHANISM_2
#define FLAG_MASK 0x0000007f
#define PCI_IRQ_DISABLED -1
#define PCI_INTA 1
#define PCI_INTB 2
#define PCI_INTC 3
#define PCI_INTD 4
#define PCI_ADD_STRICT 0x80
#define PCI_MIRQ0 0
#define PCI_MIRQ1 1
#define PCI_MIRQ2 2
#define PCI_MIRQ3 3
#define PCI_MIRQ4 4
#define PCI_MIRQ5 5
#define PCI_MIRQ6 6
#define PCI_MIRQ7 7
#define PCI_IRQ_DISABLED -1
#define PCI_ADD_STRICT 0x40
#define PCI_ADD_MASK (PCI_ADD_STRICT - 1)
#define PCI_ADD_VFIO 0x80
#define PCI_ADD_VFIO_MASK (PCI_ADD_VFIO - 1)
#define PCI_CARD_VFIO PCI_ADD_VFIO
#define PCI_BUS_INVALID 0xff
#define PCI_IGNORE_NO_SLOT 0xff
/* The number of an invalid PCI card. */
#define PCI_CARD_INVALID 0xef
/* PCI cards (currently 32). */
#define PCI_CARDS_NUM 0x20
#define PCI_CARD_MAX (PCI_CARDS_NUM - 1)
/* The number of PCI card INT pins - always at 4 per the PCI specification. */
#define PCI_INT_PINS_NUM 4
/* The base for MIRQ lines accepted by pci_irq(). */
#define PCI_MIRQ_BASE PCI_CARDS_NUM
/* PCI MIRQ lines (currently 8, this many are needed by the ALi M1543(C). */
#define PCI_MIRQS_NUM 8
#define PCI_MIRQ_MAX (PCI_MIRQS_NUM - 1)
/* The base for direct IRQ lines accepted by pci_irq(). */
#define PCI_DIRQ_BASE 0xf0
/* PCI direct IRQ lines (currently 16 because we only emulate the legacy PIC). */
#define PCI_DIRQS_NUM 16
#define PCI_DIRQ_MAX (PCI_DIRQS_NUM - 1)
/* PCI IRQ routings (currently 16, this many are needed by the OPTi 822). */
#define PCI_IRQS_NUM 16
#define PCI_IRQ_MAX (PCI_IRQS_NUM - 1)
/* Legacy flags. */
#define PCI_REG_COMMAND PCI_REG_COMMAND_L
#define PCI_COMMAND_IO PCI_COMMAND_L_IO
#define PCI_COMMAND_MEM PCI_COMMAND_L_MEM
#define PCI_CONFIG_TYPE_1 FLAG_MECHANISM_1
#define PCI_CONFIG_TYPE_2 FLAG_MECHANISM_2
#define PCI_CAN_SWITCH_TYPE FLAG_MECHANISM_SWITCH
#define PCI_ALWAYS_EXPOSE_DEV0 FLAG_CONFIG_DEV0_IO_ON
#define PCI_NO_IRQ_STEERING FLAG_NO_IRQ_STEERING
#define PCI_NO_BRIDGES FLAG_NO_BRIDGES
#define PCI_CONFIG_TYPE_MASK FLAG_MECHANISM_MASK
#define bar_t pci_bar_t
#define trc_init pci_trc_init
#define pci_register_slot(card, type, inta, intb, intc, intd) \
pci_register_bus_slot(0, card, type, inta, intb, intc, intd)
#define pci_set_mirq(mirq, level, irq_state) \
pci_irq(PCI_MIRQ_BASE | (mirq), 0, level, 1, irq_state)
#define pci_set_dirq(irq, irq_state) \
pci_irq(PCI_DIRQ_BASE | (irq), 0, 1, 1, irq_state)
#define pci_set_irq(slot, pci_int, irq_state) \
pci_irq(slot, pci_int, 0, 1, irq_state)
#define pci_clear_mirq(mirq, level, irq_state) \
pci_irq(PCI_MIRQ_BASE | (mirq), 0, level, 0, irq_state)
#define pci_clear_dirq(dirq, irq_state) \
pci_irq(PCI_DIRQ_BASE | (irq), 0, 1, 0, irq_state)
#define pci_clear_irq(slot, pci_int, irq_state) \
pci_irq(slot, pci_int, 0, 0, irq_state)
enum {
PCI_CARD_NORTHBRIDGE = 0,
PCI_CARD_AGPBRIDGE,
PCI_CARD_SOUTHBRIDGE,
PCI_CARD_AGP = 0x0f,
PCI_CARD_NORMAL = 0x10,
PCI_CARD_VIDEO,
PCI_CARD_SCSI,
PCI_CARD_SOUND,
PCI_CARD_IDE,
PCI_CARD_NETWORK,
PCI_CARD_BRIDGE,
PCI_CARD_NORTHBRIDGE = 0,
PCI_CARD_NORTHBRIDGE_SEC = 1,
PCI_CARD_AGPBRIDGE = 2,
PCI_CARD_SOUTHBRIDGE = 3,
PCI_CARD_SOUTHBRIDGE_IDE = 4,
PCI_CARD_SOUTHBRIDGE_PMU = 5,
PCI_CARD_SOUTHBRIDGE_USB = 6,
PCI_CARD_AGP = 0x0f,
PCI_CARD_NORMAL = 0x10,
PCI_CARD_VIDEO = 0x11,
PCI_CARD_HANGUL = 0x12,
PCI_CARD_IDE = 0x13,
PCI_CARD_SCSI = 0x14,
PCI_CARD_SOUND = 0x15,
PCI_CARD_MODEM = 0x16,
PCI_CARD_NETWORK = 0x17,
PCI_CARD_UART = 0x18,
PCI_CARD_USB = 0x19,
PCI_CARD_BRIDGE = 0x1a
};
enum {
PCI_ADD_NORTHBRIDGE = 0,
PCI_ADD_AGPBRIDGE,
PCI_ADD_SOUTHBRIDGE,
PCI_ADD_AGP = 0x0f,
PCI_ADD_NORMAL = 0x10,
PCI_ADD_VIDEO,
PCI_ADD_SCSI,
PCI_ADD_SOUND,
PCI_ADD_IDE,
PCI_ADD_NETWORK,
PCI_ADD_BRIDGE
PCI_ADD_NORTHBRIDGE = 0,
PCI_ADD_NORTHBRIDGE_SEC = 1,
PCI_ADD_AGPBRIDGE = 2,
PCI_ADD_SOUTHBRIDGE = 3,
PCI_ADD_SOUTHBRIDGE_IDE = 4,
PCI_ADD_SOUTHBRIDGE_PMU = 5,
PCI_ADD_SOUTHBRIDGE_USB = 6,
PCI_ADD_AGP = 0x0f,
PCI_ADD_NORMAL = 0x10,
PCI_ADD_VIDEO = 0x11,
PCI_ADD_HANGUL = 0x12,
PCI_ADD_IDE = 0x13,
PCI_ADD_SCSI = 0x14,
PCI_ADD_SOUND = 0x15,
PCI_ADD_MODEM = 0x16,
PCI_ADD_NETWORK = 0x17,
PCI_ADD_UART = 0x18,
PCI_ADD_USB = 0x19,
PCI_ADD_BRIDGE = 0x1a
};
typedef union {
uint32_t addr;
uint8_t addr_regs[4];
} bar_t;
} pci_bar_t;
extern int pci_burst_time;
extern int agp_burst_time;
extern int pci_nonburst_time;
extern int agp_nonburst_time;
extern int pci_burst_time, agp_burst_time,
pci_nonburst_time, agp_nonburst_time;
extern int pci_flags;
extern uint32_t pci_base;
extern uint32_t pci_size;
extern void pci_set_irq_routing(int pci_int, int irq);
extern void pci_set_irq_level(int pci_int, int level);
extern void pci_set_irq_routing(int pci_int, int irq);
extern void pci_set_irq_level(int pci_int, int level);
extern void pci_enable_mirq(int mirq);
extern void pci_set_mirq_routing(int mirq, uint8_t irq);
extern uint8_t pci_get_mirq_level(int mirq);
extern void pci_set_mirq_level(int mirq, uint8_t irq);
extern void pci_enable_mirq(int mirq);
extern void pci_set_mirq_routing(int mirq, int irq);
/* PCI raise IRQ: the first parameter is slot if < PCI_MIRQ_BASE, MIRQ if >= PCI_MIRQ_BASE
and < PCI_DIRQ_BASE, and direct IRQ line if >= PCI_DIRQ_BASE (RichardG's
hack that may no longer be needed). */
extern void pci_irq(uint8_t slot, uint8_t pci_int, int level, int set, uint8_t *irq_state);
extern int pci_irq_is_level(int irq);
extern uint8_t pci_get_int(uint8_t slot, uint8_t pci_int);
extern void pci_set_mirq(uint8_t mirq, int level);
extern void pci_set_irq(uint8_t card, uint8_t pci_int);
extern void pci_clear_mirq(uint8_t mirq, int level);
extern void pci_clear_irq(uint8_t card, uint8_t pci_int);
extern uint8_t pci_get_int(uint8_t card, uint8_t pci_int);
/* Relocate a PCI device to a new slot, required for the configurable
IDSEL's of ALi M1543(c). */
extern void pci_relocate_slot(int type, int new_slot);
extern void pci_reset(void);
extern void pci_init(int type);
extern uint8_t pci_register_bus();
extern void pci_set_pmc(uint8_t pmc);
extern void pci_remap_bus(uint8_t bus_index, uint8_t bus_number);
extern void pci_register_slot(int card, int type,
int inta, int intb, int intc, int intd);
extern void pci_register_bus_slot(int bus, int card, int type,
int inta, int intb, int intc, int intd);
extern void pci_close(void);
extern uint8_t pci_add_card(uint8_t add_type, uint8_t (*read)(int func, int addr, void *priv), void (*write)(int func, int addr, uint8_t val, void *priv), void *priv);
/* Write PCI enable/disable key, split for the ALi M1435. */
extern void pci_key_write(uint8_t val);
extern void trc_init(void);
/* Set PMC (ie. change PCI configuration mechanism), 0 = #2, 1 = #1. */
extern void pci_set_pmc(uint8_t pmc);
extern uint8_t trc_read(uint16_t port, void *priv);
extern void trc_write(uint16_t port, uint8_t val, void *priv);
extern void pci_pic_reset(void);
extern void pci_reset(void);
extern void pci_bridge_set_ctl(void *priv, uint8_t ctl);
/* Needed for the io.c handling of configuration mechanism #2 ports C000-CFFF. */
extern void pci_write(uint16_t port, uint8_t val, void *priv);
extern void pci_writew(uint16_t port, uint16_t val, void *priv);
extern void pci_writel(uint16_t port, uint32_t val, void *priv);
extern uint8_t pci_read(uint16_t port, void *priv);
extern uint16_t pci_readw(uint16_t port, void *priv);
extern uint32_t pci_readl(uint16_t port, void *priv);
extern void pci_pic_reset(void);
extern uint8_t pci_register_bus(void);
extern void pci_remap_bus(uint8_t bus_index, uint8_t bus_number);
extern void pci_register_bus_slot(int bus, int card, int type, int inta, int intb, int intc, int intd);
/* Add a PCI card. */
extern void pci_add_card(uint8_t add_type, uint8_t (*read)(int func, int addr, void *priv),
void (*write)(int func, int addr, uint8_t val, void *priv), void *priv, uint8_t *slot);
/* Add an instance of the PCI bridge. */
extern void pci_add_bridge(uint8_t agp, uint8_t (*read)(int func, int addr, void *priv),
void (*write)(int func, int addr, uint8_t val, void *priv), void *priv,
uint8_t *slot);
/* Register the cards that have been added into slots. */
extern void pci_register_cards(void);
extern void pci_init(int flags);
/* PCI bridge stuff. */
extern void pci_bridge_set_ctl(void *priv, uint8_t ctl);
#ifdef EMU_DEVICE_H
extern const device_t dec21150_device;
@@ -142,5 +287,4 @@ extern const device_t via_apro_agp_device;
extern const device_t via_vt8601_agp_device;
#endif
#endif /*EMU_PCI_H*/
#endif /*EMU_PCI_H*/

View File

@@ -1 +1,6 @@
extern void pci_dummy_init(void);
#ifndef EMU_PCI_DUMMY_H
#define EMU_PCI_DUMMY_H
extern void pci_dummy_init(int min_slot, int max_slot, int nb_slot, int sb_slot);
#endif /*EMU_PCI_DUMMY_H*/

View File

@@ -1,65 +1,105 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Header of the implementation of the Intel PIC chip emulation,
* partially ported from reenigne's XTCE.
* Header of the implementation of the Intel PIC chip emulation,
* partially ported from reenigne's XTCE.
*
* Authors: Andrew Jenner, <https://www.reenigne.org>
* Miran Grca, <mgrca8@gmail.com>
* Authors: Andrew Jenner, <https://www.reenigne.org>
* Miran Grca, <mgrca8@gmail.com>
*
* Copyright 2015-2020 Andrew Jenner.
* Copyright 2016-2020 Miran Grca.
* Copyright 2015-2020 Andrew Jenner.
* Copyright 2016-2020 Miran Grca.
*/
#ifndef EMU_PIC_H
# define EMU_PIC_H
#ifndef EMU_PIC_H
#define EMU_PIC_H
typedef struct pic_latch {
uint8_t d;
uint8_t e;
uint8_t q;
uint8_t nq;
} pic_latch_t;
typedef struct pic {
uint8_t icw1, icw2, icw3, icw4,
imr, isr, irr, ocw2,
ocw3, int_pending, is_master, elcr,
state, ack_bytes, priority, special_mask_mode,
auto_eoi_rotate, interrupt, lines, data_bus;
uint32_t at;
struct pic *slaves[8];
uint8_t icw1;
uint8_t icw2;
uint8_t icw3;
uint8_t icw4;
uint8_t imr;
uint8_t isr;
uint8_t irr;
uint8_t ocw2;
uint8_t ocw3;
uint8_t int_pending;
uint8_t is_master;
uint8_t elcr;
uint8_t state;
uint8_t ack_bytes;
uint8_t priority;
uint8_t special_mask_mode;
uint8_t auto_eoi_rotate;
uint8_t interrupt;
uint8_t data_bus;
uint8_t irq_latch;
uint8_t has_slaves;
uint8_t flags;
uint8_t edge_lines;
uint8_t pad;
uint32_t lines[8];
uint32_t at;
struct pic *slaves[8];
} pic_t;
extern pic_t pic;
extern pic_t pic2;
extern pic_t pic, pic2;
extern void pic_reset_smi_irq_mask(void);
extern void pic_set_smi_irq_mask(int irq, int set);
extern uint16_t pic_get_smi_irq_status(void);
extern void pic_clear_smi_irq_status(int irq);
extern int pic_elcr_get_enabled(void);
extern void pic_elcr_set_enabled(int enabled);
extern void pic_elcr_io_handler(int set);
extern void pic_elcr_write(uint16_t port, uint8_t val, void *priv);
extern uint8_t pic_elcr_read(uint16_t port, void *priv);
extern void pic_reset_smi_irq_mask(void);
extern void pic_set_smi_irq_mask(int irq, int set);
extern uint16_t pic_get_smi_irq_status(void);
extern void pic_clear_smi_irq_status(int irq);
extern void pic_set_shadow(int sh);
extern int pic_get_pci_flag(void);
extern void pic_set_pci_flag(int pci);
extern void pic_set_pci(void);
extern void pic_kbd_latch(int enable);
extern void pic_mouse_latch(int enable);
extern void pic_init(void);
extern void pic_init_pcjr(void);
extern void pic2_init(void);
extern void pic_reset(void);
extern int pic_elcr_get_enabled(void);
extern void pic_elcr_set_enabled(int enabled);
extern void pic_elcr_io_handler(int set);
extern void pic_elcr_write(uint16_t port, uint8_t val, void *priv);
extern uint8_t pic_elcr_read(uint16_t port, void *priv);
extern uint8_t pic_read_icw(uint8_t pic_id, uint8_t icw);
extern uint8_t pic_read_ocw(uint8_t pic_id, uint8_t ocw);
extern int picint_is_level(int irq);
extern void picint_common(uint16_t num, int level, int set, uint8_t *irq_state);
extern int picinterrupt(void);
extern void pic_set_shadow(int sh);
extern void pic_set_pci_flag(int pci);
extern void pic_set_pci(void);
extern void pic_init(void);
extern void pic_init_pcjr(void);
extern void pic2_init(void);
extern void pic_reset(void);
#define PIC_IRQ_EDGE 0
#define PIC_IRQ_LEVEL 1
extern int picint_is_level(int irq);
extern void picint_common(uint16_t num, int level, int set);
extern void picint(uint16_t num);
extern void picintlevel(uint16_t num);
extern void picintc(uint16_t num);
extern int picinterrupt(void);
#define PIC_SLAVE_PENDING 0x01
#define PIC_FREEZE 0x02
#define PIC_MASTER_CLEAR 0x04
extern uint8_t pic_irq_ack(void);
/* Legacy defines. */
#define picint(num) picint_common(num, PIC_IRQ_EDGE, 1, NULL)
#define picintlevel(num, irq_state) picint_common(num, PIC_IRQ_LEVEL, 1, irq_state)
#define picintc(num) picint_common(num, PIC_IRQ_EDGE, 0, NULL)
#define picintclevel(num, irq_state) picint_common(num, PIC_IRQ_LEVEL, 0, irq_state)
extern uint8_t pic_irq_ack(void);
#endif /*EMU_PIC_H*/
#endif /*EMU_PIC_H*/

View File

@@ -1,118 +1,144 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Header of the implementation of the Intel 8253/8254
* Programmable Interval Timer.
* Header of the implementation of the Intel 8253/8254
* Programmable Interval Timer.
*
*
*
* Author: Miran Grca, <mgrca8@gmail.com>
* Copyright 2019,2020 Miran Grca.
* Authors: Miran Grca, <mgrca8@gmail.com>
*
* Copyright 2019-2020 Miran Grca.
*/
#ifndef EMU_PIT_H
# define EMU_PIT_H
#define EMU_PIT_H
typedef struct ctr_t {
uint8_t m;
uint8_t ctrl;
uint8_t read_status;
uint8_t latch;
uint8_t s1_det;
uint8_t l_det;
uint8_t bcd;
uint8_t incomplete;
typedef struct {
uint8_t m, ctrl,
read_status, latch,
s1_det, l_det,
bcd, pad;
uint16_t rl;
uint16_t rl;
int rm, wm, gate, out,
newcount, clock, using_timer, latched,
state, null_count, do_read_status;
int rm;
int wm;
int gate;
int out;
int newcount;
int clock;
int using_timer;
int latched;
int state;
int null_count;
int do_read_status;
union {
int count;
struct {
int units :4;
int tens :4;
int hundreds :4;
int thousands :4;
int myriads :4;
};
int32_t count;
struct {
int32_t units : 4;
int32_t tens : 4;
int32_t hundreds : 4;
int32_t thousands : 4;
int32_t myriads : 4;
};
};
uint32_t l;
uint32_t l;
void (*load_func)(uint8_t new_m, int new_count);
void (*out_func)(int new_out, int old_out);
void (*load_func)(uint8_t new_m, int new_count);
void (*out_func)(int new_out, int old_out);
} ctr_t;
typedef struct PIT {
int flags, clock;
pc_timer_t callback_timer;
int flags;
int clock;
pc_timer_t callback_timer;
ctr_t counters[3];
ctr_t counters[3];
uint8_t ctrl;
uint8_t ctrl;
} pit_t;
enum {
PIT_8253 = 0,
PIT_8254 = 1,
PIT_8253_FAST = 2,
PIT_8254_FAST = 3
};
extern pit_t *pit,
*pit2;
typedef struct pit_intf_t {
uint8_t (*read)(uint16_t addr, void *priv);
void (*write)(uint16_t addr, uint8_t val, void *priv);
/* Gets a counter's count. */
uint16_t (*get_count)(void *data, int counter_id);
/* Sets a counter's GATE input. */
void (*set_gate)(void *data, int counter_id, int gate);
/* Sets if a counter's CLOCK input is from the timer or not - used by PCjr. */
void (*set_using_timer)(void *data, int counter_id, int using_timer);
/* Sets a counter's OUT output handler. */
void (*set_out_func)(void *data, int counter_id, void (*func)(int new_out, int old_out));
/* Sets a counter's load count handler. */
void (*set_load_func)(void *data, int counter_id, void (*func)(uint8_t new_m, int new_count));
void (*ctr_clock)(void *data, int counter_id);
void *data;
} pit_intf_t;
extern double SYSCLK, PCICLK, AGPCLK;
extern pit_intf_t pit_devs[2];
extern const pit_intf_t pit_classic_intf;
extern uint64_t PITCONST, ISACONST,
CGACONST,
MDACONST,
HERCCONST,
VGACONST1,
VGACONST2,
RTCCONST, ACPICONST;
extern double SYSCLK;
extern double PCICLK;
extern double AGPCLK;
extern int refresh_at_enable;
extern uint64_t PITCONST;
extern uint64_t ISACONST;
extern uint64_t CGACONST;
extern uint64_t MDACONST;
extern uint64_t HERCCONST;
extern uint64_t VGACONST1;
extern uint64_t VGACONST2;
extern uint64_t RTCCONST;
extern int refresh_at_enable;
/* Gets a counter's count. */
extern uint16_t pit_ctr_get_count(ctr_t *ctr);
/* Sets a counter's load count handler. */
extern void pit_ctr_set_load_func(ctr_t *ctr, void (*func)(uint8_t new_m, int new_count));
/* Sets a counter's OUT output handler. */
extern void pit_ctr_set_out_func(ctr_t *ctr, void (*func)(int new_out, int old_out));
/* Sets a counter's GATE input. */
extern void pit_ctr_set_gate(ctr_t *ctr, int gate);
/* Sets a counter's CLOCK input. */
extern void pit_ctr_set_clock(ctr_t *ctr, int clock);
/* Sets if a counter's CLOCK input is from the timer or not - used by PCjr. */
extern void pit_ctr_set_using_timer(ctr_t *ctr, int using_timer);
extern void pit_ctr_set_clock(ctr_t *ctr, int clock);
extern pit_t * pit_common_init(int type, void (*out0)(int new_out, int old_out), void (*out1)(int new_out, int old_out));
extern pit_t * pit_ps2_init(void);
extern void pit_reset(pit_t *dev);
extern pit_t *pit_common_init(int type, void (*out0)(int new_out, int old_out), void (*out1)(int new_out, int old_out));
extern pit_t *pit_ps2_init(int type);
extern void pit_reset(pit_t *dev);
extern void pit_irq0_timer(int new_out, int old_out);
extern void pit_irq0_timer_pcjr(int new_out, int old_out);
extern void pit_irq0_timer_ps2(int new_out, int old_out);
extern void pit_irq0_timer_ps2(int new_out, int old_out);
extern void pit_refresh_timer_xt(int new_out, int old_out);
extern void pit_refresh_timer_at(int new_out, int old_out);
extern void pit_refresh_timer_xt(int new_out, int old_out);
extern void pit_refresh_timer_at(int new_out, int old_out);
extern void pit_speaker_timer(int new_out, int old_out);
extern void pit_speaker_timer(int new_out, int old_out);
extern void pit_nmi_timer_ps2(int new_out, int old_out);
extern void pit_nmi_timer_ps2(int new_out, int old_out);
extern void pit_set_clock(int clock);
extern void pit_handler(int set, uint16_t base, int size, void *priv);
extern void pit_set_clock(uint32_t clock);
extern void pit_handler(int set, uint16_t base, int size, void *priv);
extern uint8_t pit_read_reg(void *priv, uint8_t reg);
#ifdef EMU_DEVICE_H
extern const device_t i8253_device;
extern const device_t i8254_device;
extern const device_t i8254_sec_device;
extern const device_t i8254_ext_io_device;
extern const device_t i8254_ps2_device;
extern const device_t i8253_device;
extern const device_t i8254_device;
extern const device_t i8254_sec_device;
extern const device_t i8254_ext_io_device;
extern const device_t i8254_ps2_device;
#endif
#endif /*EMU_PIT_H*/
#endif /*EMU_PIT_H*/

View File

@@ -0,0 +1,84 @@
/*
* 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.
*
* Header of the implementation of the Intel 8253/8254
* Programmable Interval Timer.
*
*
*
* Authors: Miran Grca, <mgrca8@gmail.com>
*
* Copyright 2019-2020 Miran Grca.
*/
#ifndef EMU_PIT_FAST_H
#define EMU_PIT_FAST_H
typedef struct ctrf_t {
uint8_t m;
uint8_t ctrl;
uint8_t read_status;
uint8_t latch;
uint8_t bcd;
uint16_t rl;
int rm;
int wm;
int gate;
int out;
int newcount;
int clock;
int using_timer;
int latched;
int do_read_status;
int enabled;
int disabled;
int initial;
int thit;
int running;
int rereadlatch;
union {
int32_t count;
struct {
int32_t units : 4;
int32_t tens : 4;
int32_t hundreds : 4;
int32_t thousands : 4;
int32_t myriads : 4;
};
};
uint32_t l;
pc_timer_t timer;
void (*load_func)(uint8_t new_m, int new_count);
void (*out_func)(int new_out, int old_out);
} ctrf_t;
typedef struct pitf_t {
int flags;
ctrf_t counters[3];
uint8_t ctrl;
} pitf_t;
extern uint8_t pitf_read_reg(void *priv, uint8_t reg);
extern const pit_intf_t pit_fast_intf;
#ifdef EMU_DEVICE_H
extern const device_t i8253_fast_device;
extern const device_t i8254_fast_device;
extern const device_t i8254_sec_fast_device;
extern const device_t i8254_ext_io_fast_device;
extern const device_t i8254_ps2_fast_device;
#endif
#endif /*EMU_PIT_FAST_H*/

View File

@@ -1,29 +1,32 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Define the various platform support functions.
* Define the various platform support functions.
*
*
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
* Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2016-2019 Miran Grca.
* Copyright 2017-2019 Fred N. van Kempen.
* Copyright 2021 Laci bá'
* Copyright 2016-2019 Miran Grca.
* Copyright 2017-2019 Fred N. van Kempen.
* Copyright 2021 Laci bá'
*/
#ifndef EMU_PLAT_H
# define EMU_PLAT_H
#ifndef EMU_PLAT_H
#define EMU_PLAT_H
#include <stdint.h>
#include <stdio.h>
#include "86box/device.h"
#include "86box/machine.h"
#ifndef GLOBAL
# define GLOBAL extern
# define GLOBAL extern
#endif
/* String ID numbers. */
@@ -31,190 +34,160 @@
/* The Win32 API uses _wcsicmp. */
#ifdef _WIN32
# define wcscasecmp _wcsicmp
# define strcasecmp _stricmp
# define wcscasecmp _wcsicmp
# define strcasecmp _stricmp
#else
/* Declare these functions to avoid warnings. They will redirect to strcasecmp and strncasecmp respectively. */
extern int stricmp(const char* s1, const char* s2);
extern int strnicmp(const char* s1, const char* s2, size_t n);
extern int stricmp(const char *s1, const char *s2);
extern int strnicmp(const char *s1, const char *s2, size_t n);
#endif
#if (defined(__unix__) || defined(__APPLE__)) && !defined(__linux__)
#if (defined(__HAIKU__) || defined(__unix__) || defined(__APPLE__)) && !defined(__linux__)
/* FreeBSD has largefile by default. */
# define fopen64 fopen
# define fseeko64 fseeko
# define ftello64 ftello
# define off64_t off_t
# define fopen64 fopen
# define fseeko64 fseeko
# define ftello64 ftello
# define off64_t off_t
#elif defined(_MSC_VER)
//# define fopen64 fopen
# define fseeko64 _fseeki64
# define ftello64 _ftelli64
# define off64_t off_t
// # define fopen64 fopen
# define fseeko64 _fseeki64
# define ftello64 _ftelli64
# define off64_t off_t
#endif
#ifdef _MSC_VER
# define UNUSED(arg) arg
# define UNUSED(arg) arg
#else
/* A hack (GCC-specific?) to allow us to ignore unused parameters. */
# define UNUSED(arg) __attribute__((unused))arg
/* A hack (GCC-specific?) to allow us to ignore unused parameters. */
# define UNUSED(arg) __attribute__((unused)) arg
#endif
/* Return the size (in wchar's) of a wchar_t array. */
#define sizeof_w(x) (sizeof((x)) / sizeof(wchar_t))
#define sizeof_w(x) (sizeof((x)) / sizeof(wchar_t))
#ifdef __cplusplus
#include <atomic>
#define atomic_flag_t std::atomic_flag
# include <atomic>
# define atomic_flag_t std::atomic_flag
# define atomic_bool_t std::atomic_bool
extern "C" {
#else
#include <stdatomic.h>
#define atomic_flag_t atomic_flag
# include <stdatomic.h>
# define atomic_flag_t atomic_flag
# define atomic_bool_t atomic_bool
#endif
#if defined(_MSC_VER)
# define ssize_t intptr_t
#endif
#ifdef _MSC_VER
# define fallthrough do {} while (0) /* fallthrough */
#else
# if __has_attribute(fallthrough)
# define fallthrough __attribute__((fallthrough))
# else
# if __has_attribute(__fallthrough__)
# define fallthrough __attribute__((__fallthrough__))
# endif
# define fallthrough do {} while (0) /* fallthrough */
# endif
#endif
/* Global variables residing in the platform module. */
extern int dopause, /* system is paused */
mouse_capture; /* mouse is captured in app */
extern atomic_flag_t doresize; /* screen resize requested */
extern volatile int is_quit; /* system exit requested */
extern int dopause; /* system is paused */
extern int mouse_capture; /* mouse is captured in app */
extern volatile int is_quit; /* system exit requested */
#ifdef MTR_ENABLED
extern int tracing_on;
#endif
extern uint64_t timer_freq;
extern int infocus;
extern char emu_version[200]; /* version ID string */
extern int rctrl_is_lalt;
extern int update_icons;
extern int status_icons_fullscreen;
extern uint64_t timer_freq;
extern int infocus;
extern char emu_version[200]; /* version ID string */
extern int rctrl_is_lalt;
extern int update_icons;
extern int status_icons_fullscreen;
extern int unscaled_size_x, /* current unscaled size X */
unscaled_size_y; /* current unscaled size Y */
extern int kbd_req_capture, hide_status_bar, hide_tool_bar;
extern int kbd_req_capture;
extern int hide_status_bar;
extern int hide_tool_bar;
/* System-related functions. */
extern char *fix_exe_path(char *str);
extern FILE *plat_fopen(const char *path, const char *mode);
extern FILE *plat_fopen64(const char *path, const char *mode);
extern void plat_remove(char *path);
extern int plat_getcwd(char *bufp, int max);
extern int plat_chdir(char *path);
extern void plat_tempfile(char *bufp, char *prefix, char *suffix);
extern void plat_get_exe_name(char *s, int size);
extern char *plat_get_basename(const char *path);
extern void plat_get_dirname(char *dest, const char *path);
extern char *plat_get_filename(char *s);
extern char *plat_get_extension(char *s);
extern void plat_append_filename(char *dest, const char *s1, const char *s2);
extern void plat_put_backslash(char *s);
extern void plat_path_slash(char *path);
extern int plat_path_abs(char *path);
extern int plat_dir_check(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);
extern uint64_t plat_timer_read(void);
extern uint32_t plat_get_ticks(void);
extern uint32_t plat_get_micro_ticks(void);
extern void plat_delay_ms(uint32_t count);
extern void plat_pause(int p);
extern void plat_mouse_capture(int on);
extern int plat_vidapi(char *name);
extern char *plat_vidapi_name(int api);
extern int plat_setvid(int api);
extern void plat_vidsize(int x, int y);
extern void plat_setfullscreen(int on);
extern void plat_resize(int x, int y);
extern void plat_vidapi_enable(int enabled);
extern void plat_vidapi_reload(void);
extern void plat_vid_reload_options(void);
extern uint32_t plat_language_code(char* langcode);
extern void plat_language_code_r(uint32_t lcid, char* outbuf, int len);
extern char *fix_exe_path(char *str);
extern FILE *plat_fopen(const char *path, const char *mode);
extern FILE *plat_fopen64(const char *path, const char *mode);
extern void plat_remove(char *path);
extern int plat_getcwd(char *bufp, int max);
extern int plat_chdir(char *path);
extern void plat_tempfile(char *bufp, char *prefix, char *suffix);
extern void plat_get_exe_name(char *s, int size);
extern void plat_get_global_config_dir(char* strptr);
extern void plat_init_rom_paths(void);
extern int plat_dir_check(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);
extern uint64_t plat_timer_read(void);
extern uint32_t plat_get_ticks(void);
extern uint32_t plat_get_micro_ticks(void);
extern void plat_delay_ms(uint32_t count);
extern void plat_pause(int p);
extern void plat_mouse_capture(int on);
extern int plat_vidapi(char *name);
extern char *plat_vidapi_name(int api);
extern int plat_setvid(int api);
extern void plat_vidsize(int x, int y);
extern void plat_setfullscreen(int on);
extern void plat_resize_monitor(int x, int y, int monitor_index);
extern void plat_resize_request(int x, int y, int monitor_index);
extern void plat_resize(int x, int y);
extern void plat_vidapi_enable(int enabled);
extern void plat_vidapi_reload(void);
extern void plat_vid_reload_options(void);
extern uint32_t plat_language_code(char *langcode);
extern void plat_language_code_r(uint32_t lcid, char *outbuf, int len);
extern void plat_get_cpu_string(char *outbuf, uint8_t len);
extern double plat_get_dpi(void);
/* Resource management. */
extern void set_language(uint32_t id);
extern wchar_t *plat_get_string(int id);
extern void set_language(uint32_t id);
extern wchar_t *plat_get_string(int id);
/* Emulator start/stop support functions. */
extern void do_start(void);
extern void do_stop(void);
extern void do_start(void);
extern void do_stop(void);
/* Power off. */
extern void plat_power_off(void);
extern void plat_power_off(void);
/* Platform-specific device support. */
extern void cassette_mount(char *fn, uint8_t wp);
extern void cassette_eject(void);
extern void cartridge_mount(uint8_t id, char *fn, uint8_t wp);
extern void cartridge_eject(uint8_t id);
extern void floppy_mount(uint8_t id, char *fn, uint8_t wp);
extern void floppy_eject(uint8_t id);
extern void cdrom_mount(uint8_t id, char *fn);
extern void plat_cdrom_ui_update(uint8_t id, uint8_t reload);
extern void zip_eject(uint8_t id);
extern void zip_mount(uint8_t id, char *fn, uint8_t wp);
extern void zip_reload(uint8_t id);
extern void mo_eject(uint8_t id);
extern void mo_mount(uint8_t id, char *fn, uint8_t wp);
extern void mo_reload(uint8_t id);
extern int ioctl_open(uint8_t id, char d);
extern void ioctl_reset(uint8_t id);
extern void ioctl_close(uint8_t id);
#ifdef __APPLE__
#define thread_t plat_thread_t
#define event_t plat_event_t
#define mutex_t plat_mutex_t
#define thread_create plat_thread_create
#define thread_wait plat_thread_wait
#define thread_create_event plat_thread_create_event
#define thread_set_event plat_thread_set_event
#define thread_reset_event plat_thread_reset_event
#define thread_wait_event plat_thread_wait_event
#define thread_destroy_event plat_thread_destroy_event
#define thread_create_mutex plat_thread_create_mutex
#define thread_create_mutex_with_spin_count plat_thread_create_mutex_with_spin_count
#define thread_close_mutex plat_thread_close_mutex
#define thread_wait_mutex plat_thread_wait_mutex
#define thread_release_mutex plat_thread_release_mutex
#endif
/* Thread support. */
typedef void thread_t;
typedef void event_t;
typedef void mutex_t;
extern thread_t *thread_create(void (*thread_func)(void *param), void *param);
extern int thread_wait(thread_t *arg);
extern event_t *thread_create_event(void);
extern void thread_set_event(event_t *arg);
extern void thread_reset_event(event_t *arg);
extern int thread_wait_event(event_t *arg, int timeout);
extern void thread_destroy_event(event_t *arg);
#define MUTEX_DEFAULT_SPIN_COUNT 1024
extern mutex_t *thread_create_mutex(void);
extern void thread_close_mutex(mutex_t *arg);
extern int thread_wait_mutex(mutex_t *arg);
extern int thread_release_mutex(mutex_t *mutex);
extern void cassette_mount(char *fn, uint8_t wp);
extern void cassette_eject(void);
extern void cartridge_mount(uint8_t id, char *fn, uint8_t wp);
extern void cartridge_eject(uint8_t id);
extern void floppy_mount(uint8_t id, char *fn, uint8_t wp);
extern void floppy_eject(uint8_t id);
extern void cdrom_mount(uint8_t id, char *fn);
extern void plat_cdrom_ui_update(uint8_t id, uint8_t reload);
extern void zip_eject(uint8_t id);
extern void zip_mount(uint8_t id, char *fn, uint8_t wp);
extern void zip_reload(uint8_t id);
extern void mo_eject(uint8_t id);
extern void mo_mount(uint8_t id, char *fn, uint8_t wp);
extern void mo_reload(uint8_t id);
extern int ioctl_open(uint8_t id, char d);
extern void ioctl_reset(uint8_t id);
extern void ioctl_close(uint8_t id);
/* Other stuff. */
extern void startblit(void);
extern void endblit(void);
extern void take_screenshot(void);
extern void startblit(void);
extern void endblit(void);
extern void take_screenshot(void);
/* Conversion between UTF-8 and UTF-16. */
extern size_t mbstoc16s(uint16_t dst[], const char src[], int len);
extern size_t c16stombs(char dst[], const uint16_t src[], int len);
extern size_t mbstoc16s(uint16_t dst[], const char src[], int len);
extern size_t c16stombs(char dst[], const uint16_t src[], int len);
#ifdef MTR_ENABLED
extern void init_trace(void);
@@ -225,5 +198,4 @@ extern void shutdown_trace(void);
}
#endif
#endif /*EMU_PLAT_H*/
#endif /*EMU_PLAT_H*/

View File

@@ -1,76 +1,74 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Definitions for the platform OpenDir module.
* Definitions for the platform OpenDir module.
*
*
*
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
* Copyright 2017 Fred N. van Kempen.
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2017 Fred N. van Kempen.
*/
#ifndef PLAT_DIR_H
# define PLAT_DIR_H
#ifdef _MAX_FNAME
# define MAXNAMLEN _MAX_FNAME
#else
# define MAXNAMLEN 15
#endif
# define MAXDIRLEN 127
#define PLAT_DIR_H
/* Windows and Termux needs the POSIX re-implementations */
#if defined(_WIN32) || defined(__TERMUX__)
# ifdef _MAX_FNAME
# define MAXNAMLEN _MAX_FNAME
# else
# define MAXNAMLEN 15
# endif
# define MAXDIRLEN 127
struct dirent {
long d_ino;
unsigned short d_reclen;
unsigned short d_off;
#ifdef UNICODE
wchar_t d_name[MAXNAMLEN + 1];
#else
char d_name[MAXNAMLEN + 1];
#endif
long d_ino;
unsigned short d_reclen;
unsigned short d_off;
# ifdef UNICODE
wchar_t d_name[MAXNAMLEN + 1];
# else
char d_name[MAXNAMLEN + 1];
# endif
};
#define d_namlen d_reclen
# define d_namlen d_reclen
typedef struct {
short flags; /* internal flags */
short offset; /* offset of entry into dir */
long handle; /* open handle to Win32 system */
short sts; /* last known status code */
char *dta; /* internal work data */
#ifdef UNICODE
wchar_t dir[MAXDIRLEN+1]; /* open dir */
#else
char dir[MAXDIRLEN+1]; /* open dir */
#endif
struct dirent dent; /* actual directory entry */
typedef struct DIR_t {
short flags; /* internal flags */
short offset; /* offset of entry into dir */
long handle; /* open handle to Win32 system */
short sts; /* last known status code */
char *dta; /* internal work data */
# ifdef UNICODE
wchar_t dir[MAXDIRLEN + 1]; /* open dir */
# else
char dir[MAXDIRLEN + 1]; /* open dir */
# endif
struct dirent dent; /* actual directory entry */
} DIR;
/* Directory routine flags. */
#define DIR_F_LOWER 0x0001 /* force to lowercase */
#define DIR_F_SANE 0x0002 /* force this to sane path */
#define DIR_F_ISROOT 0x0010 /* this is the root directory */
# define DIR_F_LOWER 0x0001 /* force to lowercase */
# define DIR_F_SANE 0x0002 /* force this to sane path */
# define DIR_F_ISROOT 0x0010 /* this is the root directory */
/* Function prototypes. */
#ifdef UNICODE
extern DIR *opendirw(const wchar_t *);
extern DIR *opendir(const char *);
extern struct dirent *readdir(DIR *);
extern long telldir(DIR *);
extern void seekdir(DIR *, long);
extern int closedir(DIR *);
# define rewinddir(dirp) seekdir(dirp, 0L)
#else
extern DIR *opendir(const char *);
/* On linux and macOS, use the standard functions and types */
# include <dirent.h>
#endif
extern struct dirent *readdir(DIR *);
extern long telldir(DIR *);
extern void seekdir(DIR *, long);
extern int closedir(DIR *);
#define rewinddir(dirp) seekdir(dirp, 0L)
#endif /*PLAT_DIR_H*/
#endif /*PLAT_DIR_H*/

View File

@@ -1,38 +1,37 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Define the Dynamic Module Loader interface.
* Define the Dynamic Module Loader interface.
*
*
*
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
* Copyright 2017 Fred N. van Kempen
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2017 Fred N. van Kempen
*/
#ifndef PLAT_DYNLD_H
# define PLAT_DYNLD_H
#define PLAT_DYNLD_H
typedef struct {
const char *name;
void *func;
typedef struct dllimp_t {
const char *name;
void *func;
} dllimp_t;
#ifdef __cplusplus
extern "C" {
#endif
extern void *dynld_module(const char *, dllimp_t *);
extern void dynld_close(void *);
extern void *dynld_module(const char *, dllimp_t *);
extern void dynld_close(void *);
#ifdef __cplusplus
}
#endif
#endif /*PLAT_DYNLD_H*/
#endif /*PLAT_DYNLD_H*/

View File

@@ -0,0 +1,36 @@
/*
* 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.
*
* Define the various platform support functions.
*
*
*
* Authors: Jasmine Iwanek, <jasmine@iwanek.co.uk>
*
* Copyright 2023 Jasmine Iwanek
*/
#ifndef EMU_PLAT_FALLTHROUGH_H
#define EMU_PLAT_FALLTHROUGH_H
#ifndef EMU_PLAT_H
#ifdef _MSC_VER
# define fallthrough do {} while (0) /* fallthrough */
#else
# if __has_attribute(fallthrough)
# define fallthrough __attribute__((fallthrough))
# else
# if __has_attribute(__fallthrough__)
# define fallthrough __attribute__((__fallthrough__))
# endif
# define fallthrough do {} while (0) /* fallthrough */
# endif
#endif
#endif
#endif /*EMU_PLAT_FALLTHROUGH_H*/

View File

@@ -0,0 +1,38 @@
/*
* 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 platform specific serial to host passthrough.
*
*
* Authors: Andreas J. Reichel <webmaster@6th-dimension.com>,
* Jasmine Iwanek <jasmine@iwanek.co.uk>
*
* Copyright 2021 Andreas J. Reichel.
* Copyright 2021-2022 Jasmine Iwanek.
*/
#ifndef PLAT_SERIAL_PASSTHROUGH_H
#define PLAT_SERIAL_PASSTHROUGH_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
extern void plat_serpt_write(void *priv, uint8_t data);
extern int plat_serpt_read(void *priv, uint8_t *data);
extern int plat_serpt_open_device(void *priv);
extern void plat_serpt_close(void *priv);
extern void plat_serpt_set_params(void *priv);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,33 @@
/*
* 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.
*
* Define the various platform support functions.
*
*
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2016-2019 Miran Grca.
* Copyright 2017-2019 Fred N. van Kempen.
* Copyright 2021 Laci bá'
*/
#ifndef EMU_PLAT_UNUSED_H
#define EMU_PLAT_UNUSED_H
#ifndef EMU_PLAT_H
#ifdef _MSC_VER
# define UNUSED(arg) arg
#else
/* A hack (GCC-specific?) to allow us to ignore unused parameters. */
# define UNUSED(arg) __attribute__((unused)) arg
#endif
#endif
#endif /*EMU_PLAT_UNUSED_H*/

View File

@@ -1,36 +1,34 @@
/*
* VARCem Virtual ARchaeological Computer EMulator.
* An emulator of (mostly) x86-based PC systems and devices,
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
* spanning the era between 1981 and 1995.
* VARCem Virtual ARchaeological Computer EMulator.
* An emulator of (mostly) x86-based PC systems and devices,
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
* spanning the era between 1981 and 1995.
*
* This file is part of the VARCem Project.
*
* Definitions for the centralized PNG image handler.
* Definitions for the centralized PNG image handler.
*
*
*
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2018 Fred N. van Kempen.
* Copyright 2018 Fred N. van Kempen.
*
* Redistribution and use in source and binary forms, with
* or without modification, are permitted provided that the
* following conditions are met:
* Redistribution and use in source and binary forms, with
* or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the entire
* above notice, this list of conditions and the following
* disclaimer.
* 1. Redistributions of source code must retain the entire
* above notice, this list of conditions and the following
* disclaimer.
*
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names
* of its contributors may be used to endorse or promote
* products derived from this software without specific
* prior written permission.
* 3. Neither the name of the copyright holder nor the names
* of its contributors may be used to endorse or promote
* products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
@@ -44,23 +42,22 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef EMU_PNG_STRUCT_H
# define EMU_PNG_STRUCT_H
#ifndef EMU_PNG_STRUCT_H
#define EMU_PNG_STRUCT_H
#ifdef __cplusplus
extern "C" {
#endif
extern int png_write_gray(char *path, int invert,
uint8_t *pix, int16_t w, int16_t h);
extern int png_write_gray(char *path, int invert,
uint8_t *pix, int16_t w, int16_t h);
extern void png_write_rgb(char *fn,
uint8_t *pix, int16_t w, int16_t h, uint16_t pitch, PALETTE palcol);
extern void png_write_rgb(char *fn,
uint8_t *pix, int16_t w, int16_t h, uint16_t pitch, PALETTE palcol);
#ifdef __cplusplus
}
#endif
#endif /*EMU_PNG_STRUCT_H*/
#endif /*EMU_PNG_STRUCT_H*/

View File

@@ -1,38 +1,36 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Header for the implementation of Port 6x used by various
* machines.
* Header for the implementation of Port 6x used by various
* machines.
*
*
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Authors: Miran Grca, <mgrca8@gmail.com>
*
* Copyright 2021 Miran Grca.
* Copyright 2021 Miran Grca.
*/
#ifndef EMU_PORT_6X_H
# define EMU_PORT_6X_H
#ifndef EMU_PORT_6X_H
#define EMU_PORT_6X_H
#ifdef _TIMER_H_
typedef struct
{
uint8_t refresh, flags;
typedef struct port_6x_t {
uint8_t refresh;
uint8_t flags;
pc_timer_t refresh_timer;
pc_timer_t refresh_timer;
} port_6x_t;
#endif
extern const device_t port_6x_device;
extern const device_t port_6x_xi8088_device;
extern const device_t port_6x_ps2_device;
extern const device_t port_6x_olivetti_device;
extern const device_t port_6x_device;
extern const device_t port_6x_xi8088_device;
extern const device_t port_6x_ps2_device;
extern const device_t port_6x_olivetti_device;
#endif /*EMU_PORT_6X_H*/
#endif /*EMU_PORT_6X_H*/

View File

@@ -1,47 +1,44 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Header for the implementation of Port 92 used by PS/2
* machines and 386+ clones.
* Header for the implementation of Port 92 used by PS/2
* machines and 386+ clones.
*
*
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Authors: Miran Grca, <mgrca8@gmail.com>
*
* Copyright 2019 Miran Grca.
* Copyright 2019 Miran Grca.
*/
#ifndef EMU_PORT_92_H
# define EMU_PORT_92_H
#ifndef EMU_PORT_92_H
#define EMU_PORT_92_H
#ifdef _TIMER_H_
typedef struct
{
uint8_t reg, flags;
typedef struct port_92_t {
uint8_t reg;
uint8_t flags;
pc_timer_t pulse_timer;
pc_timer_t pulse_timer;
uint64_t pulse_period;
uint64_t pulse_period;
} port_92_t;
#endif
extern void port_92_set_period(void *priv, uint64_t pulse_period);
extern void port_92_set_features(void *priv, int reset, int a20);
extern void port_92_set_period(void *priv, uint64_t pulse_period);
extern void port_92_set_features(void *priv, int reset, int a20);
extern void port_92_add(void *priv);
extern void port_92_remove(void *priv);
extern void port_92_add(void *priv);
extern void port_92_remove(void *priv);
extern const device_t port_92_device;
extern const device_t port_92_inv_device;
extern const device_t port_92_word_device;
extern const device_t port_92_pci_device;
extern const device_t port_92_device;
extern const device_t port_92_inv_device;
extern const device_t port_92_word_device;
extern const device_t port_92_pci_device;
#endif /*EMU_PORT_92_H*/
#endif /*EMU_PORT_92_H*/

View File

@@ -1,22 +1,22 @@
/*
* 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.
* 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.
* This file is part of the 86Box distribution.
*
* Implementation of a port 80h POST diagnostic card.
* Implementation of a port 80h POST diagnostic card.
*
*
*
* Author: RichardG, <richardg867@gmail.com>
* Authors: RichardG, <richardg867@gmail.com>
*
* Copyright 2020 RichardG.
* Copyright 2020 RichardG.
*/
#ifndef POSTCARD_H
# define POSTCARD_H
#ifndef POSTCARD_H
#define POSTCARD_H
#ifdef __cplusplus
extern "C" {
@@ -25,12 +25,10 @@ extern "C" {
/* Global variables. */
extern const device_t postcard_device;
/* Functions. */
#ifdef __cplusplus
}
#endif
#endif /*POSTCARD_H*/
#endif /*POSTCARD_H*/

Some files were not shown because too many files have changed in this diff Show More