Merge branch '86Box:master' into machine_23

This commit is contained in:
BurnedPinguin
2023-07-05 15:49:47 +02:00
committed by GitHub
691 changed files with 58230 additions and 27517 deletions

View File

@@ -55,6 +55,14 @@
#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
@@ -89,51 +97,54 @@ extern uint64_t instru_run_ms;
#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,
vid_resize, /* (C) allow resizing */
invert_display, /* (C) invert the display */
suppress_overscan; /* (C) suppress overscans */
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 */
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[2]; /* (C) graphics/video card */
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 */
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 */
voodoo_enabled, /* (C) video option */
ibm8514_enabled, /* (C) video option */
xga_enabled; /* (C) video option */
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_enabled; /* (C) video option */
extern int xga_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 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 */
confirm_exit, /* (C) enable exit confirmation */
confirm_save; /* (C) enable save confirmation */
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 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;
extern int fixed_size_x;
extern int fixed_size_y;
extern double mouse_sensitivity; /* (C) Mouse sensitivity scale */
extern double mouse_x_error, mouse_y_error; /* Mouse error accumulators */
extern double mouse_x_error; /* Mouse error accumulator - Y */
extern double mouse_y_error; /* Mouse error accumulator - Y */
extern int pit_mode; /* (C) force setting PIT mode */
extern int fm_driver; /* (C) select FM sound driver */
@@ -152,8 +163,8 @@ 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 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);
@@ -182,12 +193,13 @@ 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. */
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 int io_delay;
extern int framecountx;
extern volatile int cpu_thread_run;

View File

@@ -59,46 +59,79 @@ extern "C" {
#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,
gpo_val, gpi_val,
extsmi_val, pad0;
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
{
typedef struct acpi_t {
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, pwrbtn_timer;
nvr_t *nvr;
apm_t *apm;
void *i2c,
(*trap_update)(void *priv), *trap_priv;
uint8_t gpireg2_default;
uint8_t pad[3];
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. */

View File

@@ -20,7 +20,10 @@
typedef struct agpgart_s {
int aperture_enable;
uint32_t aperture_base, aperture_size, aperture_mask, gart_base;
uint32_t aperture_base;
uint32_t aperture_size;
uint32_t aperture_mask;
uint32_t gart_base;
mem_mapping_t aperture_mapping;
} agpgart_t;

View File

@@ -21,10 +21,10 @@
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. */

View File

@@ -24,7 +24,7 @@
#include <stdio.h>
typedef struct {
typedef struct pc_cassette_t {
char save;
char pcm;
@@ -157,9 +157,11 @@ extern pc_cassette_t *cassette;
extern char cassette_fname[512];
extern char cassette_mode[512];
extern unsigned long cassette_pos, cassette_srate;
extern unsigned long cassette_pos;
extern unsigned long cassette_srate;
extern int cassette_enable;
extern int cassette_append, cassette_pcm;
extern int cassette_append;
extern int cassette_pcm;
extern int cassette_ui_writeprot;
extern const device_t cassette_device;

View File

@@ -55,9 +55,9 @@ extern "C" {
enum {
CDROM_BUS_DISABLED = 0,
CDROM_BUS_ATAPI = 5,
CDROM_BUS_SCSI,
CDROM_BUS_MITSUMI,
CDROM_BUS_USB
CDROM_BUS_SCSI = 6,
CDROM_BUS_MITSUMI = 7,
CDROM_BUS_USB = 8
};
#define KNOWN_CDROM_DRIVE_TYPES 35
@@ -65,71 +65,77 @@ enum {
#define BUS_TYPE_IDE 1
#define BUS_TYPE_SCSI 2
static const struct
{
const char vendor[9];
const char model[17];
const char revision[5];
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", "(ATAPI/SCSI) 86BOX CD-ROM 1.00", "86BOX_CD-ROM_1.00", BUS_TYPE_ALL}, /*1*/
{ "AZT", "CDA46802I", "1.15", "(ATAPI) AZT CDA46802I 1.15", "AZT_CDA46802I_1.15", BUS_TYPE_IDE}, /*2*/
{ "BTC", "CD-ROM BCD36XH", "U1.0", "(ATAPI) BTC CD-ROM BCD36XH U1.0", "BTC_CD-ROM_BCD36XH_U1.0", BUS_TYPE_IDE}, /*3*/
{ "GOLDSTAR", "CRD-8160B", "3.14", "(ATAPI) GOLDSTAR CRD-8160B 3.14", "GOLDSTAR_CRD-8160B_3.14", BUS_TYPE_IDE}, /*4*/
{ "HITACHI", "CDR-8130", "0020", "(ATAPI) HITACHI CDR-8130 0020", "HITACHI_CDR-8130_0020", BUS_TYPE_IDE}, /*5*/
{ "KENWOOD", "CD-ROM UCR-421", "208E", "(ATAPI) KENWOOD CD-ROM UCR-421 208E", "KENWOOD_CD-ROM_UCR-421_208E", BUS_TYPE_IDE}, /*6*/
{ "MATSHITA", "CD-ROM CR-587", "7S13", "(ATAPI) MATSHITA CD-ROM CR-587 7S13", "MATSHITA_CD-ROM_CR-587_7S13", BUS_TYPE_IDE}, /*7*/
{ "MATSHITA", "CD-ROM CR-588", "LS15", "(ATAPI) MATSHITA CD-ROM CR-588 LS15", "MATSHITA_CD-ROM_CR-588_LS15", BUS_TYPE_IDE}, /*8*/
{ "MATSHITA", "CR-571", "1.0e", "(ATAPI) MATSHITA CR-571 1.0e", "MATSHITA_CR-571_1.0e", BUS_TYPE_IDE}, /*9*/
{ "MATSHITA", "CR-572", "1.0j", "(ATAPI) MATSHITA CR-572 1.0j", "MATSHITA_CR-572_1.0j", BUS_TYPE_IDE}, /*10*/
{ "MITSUMI", "CRMC-FX4820T", "D02A", "(ATAPI) MITSUMI CRMC-FX4820T D02A", "MITSUMI_CRMC-FX4820T_D02A", BUS_TYPE_IDE}, /*11*/
{ "NEC", "CD-ROM DRIVE:260", "1.00", "(ATAPI) NEC CD-ROM DRIVE:260 1.00", "NEC_CD-ROM_DRIVE260_1.00", BUS_TYPE_IDE}, /*12*/
{ "NEC", "CD-ROM DRIVE:260", "1.01", "(ATAPI) NEC CD-ROM DRIVE:260 1.01", "NEC_CD-ROM_DRIVE260_1.01", BUS_TYPE_IDE}, /*13*/
{ "NEC", "CD-ROM DRIVE:273", "4.20", "(ATAPI) NEC CD-ROM DRIVE:273 4.20", "NEC_CD-ROM_DRIVE273_4.20", BUS_TYPE_IDE}, /*14*/
{ "NEC", "CD-ROM DRIVE:280", "1.05", "(ATAPI) NEC CD-ROM DRIVE:280 1.05", "NEC_CD-ROM_DRIVE280_1.05", BUS_TYPE_IDE}, /*15*/
{ "NEC", "CD-ROM DRIVE:280", "3.08", "(ATAPI) NEC CD-ROM DRIVE:280 3.08", "NEC_CD-ROM_DRIVE280_3.08", BUS_TYPE_IDE}, /*16*/
{ "PHILIPS", "CD-ROM PCA403CD", "U31P", "(ATAPI) PHILIPS CD-ROM PCA403CD U31P", "PHILIPS_CD-ROM_PCA403CD_U31P", BUS_TYPE_IDE}, /*17*/
{ "SONY", "CD-ROM CDU76", "1.0i", "(ATAPI) SONY CD-ROM CDU76 1.0i", "SONY_CD-ROM_CDU76_1.0i", BUS_TYPE_IDE}, /*18*/
{ "SONY", "CD-ROM CDU311", "3.0h", "(ATAPI) SONY CD-ROM CDU311 3.0h", "SONY_CD-ROM_CDU311_3.0h", BUS_TYPE_IDE}, /*19*/
{ "TOSHIBA", "CD-ROM XM-5302TA", "0305", "(ATAPI) TOSHIBA CD-ROM XM-5302TA 0305", "TOSHIBA_CD-ROM_XM-5302TA_0305", BUS_TYPE_IDE}, /*20*/
{ "TOSHIBA", "CD-ROM XM-5702B", "TA70", "(ATAPI) TOSHIBA CD-ROM XM-5702B TA70", "TOSHIBA_CD-ROM_XM-5702B_TA70", BUS_TYPE_IDE}, /*21*/
{ "CHINON", "CD-ROM CDS-431", "H42 ", "(SCSI) CHINON CD-ROM CDS-431 H42", "CHINON_CD-ROM_CDS-431_H42", BUS_TYPE_SCSI}, /*22*/
{ "DEC", "RRD45 (C) DEC", "0436", "(SCSI) DEC RRD45 0436", "DEC_RRD45_0436", BUS_TYPE_SCSI}, /*23*/
{ "MATSHITA", "CD-ROM CR-501", "1.0b", "(SCSI) MATSHITA CD-ROM CR-501 1.0b", "MATSHITA_CD-ROM_CR-501_1.0b", BUS_TYPE_SCSI}, /*24*/
{ "NEC", "CD-ROM DRIVE:74", "1.00", "(SCSI) NEC CD-ROM DRIVE:74 1.00", "NEC_CD-ROM_DRIVE74_1.00", BUS_TYPE_SCSI}, /*25*/
{ "NEC", "CD-ROM DRIVE:464", "1.05", "(SCSI) NEC CD-ROM DRIVE:464 1.05", "NEC_CD-ROM_DRIVE464_1.05", BUS_TYPE_SCSI}, /*26*/
{ "SONY", "CD-ROM CDU-541", "1.0i", "(SCSI) SONY CD-ROM CDU-541 1.0i", "SONY_CD-ROM_CDU-541_1.0i", BUS_TYPE_SCSI}, /*27*/
{ "SONY", "CD-ROM CDU-76S", "1.00", "(SCSI) SONY CD-ROM CDU-76S 1.00", "SONY_CD-ROM_CDU-76S_1.00", BUS_TYPE_SCSI}, /*28*/
{ "PHILIPS", "CDD2600", "1.07", "(SCSI) PHILIPS CDD2600 1.07", "PHILIPS_CDD2600_1.07", BUS_TYPE_SCSI}, /*29*/
{ "PIONEER", "CD-ROM DRM-604X", "2403", "(SCSI) PIONEER CD-ROM DRM-604X 2403", "PIONEER_CD-ROM_DRM-604X_2403", BUS_TYPE_SCSI}, /*30*/
{ "PLEXTOR", "CD-ROM PX-32TS", "1.03", "(SCSI) PLEXTOR CD-ROM PX-32TS 1.03", "PLEXTOR_CD-ROM_PX-32TS_1.03", BUS_TYPE_SCSI}, /*31*/
{ "TEAC", "CD-R55S", "1.0R", "(SCSI) TEAC CD-R55S 1.0R", "TEAC_CD-R55S_1.0R", BUS_TYPE_SCSI}, /*32*/
{ "TOSHIBA", "CD-ROM DRIVE:XM", "3433", "(SCSI) TOSHIBA CD-ROM DRIVE:XM 3433", "TOSHIBA_CD-ROM_DRIVEXM_3433", BUS_TYPE_SCSI}, /*33*/
{ "TOSHIBA", "CD-ROM XM-3301TA", "0272", "(SCSI) TOSHIBA CD-ROM XM-3301TA 0272", "TOSHIBA_CD-ROM_XM-3301TA_0272", BUS_TYPE_SCSI}, /*34*/
{ "TOSHIBA", "CD-ROM XM-5701TA", "3136", "(SCSI) TOSHIBA CD-ROM XM-5701TA 3136", "TOSHIBA_CD-ROM_XM-5701TA_3136", BUS_TYPE_SCSI}, /*35*/
{ "", "", "", "", "", -1},
const int bus_type;
} cdrom_drive_types[] = {
{ "86BOX", "CD-ROM", "1.00", "(ATAPI/SCSI) 86BOX CD-ROM 1.00", "86BOX_CD-ROM_1.00", BUS_TYPE_ALL }, /*1*/
{ "AZT", "CDA46802I", "1.15", "(ATAPI) AZT CDA46802I 1.15", "AZT_CDA46802I_1.15", BUS_TYPE_IDE }, /*2*/
{ "BTC", "CD-ROM BCD36XH", "U1.0", "(ATAPI) BTC CD-ROM BCD36XH U1.0", "BTC_CD-ROM_BCD36XH_U1.0", BUS_TYPE_IDE }, /*3*/
{ "GOLDSTAR", "CRD-8160B", "3.14", "(ATAPI) GOLDSTAR CRD-8160B 3.14", "GOLDSTAR_CRD-8160B_3.14", BUS_TYPE_IDE }, /*4*/
{ "HITACHI", "CDR-8130", "0020", "(ATAPI) HITACHI CDR-8130 0020", "HITACHI_CDR-8130_0020", BUS_TYPE_IDE }, /*5*/
{ "KENWOOD", "CD-ROM UCR-421", "208E", "(ATAPI) KENWOOD CD-ROM UCR-421 208E", "KENWOOD_CD-ROM_UCR-421_208E", BUS_TYPE_IDE }, /*6*/
{ "MATSHITA", "CD-ROM CR-587", "7S13", "(ATAPI) MATSHITA CD-ROM CR-587 7S13", "MATSHITA_CD-ROM_CR-587_7S13", BUS_TYPE_IDE }, /*7*/
{ "MATSHITA", "CD-ROM CR-588", "LS15", "(ATAPI) MATSHITA CD-ROM CR-588 LS15", "MATSHITA_CD-ROM_CR-588_LS15", BUS_TYPE_IDE }, /*8*/
{ "MATSHITA", "CR-571", "1.0e", "(ATAPI) MATSHITA CR-571 1.0e", "MATSHITA_CR-571_1.0e", BUS_TYPE_IDE }, /*9*/
{ "MATSHITA", "CR-572", "1.0j", "(ATAPI) MATSHITA CR-572 1.0j", "MATSHITA_CR-572_1.0j", BUS_TYPE_IDE }, /*10*/
{ "MITSUMI", "CRMC-FX4820T", "D02A", "(ATAPI) MITSUMI CRMC-FX4820T D02A", "MITSUMI_CRMC-FX4820T_D02A", BUS_TYPE_IDE }, /*11*/
{ "NEC", "CD-ROM DRIVE:260", "1.00", "(ATAPI) NEC CD-ROM DRIVE:260 1.00", "NEC_CD-ROM_DRIVE260_1.00", BUS_TYPE_IDE }, /*12*/
{ "NEC", "CD-ROM DRIVE:260", "1.01", "(ATAPI) NEC CD-ROM DRIVE:260 1.01", "NEC_CD-ROM_DRIVE260_1.01", BUS_TYPE_IDE }, /*13*/
{ "NEC", "CD-ROM DRIVE:273", "4.20", "(ATAPI) NEC CD-ROM DRIVE:273 4.20", "NEC_CD-ROM_DRIVE273_4.20", BUS_TYPE_IDE }, /*14*/
{ "NEC", "CD-ROM DRIVE:280", "1.05", "(ATAPI) NEC CD-ROM DRIVE:280 1.05", "NEC_CD-ROM_DRIVE280_1.05", BUS_TYPE_IDE }, /*15*/
{ "NEC", "CD-ROM DRIVE:280", "3.08", "(ATAPI) NEC CD-ROM DRIVE:280 3.08", "NEC_CD-ROM_DRIVE280_3.08", BUS_TYPE_IDE }, /*16*/
{ "PHILIPS", "CD-ROM PCA403CD", "U31P", "(ATAPI) PHILIPS CD-ROM PCA403CD U31P", "PHILIPS_CD-ROM_PCA403CD_U31P", BUS_TYPE_IDE }, /*17*/
{ "SONY", "CD-ROM CDU76", "1.0i", "(ATAPI) SONY CD-ROM CDU76 1.0i", "SONY_CD-ROM_CDU76_1.0i", BUS_TYPE_IDE }, /*18*/
{ "SONY", "CD-ROM CDU311", "3.0h", "(ATAPI) SONY CD-ROM CDU311 3.0h", "SONY_CD-ROM_CDU311_3.0h", BUS_TYPE_IDE }, /*19*/
{ "TOSHIBA", "CD-ROM XM-5302TA", "0305", "(ATAPI) TOSHIBA CD-ROM XM-5302TA 0305", "TOSHIBA_CD-ROM_XM-5302TA_0305", BUS_TYPE_IDE }, /*20*/
{ "TOSHIBA", "CD-ROM XM-5702B", "TA70", "(ATAPI) TOSHIBA CD-ROM XM-5702B TA70", "TOSHIBA_CD-ROM_XM-5702B_TA70", BUS_TYPE_IDE }, /*21*/
{ "CHINON", "CD-ROM CDS-431", "H42 ", "(SCSI) CHINON CD-ROM CDS-431 H42", "CHINON_CD-ROM_CDS-431_H42", BUS_TYPE_SCSI }, /*22*/
{ "DEC", "RRD45 (C) DEC", "0436", "(SCSI) DEC RRD45 0436", "DEC_RRD45_0436", BUS_TYPE_SCSI }, /*23*/
{ "MATSHITA", "CD-ROM CR-501", "1.0b", "(SCSI) MATSHITA CD-ROM CR-501 1.0b", "MATSHITA_CD-ROM_CR-501_1.0b", BUS_TYPE_SCSI }, /*24*/
{ "NEC", "CD-ROM DRIVE:74", "1.00", "(SCSI) NEC CD-ROM DRIVE:74 1.00", "NEC_CD-ROM_DRIVE74_1.00", BUS_TYPE_SCSI }, /*25*/
{ "NEC", "CD-ROM DRIVE:464", "1.05", "(SCSI) NEC CD-ROM DRIVE:464 1.05", "NEC_CD-ROM_DRIVE464_1.05", BUS_TYPE_SCSI }, /*26*/
{ "SONY", "CD-ROM CDU-541", "1.0i", "(SCSI) SONY CD-ROM CDU-541 1.0i", "SONY_CD-ROM_CDU-541_1.0i", BUS_TYPE_SCSI }, /*27*/
{ "SONY", "CD-ROM CDU-76S", "1.00", "(SCSI) SONY CD-ROM CDU-76S 1.00", "SONY_CD-ROM_CDU-76S_1.00", BUS_TYPE_SCSI }, /*28*/
{ "PHILIPS", "CDD2600", "1.07", "(SCSI) PHILIPS CDD2600 1.07", "PHILIPS_CDD2600_1.07", BUS_TYPE_SCSI }, /*29*/
{ "PIONEER", "CD-ROM DRM-604X", "2403", "(SCSI) PIONEER CD-ROM DRM-604X 2403", "PIONEER_CD-ROM_DRM-604X_2403", BUS_TYPE_SCSI }, /*30*/
{ "PLEXTOR", "CD-ROM PX-32TS", "1.03", "(SCSI) PLEXTOR CD-ROM PX-32TS 1.03", "PLEXTOR_CD-ROM_PX-32TS_1.03", BUS_TYPE_SCSI }, /*31*/
{ "TEAC", "CD-R55S", "1.0R", "(SCSI) TEAC CD-R55S 1.0R", "TEAC_CD-R55S_1.0R", BUS_TYPE_SCSI }, /*32*/
{ "TOSHIBA", "CD-ROM DRIVE:XM", "3433", "(SCSI) TOSHIBA CD-ROM DRIVE:XM 3433", "TOSHIBA_CD-ROM_DRIVEXM_3433", BUS_TYPE_SCSI }, /*33*/
{ "TOSHIBA", "CD-ROM XM-3301TA", "0272", "(SCSI) TOSHIBA CD-ROM XM-3301TA 0272", "TOSHIBA_CD-ROM_XM-3301TA_0272", BUS_TYPE_SCSI }, /*34*/
{ "TOSHIBA", "CD-ROM XM-5701TA", "3136", "(SCSI) TOSHIBA CD-ROM XM-5701TA 3136", "TOSHIBA_CD-ROM_XM-5701TA_3136", BUS_TYPE_SCSI }, /*35*/
{ "", "", "", "", "", -1 },
};
/* 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 {
typedef struct track_info_t {
int number;
uint8_t attr, m, s, f;
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 {
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);
@@ -144,32 +150,40 @@ 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;
int is_dir;
void *priv;
char image_path[1024],
prev_image_path[1024];
char image_path[1024];
char prev_image_path[1024];
char *image_history[CD_IMAGE_HISTORY];
uint32_t sound_on, cdrom_capacity,
early, seek_pos,
seek_diff, cd_end, type;
uint32_t sound_on;
uint32_t cdrom_capacity;
uint32_t seek_pos;
uint32_t seek_diff;
uint32_t cd_end;
uint32_t type;
int host_drive, prev_host_drive,
cd_buflen, audio_op;
int host_drive;
int prev_host_drive;
int cd_buflen;
int audio_op;
const cdrom_ops_t *ops;

View File

@@ -56,10 +56,17 @@ typedef struct {
} track_file_t;
typedef struct {
int number, track_number, attr, sector_size,
mode2, form, pre, pad;
uint64_t start, length,
skip;
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;

View File

@@ -27,110 +27,110 @@ 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 */
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)) */
uint16_t language_id; /* Language ID (0x0409 = English (US)) */
# endif
/* Machine cateogory */
int machine, /* Machine */
cpu, /* CPU */
int machine; /* Machine */
int cpu; /* CPU */
# ifdef USE_DYNAREC
cpu_use_dynarec, /* CPU recompiler enabled */
int 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 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[PARALLEL_MAX][32]; /* LPT device names */
# ifdef USE_SERIAL_DEVICES
char serial_devices[SERIAL_MAX][32]; /* Serial device names */
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

View File

@@ -21,14 +21,13 @@
extern "C" {
#endif
typedef struct
{
typedef struct ddma_channel_t {
uint16_t io_base;
int channel, enable;
int channel;
int enable;
} ddma_channel_t;
typedef struct
{
typedef struct ddma_t {
ddma_channel_t channels[8];
} ddma_t;

View File

@@ -17,6 +17,8 @@
* 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
@@ -52,21 +54,27 @@
#define CONFIG_MAC 9
#define CONFIG_MIDI_IN 10
#define CONFIG_BIOS 11
#define CONFIG_SERPORT 12
enum {
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_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_KBC = 0x4000, /* is a keyboard controller */
DEVICE_EXTPARAMS = 0x40000000, /* accepts extended parameters */
DEVICE_ALL = 0xffffffff /* match all devices */
};
#define BIOS_NORMAL 0
@@ -78,28 +86,30 @@ enum {
#define BIOS_INTERLEAVED_INVERT 8
#define BIOS_HIGH_BIT_INVERT 16
typedef struct {
typedef struct device_config_selection_t {
const char *description;
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, size;
void *dev1, *dev2;
uint32_t local;
uint32_t size;
void *dev1;
void *dev2;
const char *files[9];
} device_config_bios_t;
typedef struct {
typedef struct device_config_spinner_t {
int16_t min;
int16_t max;
int16_t step;
} device_config_spinner_t;
typedef struct {
typedef struct device_config_t {
const char *name;
const char *description;
int type;
@@ -107,7 +117,7 @@ typedef struct {
int default_int;
const char *file_filter;
const device_config_spinner_t spinner;
const device_config_selection_t selection[16];
const device_config_selection_t selection[32];
const device_config_bios_t bios[32];
} device_config_t;
@@ -115,14 +125,17 @@ typedef struct _device_ {
const char *name;
const char *internal_name;
uint32_t flags; /* system flags */
uint32_t local; /* flags local to device */
uintptr_t local; /* flags local to device */
void *(*init)(const struct _device_ *);
union {
void *(*init)(const struct _device_ *);
void *(*init_ext)(const struct _device_ *, void*);
};
void (*close)(void *priv);
void (*reset)(void *priv);
union {
int (*available)(void);
int (*poll)(int x, int y, int z, int b, void *priv);
int (*poll)(int x, int y, int z, int b, double abs_x, double abs_y, void *priv);
void (*register_pci_slot)(int device, int type, int inta, int intb, int intc, int intd, void *priv);
};
void (*speed_changed)(void *priv);
@@ -131,9 +144,10 @@ typedef struct _device_ {
const device_config_t *config;
} device_t;
typedef struct {
typedef struct device_context_t {
const device_t *dev;
char name[2048];
int instance;
} device_context_t;
#ifdef __cplusplus
@@ -146,16 +160,23 @@ 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_parameters(const device_t *d, void *params);
extern void device_add_ex(const device_t *d, void *priv);
extern void device_add_ex_parameters(const device_t *d, void *priv, void *params);
extern void *device_add_inst(const device_t *d, int inst);
extern void *device_add_inst_parameters(const device_t *d, int inst, void *params);
extern void device_add_inst_ex(const device_t *d, void *priv, int inst);
extern void device_add_inst_ex_parameters(const device_t *d, void *priv, int inst, void *params);
extern void *device_cadd(const device_t *d, const device_t *cd);
extern void *device_cadd_parameters(const device_t *d, const device_t *cd, void *params);
extern void device_cadd_ex(const device_t *d, const device_t *cd, void *priv);
extern void device_cadd_ex_parameters(const device_t *d, const device_t *cd, void *priv, void *params);
extern void *device_cadd_inst(const device_t *d, const device_t *cd, int inst);
extern void *device_cadd_inst_parameters(const device_t *d, const device_t *cd, int inst, void *params);
extern void device_cadd_inst_ex(const device_t *d, const device_t *cd, void *priv, int inst);
extern void device_cadd_inst_ex_parameters(const device_t *d, const device_t *cd, void *priv, int inst, void *params);
extern void device_close_all(void);
extern void device_reset_all(void);
extern void device_reset_all_pci(void);
extern void device_reset_all(uint32_t match_flags);
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);
@@ -178,6 +199,7 @@ 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);

View File

@@ -22,7 +22,7 @@
extern "C" {
#endif
typedef struct {
typedef struct disk_size_t {
int hole;
int sides;
int data_rate;
@@ -40,10 +40,12 @@ typedef struct {
static const disk_size_t disk_sizes[14] = {
// clang-format off
// { 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" */
#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 */
@@ -58,8 +60,10 @@ static const disk_size_t disk_sizes[14] = {
{ 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 */
// { 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 */
#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
};

View File

@@ -43,22 +43,37 @@
#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];

View File

@@ -56,42 +56,79 @@ extern int fdc_type;
#define FDC_FLAG_TER 0x2000 /* Is Tertiary */
#define FDC_FLAG_QUA 0x3000 /* Is Quaternary */
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];
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, pretrk;
uint8_t config;
uint8_t pretrk;
uint8_t fifobuf[16];
uint16_t base_address;
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 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 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 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 gap;
int enable_3f1, format_sectors;
int max_track, mfm;
int deleted, wrong_am;
int sc, satisfying_sectors;
int fintr, rw_drive;
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 flags, interrupt;
int flags;
int interrupt;
int irq; /* Should be 6 by default. */
int dma_ch; /* Should be 2 by default. */
@@ -99,11 +136,13 @@ typedef struct {
int bit_rate; /* Should be 250 at start. */
int paramstogo;
sector_id_t read_track_sector, format_sector_id;
sector_id_t read_track_sector;
sector_id_t format_sector_id;
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);

View File

@@ -65,7 +65,7 @@ extern int fdd_get_from_internal_name(char *s);
extern int fdd_current_track(int drive);
typedef struct {
typedef struct DRIVE {
int id;
void (*seek)(int drive, int track);
@@ -120,7 +120,8 @@ extern int disable_write;
extern int defaultwriteprot;
extern int writeprot[FDD_NUM], fwriteprot[FDD_NUM];
extern int writeprot[FDD_NUM];
extern int fwriteprot[FDD_NUM];
extern int fdd_changed[FDD_NUM];
extern int drive_empty[FDD_NUM];

View File

@@ -1,7 +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;

View File

@@ -34,7 +34,7 @@
#define GAMEPORT_SIO 0x1000000
typedef struct {
typedef struct plat_joystick_t {
char name[260];
int a[8];
@@ -57,8 +57,7 @@ typedef struct {
int id;
} pov[4];
struct
{
struct {
char name[260];
int id;
} slider[2];
@@ -69,7 +68,7 @@ typedef struct {
int nr_sliders;
} plat_joystick_t;
typedef struct {
typedef struct joystick_t {
int axis[8];
int button[32];
int pov[4];
@@ -80,20 +79,20 @@ typedef struct {
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);
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 (*write)(void *p);
int (*read_axis)(void *p, int axis);
void (*a0_over)(void *p);
int axis_count,
button_count,
pov_count;
int axis_count;
int button_count;
int pov_count;
int max_joysticks;
const char *axis_names[8];
const char *button_names[32];

View File

@@ -24,14 +24,14 @@
#define GDBSTUB_MEM_AWATCH 32
enum {
GDBSTUB_EXEC = 0,
GDBSTUB_SSTEP,
GDBSTUB_BREAK,
GDBSTUB_BREAK_SW,
GDBSTUB_BREAK_HW,
GDBSTUB_BREAK_RWATCH,
GDBSTUB_BREAK_WWATCH,
GDBSTUB_BREAK_AWATCH
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

View File

@@ -43,23 +43,37 @@ enum {
#ifdef SCSI_DEVICE_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,
reset, mdma_mode,
do_initial_read;
uint32_t secount, sector,
cylinder, head,
drive, cylprecomp,
cfg_spt, cfg_hpc,
lba_addr, tracks,
spt, hpc;
uint8_t selected;
uint8_t atastat;
uint8_t error;
uint8_t command;
uint8_t fdisk;
int type;
int board;
int irqstat;
int service;
int blocksize;
int blockcount;
int hdd_num;
int channel;
int pos;
int sector_pos;
int lba;
int reset;
int mdma_mode;
int do_initial_read;
uint32_t secount;
uint32_t sector;
uint32_t cylinder;
uint32_t head;
uint32_t drive;
uint32_t cylprecomp;
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;
@@ -96,10 +110,10 @@ extern ide_t *ide_drives[IDE_NUM];
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:
@@ -108,12 +122,13 @@ enum {
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);

View File

@@ -20,19 +20,27 @@
#ifndef EMU_HDC_IDE_SFF8038I_H
#define EMU_HDC_IDE_SFF8038I_H
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;
typedef struct sff8038i_t {
uint8_t command;
uint8_t status;
uint8_t ptr0;
uint8_t enabled;
uint8_t dma_mode;
uint8_t pad;
uint8_t pad0;
uint8_t pad1;
uint16_t base;
uint16_t pad2;
uint32_t ptr;
uint32_t ptr_cur;
uint32_t addr;
int count;
int eot;
int slot;
int irq_mode[2];
int irq_level[2];
int irq_pin;
int irq_line;
} sff8038i_t;
extern const device_t sff8038i_device;

View File

@@ -34,60 +34,60 @@
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,
HDD_OP_WRITE
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 {
typedef struct hdd_preset_t {
const char *name;
const char *internal_name;
uint32_t zones;
@@ -101,7 +101,7 @@ typedef struct {
double track_seek_ms;
} hdd_preset_t;
typedef struct {
typedef struct hdd_cache_seg_t {
uint32_t id;
uint32_t lba_addr;
uint32_t ra_addr;
@@ -110,7 +110,7 @@ typedef struct {
uint8_t valid;
} hdd_cache_seg_t;
typedef struct {
typedef struct hdd_cache_t {
// Read cache
hdd_cache_seg_t segments[HDD_MAX_CACHE_SEG];
uint32_t num_segments;
@@ -126,7 +126,7 @@ typedef struct {
uint64_t write_start_time;
} hdd_cache_t;
typedef struct {
typedef struct hdd_zone_t {
uint32_t cylinders;
uint32_t sectors_per_track;
double sector_time_usec;
@@ -136,7 +136,7 @@ typedef struct {
} hdd_zone_t;
/* Define the virtual Hard Disk. */
typedef struct {
typedef struct hard_disk_t {
uint8_t id;
union {
uint8_t channel; /* Needed for Settings to reduce the number of if's */
@@ -147,21 +147,23 @@ typedef struct {
uint8_t ide_channel;
uint8_t scsi_id;
};
uint8_t bus,
res; /* Reserved for bus mode */
uint8_t bus;
uint8_t res; /* Reserved for bus mode */
uint8_t wp; /* Disk has been mounted READ-ONLY */
uint8_t pad, pad0;
uint8_t pad;
uint8_t pad0;
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;
@@ -176,6 +178,7 @@ typedef struct {
uint32_t cur_addr;
uint32_t speed_preset;
uint32_t vhd_blocksize;
double avg_rotation_lat_usec;
double full_stroke_usec;

View File

@@ -20,20 +20,21 @@
#define RESISTOR_DIVIDER(v, r1, r2) (((v) * (r2)) / ((r1) + (r2)))
typedef struct {
typedef struct hwm_values_t {
uint16_t fans[4];
uint8_t temperatures[4];
uint16_t voltages[13];
} hwm_values_t;
typedef struct {
typedef struct lm75_t {
uint32_t local;
hwm_values_t *values;
void *as99127f;
uint8_t regs[8];
uint8_t addr_register;
uint8_t i2c_addr : 7, i2c_state : 2;
uint8_t i2c_addr : 7;
uint8_t i2c_state : 2;
uint8_t i2c_enabled : 1;
} lm75_t;

View File

@@ -21,31 +21,38 @@ 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, flags;
uint8_t a;
uint8_t flags;
};
};
union {
uint16_t bc;
struct {
uint8_t b, c;
uint8_t b;
uint8_t c;
};
};
union {
uint16_t de;
struct {
uint8_t d, e;
uint8_t d;
uint8_t e;
};
};
union {
uint16_t hl;
struct {
uint8_t h, l;
uint8_t h;
uint8_t l;
};
};
uint16_t pc, sp;
uint16_t oldpc, ei;
uint32_t pmembase, dmembase; /* Base from where i8080 starts. */
uint8_t emulated; /* 0 = not emulated, use separate registers, 1 = emulated, use x86 registers. */
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);

View File

@@ -30,26 +30,26 @@ typedef void *ini_t;
typedef void *ini_section_t;
extern ini_t ini_new(void);
extern ini_t ini_read(char *fn);
extern void ini_write(ini_t ini, char *fn);
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, char *name);
extern int ini_section_get_int(ini_section_t section, char *name, int def);
extern double ini_section_get_double(ini_section_t section, char *name, double def);
extern int ini_section_get_hex16(ini_section_t section, char *name, int def);
extern int ini_section_get_hex20(ini_section_t section, char *name, int def);
extern int ini_section_get_mac(ini_section_t section, char *name, int def);
extern char *ini_section_get_string(ini_section_t section, char *name, char *def);
extern wchar_t *ini_section_get_wstring(ini_section_t section, char *name, wchar_t *def);
extern void ini_section_set_int(ini_section_t section, char *name, int val);
extern void ini_section_set_double(ini_section_t section, char *name, double val);
extern void ini_section_set_hex16(ini_section_t section, char *name, int val);
extern void ini_section_set_hex20(ini_section_t section, char *name, int val);
extern void ini_section_set_mac(ini_section_t section, char *name, int val);
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 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_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, char *name, wchar_t *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)
@@ -69,13 +69,13 @@ extern void ini_section_set_wstring(ini_section_t section, char *name, wchar
#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, char *name);
extern ini_section_t ini_find_or_create_section(ini_t ini, char *name);
extern void ini_rename_section(ini_section_t section, char *name);
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
#endif

View File

@@ -25,27 +25,31 @@
#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_NO_KEY /* cheat code for Crystal CS423x */
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 {
typedef struct isapnp_device_config_t {
uint8_t activate;
struct {
uint32_t base : 24, size : 24;
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 {
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 {
struct pnp_dma_t {
uint8_t dma : 3;
} dma[2];
} isapnp_device_config_t;

View File

@@ -22,7 +22,73 @@
#ifndef EMU_KEYBOARD_H
#define EMU_KEYBOARD_H
typedef struct {
enum {
DEV_KBD = 0,
DEV_AUX = 1
};
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;
@@ -138,9 +204,14 @@ 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_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;
@@ -152,13 +223,14 @@ 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
# 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_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_samsung_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;
@@ -167,8 +239,9 @@ 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_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;
@@ -176,7 +249,10 @@ 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;
#endif
extern const device_t keyboard_ps2_tg_ami_pci_device;
extern const device_t keyboard_at_generic_device;
#endif /*EMU_DEVICE_H*/
extern void keyboard_init(void);
extern void keyboard_close(void);
@@ -190,22 +266,17 @@ 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_down(void);
extern int keyboard_isfsexit(void);
extern int keyboard_isfsexit_down(void);
extern int keyboard_ismsexit(void);
extern void keyboard_set_is_amstrad(int ams);
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 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
}

View File

@@ -69,7 +69,7 @@
#define IDS_2089 2089 // "KB"
#define IDS_KB IDS_2089 // "KB"
#define IDS_2090 2090 // "Could not initialize the video..."
#define IDS_2090 2090 // "Could not initialize the video..."
#define IDS_2091 2091 // "Default"
#define IDS_DEFAULT IDS_2091 // "Default"
@@ -81,78 +81,78 @@
#define IDS_TYPE IDS_2093 // "Type"
/* 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_2111 2111 // "Unable to initialize Free.."
#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_2132 2132 // LIB_NAME_FREETYPE " is required..."
#define IDS_2133 2133 // LIB_NAME_GS " is required for...
#define IDS_2134 2134 // LIB_NAME_FLUIDSYNTH " is required..."
#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"
#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_2111 2111 // "Unable to initialize Free.."
#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_2132 2132 // LIB_NAME_FREETYPE " is required..."
#define IDS_2133 2133 // LIB_NAME_GS " is required for...
#define IDS_2134 2134 // LIB_NAME_FLUIDSYNTH " is required..."
#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
@@ -162,115 +162,118 @@
#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_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_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_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_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_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_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_5120 5120 // "CD-ROM %i (%s): %s"
#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"
#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_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_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_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_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_7168 7168 // "(System Default)"
#define IDS_LANG_ENUS IDS_7168
#define STR_NUM_2048 118
#define STR_NUM_2048 121
// UNUSED: #define STR_NUM_3072 11
#define STR_NUM_4096 40
#define STR_NUM_4352 6

View File

@@ -10,15 +10,14 @@
#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
{
typedef struct lpt_device_t {
const char *name;
const char *internal_name;
@@ -53,7 +52,7 @@ extern void lpt1_remove_ams(void);
#define lpt4_irq(a) lpt_port_irq(3, a)
#define lpt4_remove() lpt_port_remove(3)
/*
#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)
@@ -61,16 +60,20 @@ extern void lpt1_remove_ams(void);
#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;
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;

View File

@@ -26,18 +26,22 @@
#define MACHINE_BUS_NONE 0x00000000 /* sys has no bus */
/* Feature flags for BUS'es. */
#define MACHINE_BUS_ISA 0x00000001 /* sys has ISA bus */
#define MACHINE_BUS_CARTRIDGE 0x00000002 /* sys has two cartridge bays */
#define MACHINE_BUS_ISA16 0x00000004 /* sys has ISA16 bus - PC/AT architecture */
#define MACHINE_BUS_CBUS 0x00000008 /* sys has C-BUS bus */
#define MACHINE_BUS_PS2 0x00000010 /* system has PS/2 keyboard and mouse ports */
#define MACHINE_BUS_EISA 0x00000020 /* sys has EISA bus */
#define MACHINE_BUS_VLB 0x00000040 /* sys has VL bus */
#define MACHINE_BUS_MCA 0x00000080 /* sys has MCA bus */
#define MACHINE_BUS_PCI 0x00000100 /* sys has PCI bus */
#define MACHINE_BUS_PCMCIA 0x00000200 /* sys has PCMCIA bus */
#define MACHINE_BUS_AGP 0x00000400 /* sys has AGP bus */
#define MACHINE_BUS_AC97 0x00000800 /* sys has AC97 bus (ACR/AMR/CNR slot) */
#define MACHINE_BUS_CASSETTE 0x00000002 /* sys has cassette port */
#define MACHINE_BUS_CARTRIDGE 0x00000004 /* sys has two cartridge bays */
#define MACHINE_BUS_ISA16 0x00000008 /* sys has ISA16 bus - PC/AT architecture */
#define MACHINE_BUS_CBUS 0x00000010 /* sys has C-BUS bus */
#define MACHINE_BUS_PS2_LATCH 0x00000020 /* system has PS/2 keyboard controller IRQ latch */
#define MACHINE_BUS_PS2_PORTS 0x00000040 /* system has PS/2 keyboard and mouse ports */
#define MACHINE_BUS_PS2 (MACHINE_BUS_PS2_LATCH | MACHINE_BUS_PS2_PORTS)
#define MACHINE_BUS_EISA 0x00000080 /* sys has EISA bus */
#define MACHINE_BUS_VLB 0x00000100 /* sys has VL bus */
#define MACHINE_BUS_MCA 0x00000200 /* sys has MCA bus */
#define MACHINE_BUS_PCI 0x00000400 /* sys has PCI bus */
#define MACHINE_BUS_PCMCIA 0x00000800 /* sys has PCMCIA bus */
#define MACHINE_BUS_AGP 0x00001000 /* sys has AGP bus */
#define MACHINE_BUS_AC97 0x00002000 /* sys has AC97 bus (ACR/AMR/CNR slot) */
/* Aliases. */
#define MACHINE_CASSETTE (MACHINE_BUS_CASSETTE) /* sys has cassette port */
#define MACHINE_CARTRIDGE (MACHINE_BUS_CARTRIDGE) /* sys has two cartridge bays */
/* Combined flags. */
#define MACHINE_PC (MACHINE_BUS_ISA) /* sys is PC/XT-compatible (ISA) */
@@ -57,16 +61,17 @@
#define MACHINE_AGP (MACHINE_BUS_AGP | MACHINE_PCI) /* sys is AT-compatible with AGP */
#define MACHINE_AGP98 (MACHINE_BUS_AGP | MACHINE_PCI98) /* sys is NEC PC-98x1 series with AGP (did that even exist?) */
#define MACHINE_PCJR (MACHINE_PC | MACHINE_CARTRIDGE) /* sys is PCjr */
#define MACHINE_PS2 (MACHINE_AT | MACHINE_BUS_PS2) /* sys is PS/2 */
#define MACHINE_PS2_MCA (MACHINE_MCA | MACHINE_BUS_PS2) /* sys is MCA PS/2 */
#define MACHINE_PS2_VLB (MACHINE_VLB | MACHINE_BUS_PS2) /* sys is VLB PS/2 */
#define MACHINE_PS2_PCI (MACHINE_PCI | MACHINE_BUS_PS2) /* sys is PCI PS/2 */
#define MACHINE_PS2_PCIV (MACHINE_PCIV | MACHINE_BUS_PS2) /* sys is VLB/PCI PS/2 */
#define MACHINE_PS2_AGP (MACHINE_AGP | MACHINE_BUS_PS2) /* sys is AGP PS/2 */
#define MACHINE_PS2_A97 (MACHINE_PS2_AGP | MACHINE_BUS_AC97) /* sys is AGP/AC97 PS/2 */
#define MACHINE_PS2_NOISA (MACHINE_PS2_AGP & ~MACHINE_AT) /* sys is AGP PS/2 without ISA */
#define MACHINE_PS2_NOI97 (MACHINE_PS2_A97 & ~MACHINE_AT) /* sys is AGP/AC97 PS/2 without ISA */
#define MACHINE_PC5150 (MACHINE_PC | MACHINE_CASSETTE) /* sys is IBM PC 5150 */
#define MACHINE_PCJR (MACHINE_PC | MACHINE_CASSETTE | MACHINE_CARTRIDGE) /* sys is PCjr */
#define MACHINE_PS2 (MACHINE_AT | MACHINE_BUS_PS2) /* sys is PS/2 */
#define MACHINE_PS2_MCA (MACHINE_MCA | MACHINE_BUS_PS2) /* sys is MCA PS/2 */
#define MACHINE_PS2_VLB (MACHINE_VLB | MACHINE_BUS_PS2) /* sys is VLB PS/2 */
#define MACHINE_PS2_PCI (MACHINE_PCI | MACHINE_BUS_PS2) /* sys is PCI PS/2 */
#define MACHINE_PS2_PCIV (MACHINE_PCIV | MACHINE_BUS_PS2) /* sys is VLB/PCI PS/2 */
#define MACHINE_PS2_AGP (MACHINE_AGP | MACHINE_BUS_PS2) /* sys is AGP PS/2 */
#define MACHINE_PS2_A97 (MACHINE_PS2_AGP | MACHINE_BUS_AC97) /* sys is AGP/AC97 PS/2 */
#define MACHINE_PS2_NOISA (MACHINE_PS2_AGP & ~MACHINE_AT) /* sys is AGP PS/2 without ISA */
#define MACHINE_PS2_NOI97 (MACHINE_PS2_A97 & ~MACHINE_AT) /* sys is AGP/AC97 PS/2 without ISA */
/* Feature flags for miscellaneous internal devices. */
#define MACHINE_FLAGS_NONE 0x00000000 /* sys has no int devices */
#define MACHINE_VIDEO 0x00000001 /* sys has int video */
@@ -95,19 +100,20 @@
#define MACHINE_AV (MACHINE_VIDEO | MACHINE_SOUND) /* sys has video and sound */
#define MACHINE_AG (MACHINE_SOUND | MACHINE_GAMEPORT) /* sys has sound and game port */
/* Feature flags for internal storage controllers. */
#define MACHINE_HDC 0x03FE0000 /* sys has int HDC */
#define MACHINE_MFM 0x00020000 /* sys has int MFM/RLL */
#define MACHINE_XTA 0x00040000 /* sys has int XTA */
#define MACHINE_ESDI 0x00080000 /* sys has int ESDI */
#define MACHINE_IDE_PRI 0x00100000 /* sys has int pri IDE/ATAPI */
#define MACHINE_IDE_SEC 0x00200000 /* sys has int sec IDE/ATAPI */
#define MACHINE_IDE_TER 0x00400000 /* sys has int ter IDE/ATAPI */
#define MACHINE_IDE_QUA 0x00800000 /* sys has int qua IDE/ATAPI */
#define MACHINE_SCSI_PRI 0x01000000 /* sys has int pri SCSI */
#define MACHINE_SCSI_SEC 0x02000000 /* sys has int sec SCSI */
#define MACHINE_USB_PRI 0x04000000 /* sys has int pri USB */
#define MACHINE_USB_SEC 0x08000000 /* sys has int sec USB */
#define MACHINE_COREBOOT 0x10000000 /* sys has coreboot BIOS */
#define MACHINE_HDC 0x03FE0000 /* sys has int HDC */
#define MACHINE_MFM 0x00020000 /* sys has int MFM/RLL */
#define MACHINE_XTA 0x00040000 /* sys has int XTA */
#define MACHINE_ESDI 0x00080000 /* sys has int ESDI */
#define MACHINE_IDE_PRI 0x00100000 /* sys has int pri IDE/ATAPI */
#define MACHINE_IDE_SEC 0x00200000 /* sys has int sec IDE/ATAPI */
#define MACHINE_IDE_TER 0x00400000 /* sys has int ter IDE/ATAPI */
#define MACHINE_IDE_QUA 0x00800000 /* sys has int qua IDE/ATAPI */
#define MACHINE_SCSI_PRI 0x01000000 /* sys has int pri SCSI */
#define MACHINE_SCSI_SEC 0x02000000 /* sys has int sec SCSI */
#define MACHINE_USB_PRI 0x04000000 /* sys has int pri USB */
#define MACHINE_USB_SEC 0x08000000 /* sys has int sec USB */
#define MACHINE_COREBOOT 0x10000000 /* sys has coreboot BIOS */
#define MACHINE_SOFTFLOAT_ONLY 0x20000000 /* sys requires softfloat FPU */
/* Combined flags. */
#define MACHINE_IDE (MACHINE_IDE_PRI) /* sys has int single IDE/ATAPI - mark as pri IDE/ATAPI */
#define MACHINE_IDE_DUAL (MACHINE_IDE_PRI | MACHINE_IDE_SEC) /* sys has int dual IDE/ATAPI - mark as both pri and sec IDE/ATAPI */
@@ -143,31 +149,31 @@
#endif
enum {
MACHINE_TYPE_NONE = 0,
MACHINE_TYPE_8088,
MACHINE_TYPE_8086,
MACHINE_TYPE_286,
MACHINE_TYPE_386SX,
MACHINE_TYPE_486SLC,
MACHINE_TYPE_386DX,
MACHINE_TYPE_386DX_486,
MACHINE_TYPE_486,
MACHINE_TYPE_486_S2,
MACHINE_TYPE_486_S3,
MACHINE_TYPE_486_MISC,
MACHINE_TYPE_SOCKET4,
MACHINE_TYPE_SOCKET5,
MACHINE_TYPE_SOCKET7_3V,
MACHINE_TYPE_SOCKET7,
MACHINE_TYPE_SOCKETS7,
MACHINE_TYPE_SOCKET8,
MACHINE_TYPE_SLOT1,
MACHINE_TYPE_SLOT1_2,
MACHINE_TYPE_SLOT1_370,
MACHINE_TYPE_SLOT2,
MACHINE_TYPE_SOCKET370,
MACHINE_TYPE_MISC,
MACHINE_TYPE_MAX
MACHINE_TYPE_NONE = 0,
MACHINE_TYPE_8088 = 1,
MACHINE_TYPE_8086 = 2,
MACHINE_TYPE_286 = 3,
MACHINE_TYPE_386SX = 4,
MACHINE_TYPE_486SLC = 5,
MACHINE_TYPE_386DX = 6,
MACHINE_TYPE_386DX_486 = 7,
MACHINE_TYPE_486 = 8,
MACHINE_TYPE_486_S2 = 9,
MACHINE_TYPE_486_S3 = 10,
MACHINE_TYPE_486_MISC = 11,
MACHINE_TYPE_SOCKET4 = 12,
MACHINE_TYPE_SOCKET5 = 13,
MACHINE_TYPE_SOCKET7_3V = 14,
MACHINE_TYPE_SOCKET7 = 15,
MACHINE_TYPE_SOCKETS7 = 16,
MACHINE_TYPE_SOCKET8 = 17,
MACHINE_TYPE_SLOT1 = 18,
MACHINE_TYPE_SLOT1_2 = 19,
MACHINE_TYPE_SLOT1_370 = 20,
MACHINE_TYPE_SLOT2 = 21,
MACHINE_TYPE_SOCKET370 = 22,
MACHINE_TYPE_MISC = 23,
MACHINE_TYPE_MAX = 24
};
enum {
@@ -279,9 +285,12 @@ typedef struct _machine_ {
const char *name;
const char *internal_name;
uint32_t type;
uint32_t chipset;
uintptr_t chipset;
int (*init)(const struct _machine_ *);
uintptr_t pad, pad0, pad1, pad2;
uintptr_t pad;
uintptr_t pad0;
uintptr_t pad1;
uintptr_t pad2;
const machine_cpu_t cpu;
uintptr_t bus_flags;
uintptr_t flags;
@@ -317,8 +326,8 @@ typedef struct _machine_ {
} machine_t;
/* Global variables. */
extern const machine_filter_t machine_types[],
machine_chipsets[];
extern const machine_filter_t machine_types[];
extern const machine_filter_t machine_chipsets[];
extern const machine_t machines[];
extern int bios_only;
extern int machine;
@@ -612,6 +621,7 @@ extern int machine_at_acerv35n_init(const machine_t *);
extern int machine_at_p55t2p4_init(const machine_t *);
extern int machine_at_m7shi_init(const machine_t *);
extern int machine_at_tc430hx_init(const machine_t *);
extern int machine_at_infinia7200_init(const machine_t *);
extern int machine_at_equium5200_init(const machine_t *);
extern int machine_at_pcv90_init(const machine_t *);
extern int machine_at_p65up5_cp55t2d_init(const machine_t *);
@@ -770,6 +780,7 @@ extern int machine_ps2_model_65sx_init(const machine_t *);
extern int machine_ps2_model_70_type3_init(const machine_t *);
extern int machine_ps2_model_80_init(const machine_t *);
extern int machine_ps2_model_80_axx_init(const machine_t *);
extern int machine_ps2_model_70_type4_init(const machine_t *);
/* m_tandy.c */
extern int tandy1k_eeprom_read(void);

View File

@@ -1,20 +1,20 @@
#ifndef EMU_MACHINE_STATUS_H
#define EMU_MACHINE_STATUS_H
typedef struct {
typedef struct dev_status_empty_active_t {
atomic_bool_t empty;
atomic_bool_t active;
} dev_status_empty_active_t;
typedef struct {
typedef struct dev_status_active_t {
atomic_bool_t active;
} dev_status_active_t;
typedef struct {
typedef struct dev_status_empty_t {
atomic_bool_t empty;
} dev_status_empty_t;
typedef struct {
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];

View File

@@ -157,23 +157,22 @@
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
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 {
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;
@@ -228,7 +227,7 @@ typedef struct page_t {
} page_t;
extern uint32_t purgable_page_list_head;
static inline int
__attribute__((always_inline)) static inline int
page_in_evict_list(page_t *p)
{
return (p->evict_prev != EVICT_NOT_IN_LIST);
@@ -257,7 +256,8 @@ extern uint8_t *ram, *ram2;
extern uint32_t rammask;
extern uint8_t *rom;
extern uint32_t biosmask, biosaddr;
extern uint32_t biosmask;
extern uint32_t biosaddr;
extern int readlookup[256];
extern uintptr_t *readlookup2;
@@ -270,27 +270,28 @@ extern int writelnext;
extern uint32_t ram_mapped_addr[64];
extern uint8_t page_ff[4096];
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 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];
@@ -299,9 +300,9 @@ extern uint8_t high_page; /* if a high (> 4 gb) page was detected */
extern uint32_t pages_sz; /* #pages in table */
extern int mem_a20_state,
mem_a20_alt,
mem_a20_key;
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);
@@ -415,7 +416,6 @@ extern void mem_reset_page_blocks(void);
extern void flushmmucache(void);
extern void flushmmucache_nopc(void);
extern void mmu_invalidate(uint32_t addr);
extern void mem_a20_init(void);
extern void mem_a20_recalc(void);

View File

@@ -47,16 +47,25 @@ typedef struct midi_in_handler_t {
} 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;
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_out, *midi_in;
extern midi_t *midi_out;
extern midi_t *midi_in;
extern void midi_out_init(midi_device_t *device);
extern void midi_in_init(midi_device_t *device, midi_t **mididev);

View File

@@ -27,7 +27,7 @@
#define MO_TIME 10.0
typedef struct {
typedef struct mo_type_t {
uint32_t sectors;
uint16_t bytes_per_sector;
} mo_type_t;
@@ -48,8 +48,7 @@ static const mo_type_t mo_types[KNOWN_MO_TYPES] = {
{ 637041, 1024},
};
typedef struct
{
typedef struct mo_drive_type_t {
const char vendor[9];
const char model[16];
const char revision[5];
@@ -85,62 +84,77 @@ static const mo_drive_type_t mo_drive_types[KNOWN_MO_DRIVE_TYPES] = {
enum {
MO_BUS_DISABLED = 0,
MO_BUS_ATAPI = 5,
MO_BUS_SCSI,
MO_BUS_USB
MO_BUS_SCSI = 6,
MO_BUS_USB = 7
};
typedef struct {
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;
char image_path[1024],
prev_image_path[1024];
char image_path[1024];
char prev_image_path[1024];
uint32_t type, medium_size,
base;
uint32_t type;
uint32_t medium_size;
uint32_t base;
uint16_t sector_size;
} mo_drive_t;
typedef struct {
typedef struct mo_t {
mode_sense_pages_t ms_pages_saved;
mo_drive_t *drv;
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;
uint8_t status;
uint8_t phase;
uint8_t error;
uint8_t id;
uint8_t features;
uint8_t cur_lun;
uint8_t pad0;
uint8_t pad1;
uint16_t request_length, max_transfer_len;
uint16_t request_length;
uint16_t max_transfer_len;
int requested_blocks, packet_status,
total_length, do_page_save,
unit_attention, request_pos,
old_len, pad3;
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, sector_len,
packet_len, pos;
uint32_t sector_pos;
uint32_t sector_len;
uint32_t packet_len;
uint32_t pos;
double callback;
} mo_t;

View File

@@ -34,6 +34,8 @@
#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. */
@@ -41,9 +43,16 @@
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_x;
extern int mouse_y;
extern int mouse_z;
extern int mouse_mode; /* 1 = Absolute, 0 = Relative */
extern int mouse_tablet_in_proximity;
extern double mouse_x_abs;
extern double mouse_y_abs;
extern int mouse_buttons;
extern int tablet_tool_type;
#ifdef EMU_DEVICE_H
extern const device_t *mouse_get_device(int mouse);
@@ -59,6 +68,8 @@ 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);
@@ -72,6 +83,8 @@ extern void mouse_poll(void);
extern void mouse_bus_set_irq(void *priv, int irq);
extern void mouse_set_sample_rate(double new_rate);
extern char *mouse_get_name(int mouse);
extern char *mouse_get_internal_name(int mouse);
extern int mouse_get_from_internal_name(char *s);

View File

@@ -36,7 +36,7 @@
#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 */
@@ -178,7 +178,10 @@ typedef struct {
0xFF. */
id1; /* 0x70 for the RTL8019AS, 0x43 for the
RTL8029AS, otherwise 0xFF. */
int mem_size, mem_start, mem_end;
uint32_t mem_size;
uint32_t mem_start;
uint32_t mem_end;
uint32_t mem_wrap;
int tx_timer_index;
int tx_timer_active;

View File

@@ -1,7 +1,7 @@
#ifndef EMU_NET_EVENT_H
#define EMU_NET_EVENT_H
typedef struct {
typedef struct net_evt_t {
#ifdef _WIN32
HANDLE handle;
#else

View File

@@ -45,13 +45,13 @@
#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 */
WD8013EPA
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;

View File

@@ -48,20 +48,25 @@
#include <stdint.h>
/* Network provider types. */
#define NET_TYPE_NONE 0 /* networking disabled */
#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
enum {
NET_LINK_DOWN = (1 << 1),
NET_LINK_TEMP_DOWN = (1 << 2),
@@ -75,20 +80,20 @@ enum {
/* Supported network cards. */
enum {
NONE = 0,
NE1000,
NE2000,
RTL8019AS,
RTL8029AS
NONE = 0,
NE1000 = 1,
NE2000 = 2,
RTL8019AS = 3,
RTL8029AS = 4
};
enum {
NET_QUEUE_RX,
NET_QUEUE_TX_VM,
NET_QUEUE_TX_HOST
NET_QUEUE_RX = 0,
NET_QUEUE_TX_VM = 1,
NET_QUEUE_TX_HOST = 2
};
typedef struct {
typedef struct netcard_conf_t {
uint16_t device_num;
int net_type;
char host_dev_name[128];
@@ -106,7 +111,7 @@ typedef struct netpkt {
int len;
} netpkt_t;
typedef struct {
typedef struct netqueue_t {
netpkt_t packets[NET_QUEUE_LEN];
int head;
int tail;
@@ -116,13 +121,15 @@ 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);
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;
@@ -130,7 +137,7 @@ struct _netcard_t {
struct netdrv_t host_drv;
NETRXCB rx;
NETSETLINKSTATE set_link_state;
netqueue_t queues[3];
netqueue_t queues[NET_QUEUE_COUNT];
netpkt_t queued_pkt;
mutex_t *tx_mutex;
mutex_t *rx_mutex;
@@ -147,14 +154,26 @@ typedef struct {
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 netdev_t network_devs[NET_HOST_INTF_MAX];
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_init(void);
@@ -166,6 +185,8 @@ extern int network_available(void);
extern void network_tx(netcard_t *card, uint8_t *, int);
extern int net_pcap_prepare(netdev_t *);
extern int net_vde_prepare(void);
extern void network_connect(int id, int connect);
extern int network_is_connected(int id);

View File

@@ -64,7 +64,8 @@
typedef struct _nvr_ {
char *fn; /* pathname of image file */
uint16_t size; /* device configuration */
int8_t irq, is_new;
int8_t irq;
int8_t is_new;
uint8_t onesec_cnt;
pc_timer_t onesec_time;

View File

@@ -56,37 +56,37 @@
#define PCI_ADD_STRICT 0x80
enum {
PCI_CARD_NORTHBRIDGE = 0,
PCI_CARD_AGPBRIDGE,
PCI_CARD_SOUTHBRIDGE,
PCI_CARD_SOUTHBRIDGE_IDE,
PCI_CARD_SOUTHBRIDGE_PMU,
PCI_CARD_SOUTHBRIDGE_USB,
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_AGPBRIDGE = 1,
PCI_CARD_SOUTHBRIDGE = 2,
PCI_CARD_SOUTHBRIDGE_IDE = 3,
PCI_CARD_SOUTHBRIDGE_PMU = 4,
PCI_CARD_SOUTHBRIDGE_USB = 5,
PCI_CARD_AGP = 0x0f,
PCI_CARD_NORMAL = 0x10,
PCI_CARD_VIDEO = 0x11,
PCI_CARD_SCSI = 0x12,
PCI_CARD_SOUND = 0x13,
PCI_CARD_IDE = 0x14,
PCI_CARD_NETWORK = 0x15,
PCI_CARD_BRIDGE = 0x16,
};
enum {
PCI_ADD_NORTHBRIDGE = 0,
PCI_ADD_AGPBRIDGE,
PCI_ADD_SOUTHBRIDGE,
PCI_ADD_SOUTHBRIDGE_IDE,
PCI_ADD_SOUTHBRIDGE_PMU,
PCI_ADD_SOUTHBRIDGE_USB,
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_AGPBRIDGE = 1,
PCI_ADD_SOUTHBRIDGE = 2,
PCI_ADD_SOUTHBRIDGE_IDE = 3,
PCI_ADD_SOUTHBRIDGE_PMU = 4,
PCI_ADD_SOUTHBRIDGE_USB = 5,
PCI_ADD_AGP = 0x0f,
PCI_ADD_NORMAL = 0x10,
PCI_ADD_VIDEO = 0x11,
PCI_ADD_SCSI = 0x12,
PCI_ADD_SOUND = 0x13,
PCI_ADD_IDE = 0x14,
PCI_ADD_NETWORK = 0x15,
PCI_ADD_BRIDGE = 0x16
};
typedef union {
@@ -94,8 +94,10 @@ typedef union {
uint8_t addr_regs[4];
} bar_t;
extern int pci_burst_time, agp_burst_time,
pci_nonburst_time, agp_nonburst_time;
extern int pci_burst_time;
extern int agp_burst_time;
extern int pci_nonburst_time;
extern int agp_nonburst_time;
extern void pci_set_irq_routing(int pci_int, int irq);
extern void pci_set_irq_level(int pci_int, int level);

View File

@@ -20,16 +20,32 @@
#define EMU_PIC_H
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;
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 lines;
uint8_t data_bus;
uint32_t at;
struct pic *slaves[8];
} pic_t;
extern pic_t pic, pic2;
extern pic_t pic;
extern pic_t pic2;
extern void pic_reset_smi_irq_mask(void);
extern void pic_set_smi_irq_mask(int irq, int set);
@@ -43,8 +59,11 @@ 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_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);

View File

@@ -19,26 +19,38 @@
#ifndef EMU_PIT_H
#define EMU_PIT_H
typedef struct {
uint8_t m, ctrl,
read_status, latch,
s1_det, l_det,
bcd, pad;
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;
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;
int32_t count;
struct {
int units : 4;
int tens : 4;
int hundreds : 4;
int thousands : 4;
int myriads : 4;
int32_t units : 4;
int32_t tens : 4;
int32_t hundreds : 4;
int32_t thousands : 4;
int32_t myriads : 4;
};
};
@@ -49,7 +61,8 @@ typedef struct {
} ctr_t;
typedef struct PIT {
int flags, clock;
int flags;
int clock;
pc_timer_t callback_timer;
ctr_t counters[3];
@@ -58,13 +71,13 @@ typedef struct PIT {
} pit_t;
enum {
PIT_8253 = 0,
PIT_8254,
PIT_8253_FAST,
PIT_8254_FAST
PIT_8253 = 0,
PIT_8254 = 1,
PIT_8253_FAST = 2,
PIT_8254_FAST = 3
};
typedef struct {
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. */
@@ -84,15 +97,18 @@ typedef struct {
extern pit_intf_t pit_devs[2];
extern const pit_intf_t pit_classic_intf;
extern double SYSCLK, PCICLK, AGPCLK;
extern double SYSCLK;
extern double PCICLK;
extern double AGPCLK;
extern uint64_t PITCONST, ISACONST,
CGACONST,
MDACONST,
HERCCONST,
VGACONST1,
VGACONST2,
RTCCONST;
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;

View File

@@ -19,15 +19,24 @@
#ifndef EMU_PIT_FAST_H
#define EMU_PIT_FAST_H
typedef struct {
uint8_t m, ctrl,
read_status, latch, bcd;
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, wm, gate, out,
newcount, clock, using_timer, latched,
do_read_status;
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;
@@ -36,13 +45,13 @@ typedef struct {
int rereadlatch;
union {
int count;
int32_t count;
struct {
int units : 4;
int tens : 4;
int hundreds : 4;
int thousands : 4;
int myriads : 4;
int32_t units : 4;
int32_t tens : 4;
int32_t hundreds : 4;
int32_t thousands : 4;
int32_t myriads : 4;
};
};
@@ -53,7 +62,7 @@ typedef struct {
void (*out_func)(int new_out, int old_out);
} ctrf_t;
typedef struct {
typedef struct pitf_t {
int flags;
ctrf_t counters[3];

View File

@@ -81,9 +81,9 @@ extern "C" {
#endif
/* Global variables residing in the platform module. */
extern int dopause, /* system is paused */
mouse_capture; /* mouse is captured in app */
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;
@@ -95,7 +95,9 @@ extern char emu_version[200]; /* version ID string */
extern int rctrl_is_lalt;
extern int update_icons;
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);

View File

@@ -39,7 +39,7 @@ struct dirent {
};
# define d_namlen d_reclen
typedef struct {
typedef struct DIR_t {
short flags; /* internal flags */
short offset; /* offset of entry into dir */
long handle; /* open handle to Win32 system */
@@ -68,7 +68,7 @@ extern int closedir(DIR *);
# define rewinddir(dirp) seekdir(dirp, 0L)
#else
/* On linux and macOS, use the standard functions and types */
# include <sys/dir.h>
# include <dirent.h>
#endif
#endif /*PLAT_DIR_H*/

View File

@@ -18,7 +18,7 @@
#ifndef PLAT_DYNLD_H
#define PLAT_DYNLD_H
typedef struct {
typedef struct dllimp_t {
const char *name;
void *func;
} dllimp_t;

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 *p, uint8_t data);
extern int plat_serpt_read(void *p, uint8_t *data);
extern int plat_serpt_open_device(void *p);
extern void plat_serpt_close(void *p);
extern void plat_serpt_set_params(void *p);
#ifdef __cplusplus
}
#endif
#endif

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.
*
* 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
#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 /*EMU_PLAT_UNUSED_H*/

View File

@@ -20,9 +20,9 @@
#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;
} port_6x_t;

View File

@@ -20,9 +20,9 @@
#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;

View File

@@ -3,7 +3,8 @@
typedef struct PPI {
int s2;
uint8_t pa, pb;
uint8_t pa;
uint8_t pb;
} PPI;
extern int ppispeakon;

View File

@@ -142,26 +142,27 @@
#define IDT_CD_LUN 1766 /* LUN: */
#define IDT_CD_CHANNEL 1767 /* Channel: */
#define IDT_CD_SPEED 1768 /* Speed: */
#define IDT_CD_TYPE 1769 /* Type: */
/* DLG_CFG_OTHER_REMOVABLE_DEVICES */
#define IDT_MO_DRIVES 1769 /* MO drives: */
#define IDT_MO_BUS 1770 /* Bus: */
#define IDT_MO_ID 1771 /* ID: */
#define IDT_MO_CHANNEL 1772 /* Channel */
#define IDT_MO_TYPE 1773 /* Type: */
#define IDT_MO_DRIVES 1770 /* MO drives: */
#define IDT_MO_BUS 1771 /* Bus: */
#define IDT_MO_ID 1772 /* ID: */
#define IDT_MO_CHANNEL 1773 /* Channel */
#define IDT_MO_TYPE 1774 /* Type: */
#define IDT_ZIP_DRIVES 1774 /* ZIP drives: */
#define IDT_ZIP_BUS 1775 /* Bus: */
#define IDT_ZIP_ID 1776 /* ID: */
#define IDT_ZIP_LUN 1777 /* LUN: */
#define IDT_ZIP_CHANNEL 1778 /* Channel: */
#define IDT_ZIP_DRIVES 1775 /* ZIP drives: */
#define IDT_ZIP_BUS 1776 /* Bus: */
#define IDT_ZIP_ID 1777 /* ID: */
#define IDT_ZIP_LUN 1778 /* LUN: */
#define IDT_ZIP_CHANNEL 1779 /* Channel: */
/* DLG_CFG_PERIPHERALS */
#define IDT_ISARTC 1779 /* ISA RTC: */
#define IDT_ISAMEM_1 1780 /* ISAMEM Board #1: */
#define IDT_ISAMEM_2 1781 /* ISAMEM Board #2: */
#define IDT_ISAMEM_3 1782 /* ISAMEM Board #3: */
#define IDT_ISAMEM_4 1783 /* ISAMEM Board #4: */
#define IDT_ISARTC 1780 /* ISA RTC: */
#define IDT_ISAMEM_1 1781 /* ISAMEM Board #1: */
#define IDT_ISAMEM_2 1782 /* ISAMEM Board #2: */
#define IDT_ISAMEM_3 1783 /* ISAMEM Board #3: */
#define IDT_ISAMEM_4 1784 /* ISAMEM Board #4: */
/*
* To try to keep these organized, we now group the
@@ -185,19 +186,20 @@
#ifdef USE_DYNAREC
# define IDC_CHECK_DYNAREC 1017
#endif
#define IDC_MEMTEXT 1018
#define IDC_MEMSPIN 1019
#define IDC_CHECK_SOFTFLOAT 1018
#define IDC_MEMTEXT 1019
#define IDC_MEMSPIN 1020
#define IDC_TEXT_MB IDT_MB
#define IDC_VIDEO 1020 /* video config */
#define IDC_COMBO_VIDEO 1021
#define IDC_VIDEO_2 1022
#define IDC_COMBO_VIDEO_2 1023
#define IDC_CHECK_VOODOO 1024
#define IDC_BUTTON_VOODOO 1025
#define IDC_CHECK_IBM8514 1026
#define IDC_CHECK_XGA 1027
#define IDC_BUTTON_XGA 1028
#define IDC_VIDEO 1021 /* video config */
#define IDC_COMBO_VIDEO 1022
#define IDC_VIDEO_2 1023
#define IDC_COMBO_VIDEO_2 1024
#define IDC_CHECK_VOODOO 1025
#define IDC_BUTTON_VOODOO 1026
#define IDC_CHECK_IBM8514 1027
#define IDC_CHECK_XGA 1028
#define IDC_BUTTON_XGA 1029
#define IDC_INPUT 1030 /* input config */
#define IDC_COMBO_MOUSE 1031
@@ -247,6 +249,10 @@
#define IDC_CHECK_PARALLEL2 1089
#define IDC_CHECK_PARALLEL3 1090
#define IDC_CHECK_PARALLEL4 1091
#define IDC_CHECK_SERIAL_PASS1 1092
#define IDC_CHECK_SERIAL_PASS2 1093
#define IDC_CHECK_SERIAL_PASS3 1094
#define IDC_CHECK_SERIAL_PASS4 1095
#define IDC_OTHER_PERIPH 1110 /* storage controllers config */
#define IDC_COMBO_HDC 1111
@@ -274,7 +280,7 @@
#define IDC_COMBO_HD_BUS 1135
#define IDC_COMBO_HD_CHANNEL 1136
#define IDC_COMBO_HD_ID 1137
#define IDC_COMBO_HD_LUN 1138
#define IDC_COMBO_HD_SPEED 1138
#define IDC_COMBO_HD_CHANNEL_IDE 1139
#define IDC_EDIT_HD_FILE_NAME 1140 /* add hard disk dialog */
@@ -297,7 +303,7 @@
#define IDC_COMBO_CD_ID 1157
#define IDC_COMBO_CD_LUN 1158
#define IDC_COMBO_CD_CHANNEL_IDE 1159
#define IDC_CHECKEARLY 1160
#define IDC_COMBO_CD_TYPE 1160
#define IDC_LIST_ZIP_DRIVES 1170 /* other removable devices config */
#define IDC_COMBO_ZIP_BUS 1171
@@ -364,6 +370,10 @@
#define IDC_CONFIGURE_NET4 1321
#define IDC_CONFIGURE_MIDI_OUT 1322
#define IDC_CONFIGURE_MIDI_IN 1323
#define IDC_CONFIGURE_SERIAL_PASS1 1324
#define IDC_CONFIGURE_SERIAL_PASS2 1325
#define IDC_CONFIGURE_SERIAL_PASS3 1326
#define IDC_CONFIGURE_SERIAL_PASS4 1327
#define IDC_JOY1 1330
#define IDC_JOY2 1331
#define IDC_JOY3 1332

View File

@@ -32,7 +32,7 @@
#define bios_load_interleavedr(a, b, c, d, e) bios_load(a, b, c, d, e, FLAG_INT | FLAG_REP)
#define bios_load_aux_interleaved(a, b, c, d, e) bios_load(a, b, c, d, e, FLAG_INT | FLAG_AUX)
typedef struct {
typedef struct rom_t {
uint8_t *rom;
int sz;
uint32_t mask;

View File

@@ -22,31 +22,42 @@
#define CDROM_TIME 10.0
#ifdef SCSI_DEVICE_H
typedef struct {
typedef struct scsi_cdrom_t {
/* Common block. */
mode_sense_pages_t ms_pages_saved;
cdrom_t *drv;
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,
early, pad1;
uint8_t status;
uint8_t phase;
uint8_t error;
uint8_t id;
uint8_t features;
uint8_t cur_lun;
uint8_t early;
uint8_t pad1;
uint16_t request_length, max_transfer_len;
uint16_t request_length;
uint16_t max_transfer_len;
int requested_blocks, packet_status,
total_length, do_page_save,
unit_attention, request_pos,
old_len, media_status;
int requested_blocks;
int packet_status;
int total_length;
int do_page_save;
int unit_attention;
int request_pos;
int old_len;
int media_status;
uint32_t sector_pos, sector_len,
packet_len, pos;
uint32_t sector_pos;
uint32_t sector_len;
uint32_t packet_len;
uint32_t pos;
double callback;

View File

@@ -43,142 +43,142 @@
#define MCR_ERR 0x08 /* Media change request */
/* SCSI commands. */
#define GPCMD_TEST_UNIT_READY 0x00
#define GPCMD_REZERO_UNIT 0x01
#define GPCMD_REQUEST_SENSE 0x03
#define GPCMD_FORMAT_UNIT 0x04
#define GPCMD_IOMEGA_SENSE 0x06
#define GPCMD_READ_6 0x08
#define GPCMD_WRITE_6 0x0a
#define GPCMD_SEEK_6 0x0b
#define GPCMD_IOMEGA_SET_PROTECTION_MODE 0x0c
#define GPCMD_IOMEGA_EJECT 0x0d /* ATAPI only? */
#define GPCMD_NO_OPERATION_TOSHIBA 0x0d /* Toshiba Vendor Unique command */
#define GPCMD_NO_OPERATION_NEC 0x0d /* NEC Vendor Unique command */
#define GPCMD_INQUIRY 0x12
#define GPCMD_VERIFY_6 0x13
#define GPCMD_MODE_SELECT_6 0x15
#define GPCMD_SCSI_RESERVE 0x16
#define GPCMD_SCSI_RELEASE 0x17
#define GPCMD_MODE_SENSE_6 0x1a
#define GPCMD_START_STOP_UNIT 0x1b
#define GPCMD_SEND_DIAGNOSTIC 0x1d
#define GPCMD_PREVENT_REMOVAL 0x1e
#define GPCMD_READ_FORMAT_CAPACITIES 0x23
#define GPCMD_READ_CDROM_CAPACITY 0x25
#define GPCMD_UNKNOWN_CHINON 0x26 /*Chinon Vendor Unique command*/
#define GPCMD_READ_10 0x28
#define GPCMD_READ_GENERATION 0x29
#define GPCMD_WRITE_10 0x2a
#define GPCMD_SEEK_10 0x2b
#define GPCMD_ERASE_10 0x2c
#define GPCMD_WRITE_AND_VERIFY_10 0x2e
#define GPCMD_VERIFY_10 0x2f
#define GPCMD_READ_BUFFER 0x3c
#define GPCMD_WRITE_SAME_10 0x41
#define GPCMD_READ_SUBCHANNEL 0x42
#define GPCMD_READ_TOC_PMA_ATIP 0x43
#define GPCMD_READ_HEADER 0x44
#define GPCMD_PLAY_AUDIO_10 0x45
#define GPCMD_GET_CONFIGURATION 0x46
#define GPCMD_PLAY_AUDIO_MSF 0x47
#define GPCMD_PLAY_AUDIO_TRACK_INDEX 0x48
#define GPCMD_PLAY_AUDIO_TRACK_RELATIVE_10 0x49
#define GPCMD_GET_EVENT_STATUS_NOTIFICATION 0x4a
#define GPCMD_PAUSE_RESUME 0x4b
#define GPCMD_STOP_PLAY_SCAN 0x4e
#define GPCMD_READ_DISC_INFORMATION 0x51
#define GPCMD_READ_TRACK_INFORMATION 0x52
#define GPCMD_MODE_SELECT_10 0x55
#define GPCMD_MODE_SENSE_10 0x5a
#define GPCMD_PLAY_AUDIO_12 0xa5
#define GPCMD_READ_12 0xa8
#define GPCMD_PLAY_AUDIO_TRACK_RELATIVE_12 0xa9
#define GPCMD_WRITE_12 0xaa
#define GPCMD_ERASE_12 0xac
#define GPCMD_READ_DVD_STRUCTURE 0xad /* For reading. */
#define GPCMD_WRITE_AND_VERIFY_12 0xae
#define GPCMD_VERIFY_12 0xaf
#define GPCMD_PLAY_CD_OLD 0xb4
#define GPCMD_READ_CD_OLD 0xb8
#define GPCMD_READ_CD_MSF 0xb9
#define GPCMD_AUDIO_SCAN 0xba
#define GPCMD_SET_SPEED 0xbb
#define GPCMD_PLAY_CD 0xbc
#define GPCMD_MECHANISM_STATUS 0xbd
#define GPCMD_READ_CD 0xbe
#define GPCMD_SEND_DVD_STRUCTURE 0xbf /* This is for writing only, irrelevant to 86Box. */
#define GPCMD_EJECT_CHINON 0xc0 /* Chinon Vendor Unique command */
#define GPCMD_AUDIO_TRACK_SEARCH_TOSHIBA 0xc0 /* Toshiba Vendor Unique command */
#define GPCMD_UNKNOWN_SONY 0xc0 /* Sony Vendor Unique command */
#define GPCMD_PLAY_AUDIO_TOSHIBA 0xc1 /* Toshiba Vendor Unique command */
#define GPCMD_READ_TOC_SONY 0xc1 /* Sony Vendor Unique command */
#define GPCMD_PAUSE_RESUME_ALT 0xc2
#define GPCMD_READ_SUBCHANNEL_MATSUSHITA 0xc2 /* Matsushita Vendor Unique command */
#define GPCMD_READ_SUBCHANNEL_SONY 0xc2 /* Sony Vendor Unique command */
#define GPCMD_STILL_TOSHIBA 0xc2 /* Toshiba Vendor Unique command */
#define GPCMD_READ_TOC_MATSUSHITA 0xc3 /* Matsushita Vendor Unique command */
#define GPCMD_READ_HEADER_SONY 0xc3 /* Sony Vendor Unique command */
#define GPCMD_SET_STOP_TIME_TOSHIBA 0xc3 /* Toshiba Vendor Unique command */
#define GPCMD_READ_HEADER_MATSUSHITA 0xc4 /* Matsushita Vendor Unique command */
#define GPCMD_PLAYBACK_STATUS_TOSHIBA 0xc4 /* Sony Vendor Unique command */
#define GPCMD_CADDY_EJECT_TOSHIBA 0xc4 /* Toshiba Vendor Unique command */
#define GPCMD_PAUSE_SONY 0xc5 /* Sony Vendor Unique command */
#define GPCMD_PLAY_AUDIO_MATSUSHITA 0xc5 /* Matsushita Vendor Unique command */
#define GPCMD_STOP_CHINON 0xc6 /* Chinon Vendor Unique command */
#define GPCMD_PLAT_TRACK_SONY 0xc6 /* Sony Vendor Unique command */
#define GPCMD_READ_SUBCODEQ_PLAYING_STATUS_TOSHIBA 0xc6 /* Toshiba Vendor Unique command */
#define GPCMD_PLAY_AUDIO_MSF_MATSUSHITA 0xc7 /* Matsushita Vendor Unique command*/
#define GPCMD_PLAY_MSF_SONY 0xc7 /* Sony Vendor Unique command*/
#define GPCMD_READ_DISC_INFORMATION_TOSHIBA 0xc7 /* Toshiba Vendor Unique command */
#define GPCMD_PLAY_AUDIO_TRACK_INDEX_MATSUSHITA 0xc8 /* Matsushita Vendor Unique command */
#define GPCMD_PLAY_AUDIO_SONY 0xc8 /* Sony Vendor Unique command */
#define GPCMD_TEST_UNIT_READY 0x00
#define GPCMD_REZERO_UNIT 0x01
#define GPCMD_REQUEST_SENSE 0x03
#define GPCMD_FORMAT_UNIT 0x04
#define GPCMD_IOMEGA_SENSE 0x06
#define GPCMD_READ_6 0x08
#define GPCMD_WRITE_6 0x0a
#define GPCMD_SEEK_6 0x0b
#define GPCMD_IOMEGA_SET_PROTECTION_MODE 0x0c
#define GPCMD_IOMEGA_EJECT 0x0d /* ATAPI only? */
#define GPCMD_NO_OPERATION_TOSHIBA 0x0d /* Toshiba Vendor Unique command */
#define GPCMD_NO_OPERATION_NEC 0x0d /* NEC Vendor Unique command */
#define GPCMD_INQUIRY 0x12
#define GPCMD_VERIFY_6 0x13
#define GPCMD_MODE_SELECT_6 0x15
#define GPCMD_SCSI_RESERVE 0x16
#define GPCMD_SCSI_RELEASE 0x17
#define GPCMD_MODE_SENSE_6 0x1a
#define GPCMD_START_STOP_UNIT 0x1b
#define GPCMD_SEND_DIAGNOSTIC 0x1d
#define GPCMD_PREVENT_REMOVAL 0x1e
#define GPCMD_READ_FORMAT_CAPACITIES 0x23
#define GPCMD_READ_CDROM_CAPACITY 0x25
#define GPCMD_UNKNOWN_CHINON 0x26 /*Chinon Vendor Unique command*/
#define GPCMD_READ_10 0x28
#define GPCMD_READ_GENERATION 0x29
#define GPCMD_WRITE_10 0x2a
#define GPCMD_SEEK_10 0x2b
#define GPCMD_ERASE_10 0x2c
#define GPCMD_WRITE_AND_VERIFY_10 0x2e
#define GPCMD_VERIFY_10 0x2f
#define GPCMD_READ_BUFFER 0x3c
#define GPCMD_WRITE_SAME_10 0x41
#define GPCMD_READ_SUBCHANNEL 0x42
#define GPCMD_READ_TOC_PMA_ATIP 0x43
#define GPCMD_READ_HEADER 0x44
#define GPCMD_PLAY_AUDIO_10 0x45
#define GPCMD_GET_CONFIGURATION 0x46
#define GPCMD_PLAY_AUDIO_MSF 0x47
#define GPCMD_PLAY_AUDIO_TRACK_INDEX 0x48
#define GPCMD_PLAY_AUDIO_TRACK_RELATIVE_10 0x49
#define GPCMD_GET_EVENT_STATUS_NOTIFICATION 0x4a
#define GPCMD_PAUSE_RESUME 0x4b
#define GPCMD_STOP_PLAY_SCAN 0x4e
#define GPCMD_READ_DISC_INFORMATION 0x51
#define GPCMD_READ_TRACK_INFORMATION 0x52
#define GPCMD_MODE_SELECT_10 0x55
#define GPCMD_MODE_SENSE_10 0x5a
#define GPCMD_PLAY_AUDIO_12 0xa5
#define GPCMD_READ_12 0xa8
#define GPCMD_PLAY_AUDIO_TRACK_RELATIVE_12 0xa9
#define GPCMD_WRITE_12 0xaa
#define GPCMD_ERASE_12 0xac
#define GPCMD_READ_DVD_STRUCTURE 0xad /* For reading. */
#define GPCMD_WRITE_AND_VERIFY_12 0xae
#define GPCMD_VERIFY_12 0xaf
#define GPCMD_PLAY_CD_OLD 0xb4
#define GPCMD_READ_CD_OLD 0xb8
#define GPCMD_READ_CD_MSF 0xb9
#define GPCMD_AUDIO_SCAN 0xba
#define GPCMD_SET_SPEED 0xbb
#define GPCMD_PLAY_CD 0xbc
#define GPCMD_MECHANISM_STATUS 0xbd
#define GPCMD_READ_CD 0xbe
#define GPCMD_SEND_DVD_STRUCTURE 0xbf /* This is for writing only, irrelevant to 86Box. */
#define GPCMD_EJECT_CHINON 0xc0 /* Chinon Vendor Unique command */
#define GPCMD_AUDIO_TRACK_SEARCH_TOSHIBA 0xc0 /* Toshiba Vendor Unique command */
#define GPCMD_UNKNOWN_SONY 0xc0 /* Sony Vendor Unique command */
#define GPCMD_PLAY_AUDIO_TOSHIBA 0xc1 /* Toshiba Vendor Unique command */
#define GPCMD_READ_TOC_SONY 0xc1 /* Sony Vendor Unique command */
#define GPCMD_PAUSE_RESUME_ALT 0xc2
#define GPCMD_READ_SUBCHANNEL_MATSUSHITA 0xc2 /* Matsushita Vendor Unique command */
#define GPCMD_READ_SUBCHANNEL_SONY 0xc2 /* Sony Vendor Unique command */
#define GPCMD_STILL_TOSHIBA 0xc2 /* Toshiba Vendor Unique command */
#define GPCMD_READ_TOC_MATSUSHITA 0xc3 /* Matsushita Vendor Unique command */
#define GPCMD_READ_HEADER_SONY 0xc3 /* Sony Vendor Unique command */
#define GPCMD_SET_STOP_TIME_TOSHIBA 0xc3 /* Toshiba Vendor Unique command */
#define GPCMD_READ_HEADER_MATSUSHITA 0xc4 /* Matsushita Vendor Unique command */
#define GPCMD_PLAYBACK_STATUS_TOSHIBA 0xc4 /* Sony Vendor Unique command */
#define GPCMD_CADDY_EJECT_TOSHIBA 0xc4 /* Toshiba Vendor Unique command */
#define GPCMD_PAUSE_SONY 0xc5 /* Sony Vendor Unique command */
#define GPCMD_PLAY_AUDIO_MATSUSHITA 0xc5 /* Matsushita Vendor Unique command */
#define GPCMD_STOP_CHINON 0xc6 /* Chinon Vendor Unique command */
#define GPCMD_PLAT_TRACK_SONY 0xc6 /* Sony Vendor Unique command */
#define GPCMD_READ_SUBCODEQ_PLAYING_STATUS_TOSHIBA 0xc6 /* Toshiba Vendor Unique command */
#define GPCMD_PLAY_AUDIO_MSF_MATSUSHITA 0xc7 /* Matsushita Vendor Unique command*/
#define GPCMD_PLAY_MSF_SONY 0xc7 /* Sony Vendor Unique command*/
#define GPCMD_READ_DISC_INFORMATION_TOSHIBA 0xc7 /* Toshiba Vendor Unique command */
#define GPCMD_PLAY_AUDIO_TRACK_INDEX_MATSUSHITA 0xc8 /* Matsushita Vendor Unique command */
#define GPCMD_PLAY_AUDIO_SONY 0xc8 /* Sony Vendor Unique command */
#define GPCMD_PLAY_AUDIO_TRACK_RELATIVE_10_MATSUSHITA 0xc9 /*Matsushita Vendor Unique command */
#define GPCMD_PLAYBACK_CONTROL_SONY 0xc9 /* Sony Vendor Unique command */
#define GPCMD_PAUSE_RESUME_MATSUSHITA 0xcb /* Matsushita Vendor Unique command */
#define GPCMD_SCAN_PIONEER 0xcd /* Should be equivalent to 0xba */
#define GPCMD_AUDIO_TRACK_SEARCH_NEC 0xd8 /* NEC Vendor Unique command */
#define GPCMD_PLAY_AUDIO_NEC 0xd9 /* NEC Vendor Unique command */
#define GPCMD_STILL_NEC 0xda /* NEC Vendor Unique command */
#define GPCMD_SET_SPEED_ALT 0xda /* Should be equivalent to 0xbb */
#define GPCMD_SET_STOP_TIME_NEC 0xdb /* NEC Vendor Unique command */
#define GPCMD_CADDY_EJECT_NEC 0xdc /* NEC Vendor Unique command */
#define GPCMD_READ_SUBCODEQ_PLAYING_STATUS_NEC 0xdd /* NEC Vendor Unique command */
#define GPCMD_READ_DISC_INFORMATION_NEC 0xde /* NEC Vendor Unique command */
#define GPCMD_PLAY_AUDIO_12_MATSUSHITA 0xe5 /* Matsushita Vendor Unique command */
#define GPCMD_PLAYBACK_CONTROL_SONY 0xc9 /* Sony Vendor Unique command */
#define GPCMD_PAUSE_RESUME_MATSUSHITA 0xcb /* Matsushita Vendor Unique command */
#define GPCMD_SCAN_PIONEER 0xcd /* Should be equivalent to 0xba */
#define GPCMD_AUDIO_TRACK_SEARCH_NEC 0xd8 /* NEC Vendor Unique command */
#define GPCMD_PLAY_AUDIO_NEC 0xd9 /* NEC Vendor Unique command */
#define GPCMD_STILL_NEC 0xda /* NEC Vendor Unique command */
#define GPCMD_SET_SPEED_ALT 0xda /* Should be equivalent to 0xbb */
#define GPCMD_SET_STOP_TIME_NEC 0xdb /* NEC Vendor Unique command */
#define GPCMD_CADDY_EJECT_NEC 0xdc /* NEC Vendor Unique command */
#define GPCMD_READ_SUBCODEQ_PLAYING_STATUS_NEC 0xdd /* NEC Vendor Unique command */
#define GPCMD_READ_DISC_INFORMATION_NEC 0xde /* NEC Vendor Unique command */
#define GPCMD_PLAY_AUDIO_12_MATSUSHITA 0xe5 /* Matsushita Vendor Unique command */
#define GPCMD_PLAY_AUDIO_TRACK_RELATIVE_12_MATSUSHITA 0xe9 /* Matsushita Vendor Unique command */
/* Mode page codes for mode sense/set */
#define GPMODE_R_W_ERROR_PAGE 0x01
#define GPMODE_DISCONNECT_PAGE 0x02 /* Disconnect/reconnect page */
#define GPMODE_FORMAT_DEVICE_PAGE 0x03
#define GPMODE_RIGID_DISK_PAGE 0x04 /* Rigid disk geometry page */
#define GPMODE_FLEXIBLE_DISK_PAGE 0x05
#define GPMODE_CACHING_PAGE 0x08
#define GPMODE_CDROM_PAGE_SONY 0x08
#define GPMODE_R_W_ERROR_PAGE 0x01
#define GPMODE_DISCONNECT_PAGE 0x02 /* Disconnect/reconnect page */
#define GPMODE_FORMAT_DEVICE_PAGE 0x03
#define GPMODE_RIGID_DISK_PAGE 0x04 /* Rigid disk geometry page */
#define GPMODE_FLEXIBLE_DISK_PAGE 0x05
#define GPMODE_CACHING_PAGE 0x08
#define GPMODE_CDROM_PAGE_SONY 0x08
#define GPMODE_CDROM_AUDIO_PAGE_SONY 0x09
#define GPMODE_CDROM_PAGE 0x0d
#define GPMODE_CDROM_AUDIO_PAGE 0x0e
#define GPMODE_CAPABILITIES_PAGE 0x2a
#define GPMODE_IOMEGA_PAGE 0x2f
#define GPMODE_UNK_VENDOR_PAGE 0x30
#define GPMODE_ALL_PAGES 0x3f
#define GPMODE_CDROM_PAGE 0x0d
#define GPMODE_CDROM_AUDIO_PAGE 0x0e
#define GPMODE_CAPABILITIES_PAGE 0x2a
#define GPMODE_IOMEGA_PAGE 0x2f
#define GPMODE_UNK_VENDOR_PAGE 0x30
#define GPMODE_ALL_PAGES 0x3f
/* Mode page codes for presence */
#define GPMODEP_R_W_ERROR_PAGE 0x0000000000000002LL
#define GPMODEP_DISCONNECT_PAGE 0x0000000000000004LL
#define GPMODEP_FORMAT_DEVICE_PAGE 0x0000000000000008LL
#define GPMODEP_RIGID_DISK_PAGE 0x0000000000000010LL
#define GPMODEP_FLEXIBLE_DISK_PAGE 0x0000000000000020LL
#define GPMODEP_CACHING_PAGE 0x0000000000000100LL
#define GPMODEP_CDROM_PAGE_SONY 0x0000000000000200LL
#define GPMODEP_R_W_ERROR_PAGE 0x0000000000000002LL
#define GPMODEP_DISCONNECT_PAGE 0x0000000000000004LL
#define GPMODEP_FORMAT_DEVICE_PAGE 0x0000000000000008LL
#define GPMODEP_RIGID_DISK_PAGE 0x0000000000000010LL
#define GPMODEP_FLEXIBLE_DISK_PAGE 0x0000000000000020LL
#define GPMODEP_CACHING_PAGE 0x0000000000000100LL
#define GPMODEP_CDROM_PAGE_SONY 0x0000000000000200LL
#define GPMODEP_CDROM_AUDIO_PAGE_SONY 0x0000000000000400LL
#define GPMODEP_CDROM_PAGE 0x0000000000002000LL
#define GPMODEP_CDROM_AUDIO_PAGE 0x0000000000004000LL
#define GPMODEP_CAPABILITIES_PAGE 0x0000040000000000LL
#define GPMODEP_IOMEGA_PAGE 0x0000800000000000LL
#define GPMODEP_UNK_VENDOR_PAGE 0x0001000000000000LL
#define GPMODEP_ALL_PAGES 0x8000000000000000LL
#define GPMODEP_CDROM_PAGE 0x0000000000002000LL
#define GPMODEP_CDROM_AUDIO_PAGE 0x0000000000004000LL
#define GPMODEP_CAPABILITIES_PAGE 0x0000040000000000LL
#define GPMODEP_IOMEGA_PAGE 0x0000800000000000LL
#define GPMODEP_UNK_VENDOR_PAGE 0x0001000000000000LL
#define GPMODEP_ALL_PAGES 0x8000000000000000LL
/* SCSI Status Codes */
#define SCSI_STATUS_OK 0
@@ -338,7 +338,7 @@
#define MODE_SELECT_PHASE_PAGE_HEADER 3
#define MODE_SELECT_PHASE_PAGE 4
typedef struct {
typedef struct mode_sense_pages_t {
uint8_t pages[0x40][0x40];
} mode_sense_pages_t;
@@ -349,34 +349,46 @@ typedef struct scsi_common_s {
void *p;
uint8_t *temp_buffer,
atapi_cdb[16], /* This is atapi_cdb in ATAPI-supporting devices,
and pad in SCSI-only devices. */
current_cdb[16],
sense[256];
uint8_t *temp_buffer;
uint8_t atapi_cdb[16]; /* This is atapi_cdb in ATAPI-supporting devices,
and pad in SCSI-only devices. */
uint8_t current_cdb[16];
uint8_t sense[256];
uint8_t status, phase,
error, id,
features, cur_lun,
pad0, pad1;
uint8_t status;
uint8_t phase;
uint8_t error;
uint8_t id;
uint8_t features;
uint8_t cur_lun;
uint8_t pad0;
uint8_t pad1;
uint16_t request_length, max_transfer_len;
uint16_t request_length;
uint16_t max_transfer_len;
int requested_blocks, packet_status,
total_length, do_page_save,
unit_attention, request_pos,
old_len, media_status;
int requested_blocks;
int packet_status;
int total_length;
int do_page_save;
int unit_attention;
int request_pos;
int old_len;
int media_status;
uint32_t sector_pos, sector_len,
packet_len, pos;
uint32_t sector_pos;
uint32_t sector_len;
uint32_t packet_len;
uint32_t pos;
double callback;
} scsi_common_t;
typedef struct {
typedef struct scsi_device_t {
int32_t buffer_length;
uint8_t status, phase;
uint8_t status;
uint8_t phase;
uint16_t type;
scsi_common_t *sc;

View File

@@ -16,31 +16,42 @@
#ifndef SCSI_DISK_H
#define SCSI_DISK_H
typedef struct {
typedef struct scsi_disk_t {
mode_sense_pages_t ms_pages_saved;
hard_disk_t *drv;
uint8_t *temp_buffer,
pad[16], /* This is atapi_cdb in ATAPI-supporting devices,
and pad in SCSI-only devices. */
current_cdb[16],
sense[256];
uint8_t *temp_buffer;
uint8_t pad[16]; /* This is atapi_cdb in ATAPI-supporting devices,
and pad in SCSI-only devices. */
uint8_t current_cdb[16];
uint8_t sense[256];
uint8_t status, phase,
error, id,
pad0, cur_lun,
pad1, pad2;
uint8_t status;
uint8_t phase;
uint8_t error;
uint8_t id;
uint8_t pad0;
uint8_t cur_lun;
uint8_t pad1;
uint8_t pad2;
uint16_t request_length, pad4;
uint16_t request_length;
uint16_t pad4;
int requested_blocks, packet_status,
total_length, do_page_save,
unit_attention, pad5,
pad6, pad7;
int requested_blocks;
int packet_status;
int total_length;
int do_page_save;
int unit_attention;
int pad5;
int pad6;
int pad7;
uint32_t sector_pos, sector_len,
packet_len, pos;
uint32_t sector_pos;
uint32_t sector_len;
uint32_t packet_len;
uint32_t pos;
double callback;
} scsi_disk_t;

View File

@@ -196,51 +196,51 @@
#define MAX_SG_DESCRIPTORS 32 /* Always make the array 32 elements long, if less are used, that's not an issue. */
#pragma pack(push, 1)
typedef struct {
typedef struct addr24_s {
uint8_t hi;
uint8_t mid;
uint8_t lo;
} addr24;
} addr24_t;
/* Structure for the INQUIRE_SETUP_INFORMATION reply. */
typedef struct {
uint8_t uOffset : 4,
uTransferPeriod : 3,
fSynchronous : 1;
typedef struct ReplyInquireSetupInformationSynchronousValue_t {
uint8_t uOffset : 4;
uint8_t uTransferPeriod : 3;
uint8_t fSynchronous : 1;
} ReplyInquireSetupInformationSynchronousValue;
typedef struct {
uint8_t fSynchronousInitiationEnabled : 1,
fParityCheckingEnabled : 1,
uReserved1 : 6;
typedef struct ReplyInquireSetupInformation_t {
uint8_t fSynchronousInitiationEnabled : 1;
uint8_t fParityCheckingEnabled : 1;
uint8_t uReserved1 : 6;
uint8_t uBusTransferRate;
uint8_t uPreemptTimeOnBus;
uint8_t uTimeOffBus;
uint8_t cMailbox;
addr24 MailboxAddress;
addr24_t MailboxAddress;
ReplyInquireSetupInformationSynchronousValue SynchronousValuesId0To7[8];
uint8_t uDisconnectPermittedId0To7;
uint8_t VendorSpecificData[28];
} ReplyInquireSetupInformation;
typedef struct {
typedef struct MailboxInit_t {
uint8_t Count;
addr24 Address;
addr24_t Address;
} MailboxInit_t;
typedef struct {
uint8_t CmdStatus;
addr24 CCBPointer;
typedef struct Mailbox_t {
uint8_t CmdStatus;
addr24_t CCBPointer;
} Mailbox_t;
typedef struct {
typedef struct Mailbox32_t {
uint32_t CCBPointer;
union {
struct {
struct out_t {
uint8_t Reserved[3];
uint8_t ActionCode;
} out;
struct {
struct in_t {
uint8_t HostStatus;
uint8_t TargetStatus;
uint8_t Reserved;
@@ -255,7 +255,7 @@ typedef struct {
Bytes 16 and 17 Reserved (must be 0)
Bytes 18 through 18+n-1, where n=size of CDB Command Descriptor Block */
typedef struct {
typedef struct CCB32_t {
uint8_t Opcode;
uint8_t Reserved1 : 3,
ControlByte : 2,
@@ -277,24 +277,24 @@ typedef struct {
uint32_t SensePointer;
} CCB32;
typedef struct {
uint8_t Opcode;
uint8_t Lun : 3,
ControlByte : 2,
Id : 3;
uint8_t CdbLength;
uint8_t RequestSenseLength;
addr24 DataLength;
addr24 DataPointer;
addr24 LinkPointer;
uint8_t LinkId;
uint8_t HostStatus;
uint8_t TargetStatus;
uint8_t Reserved[2];
uint8_t Cdb[12];
typedef struct CCB_t {
uint8_t Opcode;
uint8_t Lun : 3;
uint8_t ControlByte : 2;
uint8_t Id : 3;
uint8_t CdbLength;
uint8_t RequestSenseLength;
addr24_t DataLength;
addr24_t DataPointer;
addr24_t LinkPointer;
uint8_t LinkId;
uint8_t HostStatus;
uint8_t TargetStatus;
uint8_t Reserved[2];
uint8_t Cdb[12];
} CCB;
typedef struct {
typedef struct CCBC_t {
uint8_t Opcode;
uint8_t Pad1 : 3,
ControlByte : 2,
@@ -309,7 +309,7 @@ typedef struct {
uint8_t Cdb[12];
} CCBC;
typedef union {
typedef union CCBU_t {
CCB32 new;
CCB old;
CCBC common;
@@ -320,26 +320,25 @@ typedef struct {
uint8_t *RequestSenseBuffer;
uint32_t CCBPointer;
int Is24bit;
uint8_t TargetID,
LUN,
HostStatus,
TargetStatus,
MailboxCompletionCode;
uint8_t TargetID;
uint8_t LUN;
uint8_t HostStatus;
uint8_t TargetStatus;
uint8_t MailboxCompletionCode;
} Req_t;
typedef struct
{
typedef struct BIOSCMD_t {
uint8_t command;
uint8_t lun : 3,
reserved : 2,
id : 3;
union {
struct {
struct chs_t {
uint16_t cyl;
uint8_t head;
uint8_t sec;
} chs;
struct {
struct lba_t {
uint8_t lba0; /* MSB */
uint8_t lba1;
uint8_t lba2;
@@ -347,17 +346,17 @@ typedef struct
} lba;
} u;
uint8_t secount;
addr24 dma_address;
addr24_t dma_address;
} BIOSCMD;
typedef struct {
typedef struct SGE32_t {
uint32_t Segment;
uint32_t SegmentPointer;
} SGE32;
typedef struct {
addr24 Segment;
addr24 SegmentPointer;
typedef struct SGE_t {
addr24_t Segment;
addr24_t SegmentPointer;
} SGE;
#pragma pack(pop)
@@ -368,92 +367,111 @@ typedef struct {
#define X54X_MBX_24BIT 16
#define X54X_ISAPNP 32
typedef struct {
typedef struct x54x_t {
/* 32 bytes */
char vendor[16], /* name of device vendor */
name[16]; /* name of device */
char vendor[16]; /* name of device vendor */
char name[16]; /* name of device */
/* 24 bytes */
int8_t type, /* type of device */
IrqEnabled, Irq,
DmaChannel,
HostID;
int8_t type; /* type of device */
int8_t IrqEnabled;
int8_t Irq;
int8_t DmaChannel;
int8_t HostID;
uint8_t callback_phase : 4,
callback_sub_phase : 4,
scsi_cmd_phase, bus,
sync,
parity, shram_mode,
Geometry, Control,
Command, CmdParam,
BusOnTime, BusOffTime,
ATBusSpeed, setup_info_len,
max_id, pci_slot,
temp_cdb[12];
uint8_t callback_phase : 4;
uint8_t callback_sub_phase : 4;
uint8_t scsi_cmd_phase;
uint8_t bus;
uint8_t sync;
uint8_t parity;
uint8_t shram_mode;
uint8_t Geometry;
uint8_t Control;
uint8_t Command;
uint8_t CmdParam;
uint8_t BusOnTime;
uint8_t BusOffTime;
uint8_t ATBusSpeed;
uint8_t setup_info_len;
uint8_t max_id;
uint8_t pci_slot;
uint8_t temp_cdb[12];
volatile uint8_t /* for multi-threading, keep */
Status,
Interrupt, /* these volatile */
MailboxIsBIOS, ToRaise,
flags;
/* for multi-threading, keep these volatile */
volatile uint8_t Status;
volatile uint8_t Interrupt;
volatile uint8_t MailboxIsBIOS;
volatile uint8_t ToRaise;
volatile uint8_t flags;
/* 65928 bytes */
uint8_t pos_regs[8], /* MCA */
CmdBuf[128],
DataBuf[65536],
shadow_ram[128],
dma_buffer[128],
cmd_33_buf[4096];
uint8_t pos_regs[8]; /* MCA */
uint8_t CmdBuf[128];
uint8_t DataBuf[65536];
uint8_t shadow_ram[128];
uint8_t dma_buffer[128];
uint8_t cmd_33_buf[4096];
/* 16 bytes */
char *fw_rev; /* The 4 bytes of the revision command information + 2 extra bytes for BusLogic */
uint8_t *rom1, /* main BIOS image */
*rom2, /* SCSI-Select image */
*nvr; /* EEPROM buffer */
uint8_t *rom1; /* main BIOS image */
uint8_t *rom2; /* SCSI-Select image */
uint8_t *nvr; /* EEPROM buffer */
/* 6 words = 12 bytes */
uint16_t DataReply, DataReplyLeft,
rom_ioaddr, /* offset in BIOS of I/O addr */
rom_shram, /* index to shared RAM */
rom_shramsz, /* size of shared RAM */
rom_fwhigh, /* offset in BIOS of ver ID */
pnp_len, /* length of the PnP ROM */
pnp_offset, /* offset in the microcode ROM of the PnP ROM */
cmd_33_len, /* length of the SCSISelect code decompressor program */
cmd_33_offset; /* offset in the microcode ROM of the SCSISelect code decompressor program */
uint16_t DataReply;
uint16_t DataReplyLeft;
uint16_t rom_ioaddr; /* offset in BIOS of I/O addr */
uint16_t rom_shram; /* index to shared RAM */
uint16_t rom_shramsz; /* size of shared RAM */
uint16_t rom_fwhigh; /* offset in BIOS of ver ID */
uint16_t pnp_len; /* length of the PnP ROM */
uint16_t pnp_offset; /* offset in the microcode ROM of the PnP ROM */
uint16_t cmd_33_len; /* length of the SCSISelect code decompressor program */
uint16_t cmd_33_offset; /* offset in the microcode ROM of the SCSISelect code decompressor program */
/* 16 + 20 + 52 = 88 bytes */
volatile int
MailboxOutInterrupts,
PendingInterrupt, Lock,
target_data_len, pad0;
volatile int MailboxOutInterrupts;
volatile int PendingInterrupt;
volatile int Lock;
volatile int target_data_len;
volatile int pad0;
uint32_t Base, fdc_address, rom_addr, /* address of BIOS ROM */
CmdParamLeft, Outgoing,
transfer_size;
uint32_t Base;
uint32_t fdc_address;
uint32_t rom_addr; /* address of BIOS ROM */
uint32_t CmdParamLeft;
uint32_t Outgoing;
uint32_t transfer_size;
volatile uint32_t
MailboxInit,
MailboxCount,
MailboxOutAddr, MailboxOutPosCur,
MailboxInAddr, MailboxInPosCur,
MailboxReq,
BIOSMailboxInit, BIOSMailboxCount,
BIOSMailboxOutAddr, BIOSMailboxOutPosCur,
BIOSMailboxReq,
Residue, card_bus; /* Basically a copy of device flags */
volatile uint32_t MailboxInit;
volatile uint32_t MailboxCount;
volatile uint32_t MailboxOutAddr;
volatile uint32_t MailboxOutPosCur;
volatile uint32_t MailboxInAddr;
volatile uint32_t MailboxInPosCur;
volatile uint32_t MailboxReq;
volatile uint32_t BIOSMailboxInit;
volatile uint32_t BIOSMailboxCount;
volatile uint32_t BIOSMailboxOutAddr;
volatile uint32_t BIOSMailboxOutPosCur;
volatile uint32_t BIOSMailboxReq;
volatile uint32_t Residue;
volatile uint32_t card_bus; /* Basically a copy of device flags */
/* 8 bytes */
uint64_t temp_period;
/* 16 bytes */
double media_period, ha_bps; /* bytes per second */
double media_period;
double ha_bps; /* bytes per second */
/* 8 bytes */
char *bios_path, /* path to BIOS image file */
*mcode_path, /* path to microcode image file, needed by the AHA-1542CP */
*nvr_path; /* path to NVR image file */
char *bios_path; /* path to BIOS image file */
char *mcode_path; /* path to microcode image file, needed by the AHA-1542CP */
char *nvr_path; /* path to NVR image file */
/* 56 bytes */
/* Pointer to a structure of vendor-specific data that only the vendor-specific code can understand */
@@ -486,12 +504,13 @@ typedef struct {
/* Pointer to a function that resets vendor-specific data */
void (*ven_reset)(void *p);
rom_t bios, /* BIOS memory descriptor */
uppersck; /* BIOS memory descriptor */
rom_t bios; /* BIOS memory descriptor */
rom_t uppersck; /* BIOS memory descriptor */
mem_mapping_t mmio_mapping;
pc_timer_t timer, ResetCB;
pc_timer_t timer;
pc_timer_t ResetCB;
Req_t Req;

View File

@@ -48,21 +48,52 @@ struct serial_device_s;
struct serial_s;
typedef struct serial_s {
uint8_t lsr, thr, mctrl, rcr,
iir, ier, lcr, msr,
dat, int_status, scratch, fcr,
irq, type, inst, transmit_enabled,
fifo_enabled, rcvr_fifo_len, bits, data_bits,
baud_cycles, rcvr_fifo_full, txsr, pad;
uint8_t lsr;
uint8_t thr;
uint8_t mctrl;
uint8_t rcr;
uint8_t iir;
uint8_t ier;
uint8_t lcr;
uint8_t msr;
uint8_t dat;
uint8_t int_status;
uint8_t scratch;
uint8_t fcr;
uint8_t irq;
uint8_t type;
uint8_t inst;
uint8_t transmit_enabled;
uint8_t fifo_enabled;
uint8_t rcvr_fifo_len;
uint8_t bits;
uint8_t data_bits;
uint8_t baud_cycles;
uint8_t rcvr_fifo_full;
uint8_t txsr;
uint8_t out;
uint8_t msr_set;
uint8_t pad;
uint8_t pad0;
uint8_t pad1;
uint16_t dlab, base_address;
uint16_t dlab;
uint16_t base_address;
uint16_t out_new;
uint16_t pad2;
uint8_t rcvr_fifo_pos, xmit_fifo_pos,
pad0, pad1,
rcvr_fifo[SERIAL_FIFO_SIZE], xmit_fifo[SERIAL_FIFO_SIZE];
uint8_t rcvr_fifo_pos;
uint8_t xmit_fifo_pos;
uint8_t rcvr_fifo_end;
uint8_t xmit_fifo_end;
uint8_t rcvr_fifo[SERIAL_FIFO_SIZE];
uint8_t xmit_fifo[SERIAL_FIFO_SIZE];
pc_timer_t transmit_timer, timeout_timer;
double clock_src, transmit_period;
pc_timer_t transmit_timer;
pc_timer_t timeout_timer;
pc_timer_t receive_timer;
double clock_src;
double transmit_period;
struct serial_device_s *sd;
} serial_t;
@@ -70,11 +101,13 @@ typedef struct serial_s {
typedef struct serial_device_s {
void (*rcr_callback)(struct serial_s *serial, void *p);
void (*dev_write)(struct serial_s *serial, void *p, uint8_t data);
void (*lcr_callback)(struct serial_s *serial, void *p, uint8_t lcr);
void (*transmit_period_callback)(struct serial_s *serial, void *p, double transmit_period);
void *priv;
serial_t *serial;
} serial_device_t;
typedef struct {
typedef struct serial_port_s {
uint8_t enabled;
} serial_port_t;
@@ -84,6 +117,12 @@ extern serial_t *serial_attach(int port,
void (*rcr_callback)(struct serial_s *serial, void *p),
void (*dev_write)(struct serial_s *serial, void *p, uint8_t data),
void *priv);
extern serial_t *serial_attach_ex(int port,
void (*rcr_callback)(struct serial_s *serial, void *p),
void (*dev_write)(struct serial_s *serial, void *p, uint8_t data),
void (*transmit_period_callback)(struct serial_s *serial, void *p, double transmit_period),
void (*lcr_callback)(struct serial_s *serial, void *p, uint8_t data_bits),
void *priv);
extern void serial_remove(serial_t *dev);
extern void serial_set_type(serial_t *dev, int type);
extern void serial_setup(serial_t *dev, uint16_t addr, uint8_t irq);
@@ -93,6 +132,11 @@ extern void serial_set_next_inst(int ni);
extern void serial_standalone_init(void);
extern void serial_set_clock_src(serial_t *dev, double clock_src);
extern void serial_reset_port(serial_t *dev);
extern void serial_device_timeout(void *priv);
extern void serial_set_cts(serial_t *dev, uint8_t enabled);
extern void serial_set_dsr(serial_t *dev, uint8_t enabled);
extern void serial_set_dcd(serial_t *dev, uint8_t enabled);
extern const device_t ns8250_device;
extern const device_t ns8250_pcjr_device;

View File

@@ -0,0 +1,63 @@
/*
* 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.
*
* Definition of Serial passthrough device.
*
*
* 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 SERIAL_PASSTHROUGH_H
#define SERIAL_PASSTHROUGH_H
#include <stdint.h>
#include <stdbool.h>
#include <86box/86box.h>
#include <86box/device.h>
#include <86box/timer.h>
#include <86box/serial.h>
enum serial_passthrough_mode {
SERPT_MODE_VCON, /*Named Pipe (Server) / Pseudo Terminal/Virtual Console */
SERPT_MODE_TCPSRV, /* TCP Server (TODO) */
SERPT_MODE_TCPCLNT, /* TCP Client (TODO) */
SERPT_MODE_HOSTSER, /* Host Serial Passthrough */
SERPT_MODES_MAX,
};
extern const char *serpt_mode_names[SERPT_MODES_MAX];
typedef struct serial_passthrough_s {
enum serial_passthrough_mode mode;
pc_timer_t host_to_serial_timer;
pc_timer_t serial_to_host_timer;
serial_t *serial;
double baudrate;
uint8_t bits;
uint8_t data_bits;
uint8_t port;
uint8_t data;
char slave_pt[32]; /* used for pseudo term name of slave side */
intptr_t master_fd; /* file desc for master pseudo terminal or
* socket or alike */
char host_serial_path[1024]; /* Path to TTY/host serial port on the host */
char named_pipe[1024]; /* (Windows only) Name of the pipe. */
void *backend_priv; /* Private platform backend data */
} serial_passthrough_t;
extern bool serial_passthrough_enabled[SERIAL_MAX];
extern const device_t serial_passthrough_device;
extern void serial_passthrough_init(void);
#endif

View File

@@ -26,27 +26,39 @@
enum {
SMBUS_PIIX4 = 0,
SMBUS_VIA
SMBUS_VIA = 1
};
typedef struct {
uint32_t local;
uint16_t io_base;
int clock;
double bit_period;
uint8_t stat, next_stat, ctl, cmd, addr,
data0, data1,
index, data[SMBUS_PIIX4_BLOCK_DATA_SIZE];
typedef struct smbus_piix4_t {
uint32_t local;
uint16_t io_base;
int clock;
double bit_period;
uint8_t stat;
uint8_t next_stat;
uint8_t ctl;
uint8_t cmd;
uint8_t addr;
uint8_t data0;
uint8_t data1;
uint8_t index;
uint8_t data[SMBUS_PIIX4_BLOCK_DATA_SIZE];
pc_timer_t response_timer;
void *i2c;
} smbus_piix4_t;
typedef struct {
uint32_t local;
uint16_t io_base;
uint8_t stat, next_stat, ctl, cmd, addr,
data0, data1,
index, data[SMBUS_ALI7101_BLOCK_DATA_SIZE];
typedef struct smbus_ali7101_t {
uint32_t local;
uint16_t io_base;
uint8_t stat;
uint8_t next_stat;
uint8_t ctl;
uint8_t cmd;
uint8_t addr;
uint8_t data0;
uint8_t data1;
uint8_t index;
uint8_t data[SMBUS_ALI7101_BLOCK_DATA_SIZE];
pc_timer_t response_timer;
void *i2c;
} smbus_ali7101_t;

View File

@@ -19,13 +19,16 @@
#define EMU_SMRAM_H
typedef struct _smram_ {
struct _smram_ *prev, *next;
struct _smram_ *prev;
struct _smram_ *next;
mem_mapping_t mapping;
uint32_t host_base, ram_base,
size,
old_host_base, old_size;
uint32_t host_base;
uint32_t ram_base;
uint32_t size;
uint32_t old_host_base;
uint32_t old_size;
} smram_t;
/* Make a backup copy of host_base and size of all the SMRAM structs, needed so that if

View File

@@ -93,25 +93,33 @@
/* New codecs should be added to the end of this enum to avoid breaking configs. */
enum {
AC97_CODEC_AD1881 = 0,
AC97_CODEC_ALC100,
AC97_CODEC_CS4297,
AC97_CODEC_CS4297A,
AC97_CODEC_WM9701A,
AC97_CODEC_STAC9708,
AC97_CODEC_STAC9721,
AC97_CODEC_AK4540
AC97_CODEC_AD1881 = 0,
AC97_CODEC_ALC100 = 1,
AC97_CODEC_CS4297 = 2,
AC97_CODEC_CS4297A = 3,
AC97_CODEC_WM9701A = 4,
AC97_CODEC_STAC9708 = 5,
AC97_CODEC_STAC9721 = 6,
AC97_CODEC_AK4540 = 7
};
typedef struct {
const uint16_t index, value, write_mask;
typedef struct ac97_vendor_reg_t {
const uint16_t index;
const uint16_t value;
const uint16_t write_mask;
} ac97_vendor_reg_t;
typedef struct {
uint32_t vendor_id, min_rate, max_rate, misc_flags;
uint16_t reset_flags, extid_flags,
powerdown_mask, regs[64];
uint8_t codec_id, vendor_reg_page_max;
typedef struct ac97_codec_t {
uint32_t vendor_id;
uint32_t min_rate;
uint32_t max_rate;
uint32_t misc_flags;
uint16_t reset_flags;
uint16_t extid_flags;
uint16_t powerdown_mask;
uint16_t regs[64];
uint8_t codec_id;
uint8_t vendor_reg_page_max;
const ac97_vendor_reg_t *vendor_regs;
uint16_t *vendor_reg_pages;
} ac97_codec_t;
@@ -131,9 +139,12 @@ extern void ac97_via_remap_modem_sgd(void *priv, uint16_t new_io_base, uint8_
extern void ac97_via_remap_audio_codec(void *priv, uint16_t new_io_base, uint8_t enable);
extern void ac97_via_remap_modem_codec(void *priv, uint16_t new_io_base, uint8_t enable);
extern ac97_codec_t **ac97_codec, **ac97_modem_codec;
extern int ac97_codec_count, ac97_modem_codec_count,
ac97_codec_id, ac97_modem_codec_id;
extern ac97_codec_t **ac97_codec;
extern ac97_codec_t **ac97_modem_codec;
extern int ac97_codec_count;
extern int ac97_modem_codec_count;
extern int ac97_codec_id;
extern int ac97_modem_codec_id;
#ifdef EMU_DEVICE_H
extern const device_t ad1881_device;

View File

@@ -24,26 +24,42 @@
enum {
AD1848_TYPE_DEFAULT = 0,
AD1848_TYPE_CS4248,
AD1848_TYPE_CS4231,
AD1848_TYPE_CS4235,
AD1848_TYPE_CS4236
AD1848_TYPE_CS4248 = 1,
AD1848_TYPE_CS4231 = 2,
AD1848_TYPE_CS4235 = 3,
AD1848_TYPE_CS4236 = 4
};
typedef struct {
uint8_t type, index, xindex, regs[32], xregs[32], status; /* 16 original registers + 16 CS4231A extensions + 32 CS4236 extensions */
typedef struct ad1848_t {
uint8_t type;
uint8_t index;
uint8_t xindex;
uint8_t regs[32];
uint8_t xregs[32];
uint8_t status; /* 16 original registers + 16 CS4231A extensions + 32 CS4236 extensions */
int count;
uint8_t trd, mce, wten : 1;
uint8_t trd;
uint8_t mce;
uint8_t wten : 1;
int16_t out_l, out_r;
double cd_vol_l, cd_vol_r;
int fm_vol_l, fm_vol_r;
uint8_t fmt_mask, wave_vol_mask;
int16_t out_l;
int16_t out_r;
double cd_vol_l;
double cd_vol_r;
int fm_vol_l;
int fm_vol_r;
uint8_t fmt_mask;
uint8_t wave_vol_mask;
uint8_t enable : 1, irq : 4, dma : 3, adpcm_ref;
uint8_t enable : 1;
uint8_t irq : 4;
uint8_t dma : 3;
uint8_t adpcm_ref;
int8_t adpcm_step;
int freq, adpcm_data, adpcm_pos;
int freq;
int adpcm_data;
int adpcm_pos;
pc_timer_t timer_count;
uint64_t timer_latch;

View File

@@ -85,10 +85,14 @@ typedef struct emu8k_mem_pointers_t {
*/
typedef struct emu8k_envelope_t {
int state;
int32_t delay_samples, hold_samples, attack_samples;
int32_t value_amp_hz, value_db_oct;
int32_t delay_samples;
int32_t hold_samples;
int32_t attack_samples;
int32_t value_amp_hz;
int32_t value_db_oct;
int32_t sustain_value_db_oct;
int32_t attack_amount_amp_hz, ramp_amount_db_oct;
int32_t attack_amount_amp_hz;
int32_t ramp_amount_db_oct;
} emu8k_envelope_t;
typedef struct emu8k_chorus_eng_t {
@@ -320,10 +324,14 @@ typedef struct emu8k_voice_t {
emu8k_envelope_t vol_envelope;
emu8k_envelope_t mod_envelope;
int64_t lfo1_speed, lfo2_speed;
emu8k_mem_internal_t lfo1_count, lfo2_count;
int32_t lfo1_delay_samples, lfo2_delay_samples;
int vol_l, vol_r;
int64_t lfo1_speed;
int64_t lfo2_speed;
emu8k_mem_internal_t lfo1_count;
emu8k_mem_internal_t lfo2_count;
int32_t lfo1_delay_samples;
int32_t lfo2_delay_samples;
int vol_l;
int vol_r;
int16_t fixed_modenv_filter_height;
int16_t fixed_modenv_pitch_height;
@@ -342,28 +350,44 @@ typedef struct emu8k_voice_t {
typedef struct emu8k_t {
emu8k_voice_t voice[32];
uint16_t hwcf1, hwcf2, hwcf3;
uint32_t hwcf4, hwcf5, hwcf6, hwcf7;
uint16_t hwcf1;
uint16_t hwcf2;
uint16_t hwcf3;
uint32_t hwcf4;
uint32_t hwcf5;
uint32_t hwcf6;
uint32_t hwcf7;
uint16_t init1[32], init2[32], init3[32], init4[32];
uint16_t init1[32];
uint16_t init2[32];
uint16_t init3[32];
uint16_t init4[32];
uint32_t smalr, smarr, smalw, smarw;
uint16_t smld_buffer, smrd_buffer;
uint32_t smalr;
uint32_t smarr;
uint32_t smalw;
uint32_t smarw;
uint16_t smld_buffer;
uint16_t smrd_buffer;
uint16_t wc;
uint16_t id;
/* The empty block is used to act as an unallocated memory returning zero. */
int16_t *ram, *rom, *empty;
int16_t *ram;
int16_t *rom;
int16_t *empty;
/* RAM pointers are a way to avoid checking ram boundaries on read */
int16_t *ram_pointers[0x100];
uint32_t ram_end_addr;
int cur_reg, cur_voice;
int cur_reg;
int cur_voice;
int16_t out_l, out_r;
int16_t out_l;
int16_t out_r;
emu8k_chorus_eng_t chorus_engine;
int32_t chorus_in_buffer[SOUNDBUFLEN];

View File

@@ -26,7 +26,7 @@
#define MPU401_VERSION 0x15
#define MPU401_REVISION 0x01
#define MPU401_QUEUE 64
#define MPU401_QUEUE 1024
#define MPU401_INPUT_QUEUE 1024
#define MPU401_TIMECONSTANT (60000000 / 1000.0f)
#define MPU401_RESETBUSY 27.0f
@@ -71,80 +71,119 @@ typedef enum RecState {
typedef struct mpu_t {
uint16_t addr;
int uart_mode, intelligent,
irq, midi_thru,
queue_pos, queue_used;
uint8_t rx_data, is_mca,
status,
queue[MPU401_QUEUE], pos_regs[8];
int uart_mode;
int intelligent;
int irq;
int midi_thru;
int queue_pos;
int queue_used;
uint8_t rx_data;
uint8_t is_mca;
uint8_t status;
uint8_t queue[MPU401_QUEUE];
uint8_t pos_regs[8];
MpuMode mode;
uint8_t rec_queue[MPU401_INPUT_QUEUE];
int rec_queue_pos, rec_queue_used;
int rec_queue_pos;
int rec_queue_used;
uint32_t ch_toref[16];
struct track {
int counter;
uint8_t value[3], sys_val,
vlength, length;
int counter;
uint8_t value[3];
uint8_t sys_val;
uint8_t vlength;
uint8_t length;
MpuDataType type;
} playbuf[8], condbuf;
struct {
int conductor, cond_req,
cond_set, block_ack,
playing, reset,
wsd, wsm, wsd_start,
run_irq, irq_pending,
track_req,
send_now, eoi_scheduled,
data_onoff, clock_to_host,
sync_in, sysex_in_finished,
rec_copy;
int conductor;
int cond_req;
int cond_set;
int block_ack;
int playing;
int reset;
int wsd;
int wsm;
int wsd_start;
int run_irq;
int irq_pending;
int track_req;
int send_now;
int eoi_scheduled;
int data_onoff;
int clock_to_host;
int sync_in;
int sysex_in_finished;
int rec_copy;
RecState rec;
uint8_t tmask, cmask,
amask,
last_rtcmd;
uint16_t midi_mask, req_mask;
uint32_t command_byte, cmd_pending,
track, old_track;
uint8_t tmask;
uint8_t cmask;
uint8_t amask;
uint8_t last_rtcmd;
uint16_t midi_mask;
uint16_t req_mask;
uint32_t command_byte;
uint32_t cmd_pending;
uint32_t track;
uint32_t old_track;
} state;
struct {
uint8_t timebase, old_timebase,
tempo, old_tempo,
tempo_rel, old_tempo_rel,
tempo_grad, cth_rate[4],
cth_mode, midimetro,
metromeas;
uint32_t cth_counter, cth_old,
rec_counter;
int32_t measure_counter, meas_old,
freq;
int ticks_in, active;
float freq_mod;
uint8_t timebase;
uint8_t old_timebase;
uint8_t tempo;
uint8_t old_tempo;
uint8_t tempo_rel;
uint8_t old_tempo_rel;
uint8_t tempo_grad;
uint8_t cth_rate[4];
uint8_t cth_mode;
uint8_t midimetro;
uint8_t metromeas;
uint32_t cth_counter;
uint32_t cth_old;
uint32_t rec_counter;
int32_t measure_counter;
int32_t meas_old;
int32_t freq;
int ticks_in;
int active;
float freq_mod;
} clock;
struct {
int all_thru, midi_thru,
sysex_thru, commonmsgs_thru,
modemsgs_in, commonmsgs_in,
bender_in, sysex_in,
allnotesoff_out, rt_affection,
rt_out, rt_in,
timing_in_stop, data_in_stop,
rec_measure_end;
int all_thru;
int midi_thru;
int sysex_thru;
int commonmsgs_thru;
int modemsgs_in;
int commonmsgs_in;
int bender_in;
int sysex_in;
int allnotesoff_out;
int rt_affection;
int rt_out;
int rt_in;
int timing_in_stop;
int data_in_stop;
int rec_measure_end;
uint8_t prchg_buf[16];
uint16_t prchg_mask;
} filter;
struct {
int on;
uint8_t chan, trmask;
uint8_t chan;
uint8_t trmask;
uint32_t key[4];
} chanref[5], inputref[16];
pc_timer_t mpu401_event_callback, mpu401_eoi_callback,
mpu401_reset_callback;
pc_timer_t mpu401_event_callback;
pc_timer_t mpu401_eoi_callback;
pc_timer_t mpu401_reset_callback;
void (*ext_irq_update)(void *priv, int set);
int (*ext_irq_pending)(void *priv);
void *priv;
} mpu_t;
extern int mpu401_standalone_enable, mpu401_already_loaded;
extern int mpu401_standalone_enable;
extern int mpu401_already_loaded;
extern const device_t mpu401_device;
extern const device_t mpu401_mca_device;

View File

@@ -18,20 +18,20 @@
#define SOUND_OPL_H
enum fm_type {
FM_YM3812 = 0,
FM_YMF262,
FM_YMF289B,
FM_YMF278B,
FM_MAX
FM_YM3812 = 0, /* OPL2 */
FM_YMF262 = 1, /* OPL3 */
FM_YMF289B = 2, /* OPL3-L */
FM_YMF278B = 3, /* OPL 4 */
FM_MAX = 4
};
enum fm_driver {
FM_DRV_NUKED = 0,
FM_DRV_YMFM,
FM_DRV_MAX
FM_DRV_YMFM = 1,
FM_DRV_MAX = 2
};
typedef struct {
typedef struct fm_drv_t {
uint8_t (*read)(uint16_t port, void *priv);
void (*write)(uint16_t port, uint8_t val, void *priv);
int32_t *(*update)(void *priv);

View File

@@ -48,16 +48,16 @@ typedef struct sb_ct1335_mixer_t {
/* SB PRO */
typedef struct sb_ct1345_mixer_t {
double master_l,
master_r;
double voice_l,
voice_r;
double fm_l,
fm_r;
double cd_l,
cd_r;
double line_l,
line_r;
double master_l;
double master_r;
double voice_l;
double voice_r;
double fm_l;
double fm_r;
double cd_l;
double cd_r;
double line_l;
double line_r;
double mic;
/*see sb_ct1745_mixer for values for input selector*/
int32_t input_selector;
@@ -76,23 +76,23 @@ typedef struct sb_ct1345_mixer_t {
/* SB16 and AWE32 */
typedef struct sb_ct1745_mixer_t {
double master_l,
master_r;
double voice_l,
voice_r;
double fm_l,
fm_r;
double cd_l,
cd_r;
double line_l,
line_r;
double master_l;
double master_r;
double voice_l;
double voice_r;
double fm_l;
double fm_r;
double cd_l;
double cd_r;
double line_l;
double line_r;
double mic;
double speaker;
int bass_l,
bass_r;
int treble_l,
treble_r;
int bass_l;
int bass_r;
int treble_l;
int treble_r;
int output_selector;
#define OUTPUT_MIC 1
@@ -125,12 +125,12 @@ typedef struct sb_ct1745_mixer_t {
} sb_ct1745_mixer_t;
typedef struct sb_t {
uint8_t cms_enabled,
opl_enabled,
mixer_enabled;
uint8_t cms_enabled;
uint8_t opl_enabled;
uint8_t mixer_enabled;
cms_t cms;
fm_drv_t opl,
opl2;
fm_drv_t opl;
fm_drv_t opl2;
sb_dsp_t dsp;
union {
sb_ct1335_mixer_t mixer_sb2;
@@ -143,8 +143,8 @@ typedef struct sb_t {
int pos;
uint8_t pos_regs[8],
pnp_rom[512];
uint8_t pos_regs[8];
uint8_t pnp_rom[512];
uint16_t opl_pnp_addr;

View File

@@ -15,19 +15,34 @@ typedef struct sb_dsp_t {
int sb_subtype; /* which clone */
void *parent; /* "sb_t *" if default subtype, "azt2316a_t *" if aztech. */
int sb_8_length, sb_8_origlength, sb_8_format, sb_8_autoinit, sb_8_pause, sb_8_enable, sb_8_autolen, sb_8_output;
int sb_8_length;
int sb_8_origlength;
int sb_8_format;
int sb_8_autoinit;
int sb_8_pause;
int sb_8_enable;
int sb_8_autolen;
int sb_8_output;
int sb_8_dmanum;
int sb_16_length, sb_16_origlength, sb_16_format, sb_16_autoinit, sb_16_pause, sb_16_enable, sb_16_autolen, sb_16_output;
int sb_16_length;
int sb_16_origlength;
int sb_16_format;
int sb_16_autoinit;
int sb_16_pause;
int sb_16_enable;
int sb_16_autolen;
int sb_16_output;
int sb_16_dmanum;
int sb_pausetime;
int (*dma_readb)(void *priv),
(*dma_readw)(void *priv),
(*dma_writeb)(void *priv, uint8_t val),
(*dma_writew)(void *priv, uint16_t val);
int (*dma_readb)(void *priv);
int (*dma_readw)(void *priv);
int (*dma_writeb)(void *priv, uint8_t val);
int (*dma_writew)(void *priv, uint16_t val);
void *dma_priv;
uint8_t sb_read_data[256];
int sb_read_wp, sb_read_rp;
int sb_read_wp;
int sb_read_rp;
int sb_speaker;
int muted;
@@ -41,8 +56,8 @@ typedef struct sb_dsp_t {
int midi_in_timestamp;
int sb_irqnum;
void (*irq_update)(void *priv, int set),
*irq_priv;
void (*irq_update)(void *priv, int set);
void *irq_priv;
uint8_t sbe2;
int sbe2count;
@@ -53,23 +68,30 @@ typedef struct sb_dsp_t {
int16_t sbdat;
int sbdat2;
int16_t sbdatl, sbdatr;
int16_t sbdatl;
int16_t sbdatr;
uint8_t sbref;
int8_t sbstep;
int sbdacpos;
int sbleftright, sbleftright_default;
int sbleftright;
int sbleftright_default;
int sbreset;
uint8_t sbreaddat;
uint8_t sb_command;
uint8_t sb_test;
int sb_timei, sb_timeo;
int sb_timei;
int sb_timeo;
int sb_irq8, sb_irq16, sb_irq401;
int sb_irqm8, sb_irqm16, sb_irqm401;
int sb_irq8;
int sb_irq16;
int sb_irq401;
int sb_irqm8;
int sb_irqm16;
int sb_irqm401;
uint8_t sb_asp_regs[256];
uint8_t sb_asp_mode;
@@ -79,11 +101,14 @@ typedef struct sb_dsp_t {
uint8_t sb_8051_ram[256];
int sbenable, sb_enable_i;
int sbenable;
int sb_enable_i;
pc_timer_t output_timer, input_timer;
pc_timer_t output_timer;
pc_timer_t input_timer;
double sblatcho, sblatchi;
double sblatcho;
double sblatchi;
uint16_t sb_addr;

View File

@@ -14,8 +14,10 @@ extern int sn76489_mute;
typedef struct sn76489_t {
int stat[4];
int latch[4], count[4];
int freqlo[4], freqhi[4];
int latch[4];
int count[4];
int freqlo[4];
int freqhi[4];
int vol[4];
uint32_t shift;
uint8_t noise;

View File

@@ -23,7 +23,8 @@
extern int speaker_mute;
extern int speaker_gated;
extern int speaker_enable, was_speaker_enable;
extern int speaker_enable;
extern int was_speaker_enable;
extern void speaker_init(void);

View File

@@ -2,19 +2,26 @@
#define SOUND_YM7128_H
typedef struct ym7128_t {
int a0, sci;
int a0;
int sci;
uint8_t dat;
int reg_sel;
uint8_t regs[32];
int gl[8], gr[8];
int vm, vc, vl, vr;
int c0, c1;
int gl[8];
int gr[8];
int vm;
int vc;
int vl;
int vr;
int c0;
int c1;
int t[9];
int16_t filter_dat;
int16_t prev_l, prev_r;
int16_t prev_l;
int16_t prev_r;
int16_t delay_buffer[2400];
int delay_pos;

View File

@@ -24,9 +24,16 @@
extern int sound_gain;
#define SOUNDBUFLEN (48000 / 50)
#define FREQ_44100 44100
#define FREQ_48000 48000
#define FREQ_49716 49716
#define FREQ_88200 88200
#define FREQ_96000 96000
#define CD_FREQ 44100
#define SOUND_FREQ FREQ_48000
#define SOUNDBUFLEN (SOUND_FREQ / 50)
#define CD_FREQ FREQ_44100
#define CD_BUFLEN (CD_FREQ / 10)
enum {
@@ -35,9 +42,9 @@ enum {
};
extern int ppispeakon;
extern int gated,
speakval,
speakon;
extern int gated;
extern int speakval;
extern int speakon;
extern int sound_pos_global;
extern int sound_card_current[SOUND_CARD_MAX];
@@ -55,7 +62,7 @@ extern const device_t *sound_card_getdevice(int card);
#endif
extern int sound_card_has_config(int card);
extern char *sound_card_get_internal_name(int card);
extern int sound_card_get_from_internal_name(char *s);
extern int sound_card_get_from_internal_name(const char *s);
extern void sound_card_init(void);
extern void sound_set_cd_volume(unsigned int vol_l, unsigned int vol_r);

View File

@@ -46,49 +46,92 @@
#define SPD_SDR_ATTR_VCC_LOW_5 0x10
#define SPD_SDR_ATTR_VCC_HI_5 0x20
typedef struct {
uint8_t bytes_used, spd_size, mem_type,
row_bits, col_bits, banks,
data_width_lsb, data_width_msb,
signal_level, trac, tcac,
config, refresh_rate,
dram_width, ecc_width,
reserved[47],
spd_rev, checksum,
mfg_jedec[8], mfg_loc;
typedef struct spd_edo_t {
uint8_t bytes_used;
uint8_t spd_size;
uint8_t mem_type;
uint8_t row_bits;
uint8_t col_bits;
uint8_t banks;
uint8_t data_width_lsb;
uint8_t data_width_msb;
uint8_t signal_level;
uint8_t trac;
uint8_t tcac;
uint8_t config;
uint8_t refresh_rate;
uint8_t dram_width;
uint8_t ecc_width;
uint8_t reserved[47];
uint8_t spd_rev;
uint8_t checksum;
uint8_t mfg_jedec[8];
uint8_t mfg_loc;
char part_no[18];
uint8_t rev_code[2],
mfg_year, mfg_week, serial[4], mfg_specific[27],
vendor_specific[2],
other_data[127],
checksum2;
uint8_t rev_code[2];
uint8_t mfg_year;
uint8_t mfg_week;
uint8_t serial[4];
uint8_t mfg_specific[27];
uint8_t vendor_specific[2];
uint8_t other_data[127];
uint8_t checksum2;
} spd_edo_t;
typedef struct {
uint8_t bytes_used, spd_size, mem_type,
row_bits, col_bits, rows,
data_width_lsb, data_width_msb,
signal_level, tclk, tac,
config, refresh_rate,
sdram_width, ecc_width,
tccd, burst, banks, cas, cslat, we,
mod_attr, dev_attr,
tclk2, tac2, tclk3, tac3,
trp, trrd, trcd, tras,
bank_density,
ca_setup, ca_hold, data_setup, data_hold,
reserved[26],
spd_rev, checksum,
mfg_jedec[8], mfg_loc;
typedef struct spd_sdram_t {
uint8_t bytes_used;
uint8_t spd_size;
uint8_t mem_type;
uint8_t row_bits;
uint8_t col_bits;
uint8_t rows;
uint8_t data_width_lsb;
uint8_t data_width_msb;
uint8_t signal_level;
uint8_t tclk;
uint8_t tac;
uint8_t config;
uint8_t refresh_rate;
uint8_t sdram_width;
uint8_t ecc_width;
uint8_t tccd;
uint8_t burst;
uint8_t banks;
uint8_t cas;
uint8_t cslat;
uint8_t we;
uint8_t mod_attr;
uint8_t dev_attr;
uint8_t tclk2;
uint8_t tac2;
uint8_t tclk3;
uint8_t tac3;
uint8_t trp;
uint8_t trrd;
uint8_t trcd;
uint8_t tras;
uint8_t bank_density;
uint8_t ca_setup;
uint8_t ca_hold;
uint8_t data_setup;
uint8_t data_hold;
uint8_t reserved[26];
uint8_t spd_rev, checksum;
uint8_t mfg_jedec[8];
uint8_t mfg_loc;
char part_no[18];
uint8_t rev_code[2],
mfg_year, mfg_week, serial[4], mfg_specific[27],
freq, features,
other_data[127],
checksum2;
uint8_t rev_code[2];
uint8_t mfg_year;
uint8_t mfg_week;
uint8_t serial[4];
uint8_t mfg_specific[27];
uint8_t freq;
uint8_t features;
uint8_t other_data[127];
uint8_t checksum2;
} spd_sdram_t;
typedef struct {
typedef struct spd_t {
uint8_t slot;
uint16_t size;
uint16_t row1;

View File

@@ -11,14 +11,14 @@
#define TIMER_ENABLED 1
#pragma pack(push, 1)
typedef struct
typedef struct ts_struct_t
{
uint32_t frac;
uint32_t integer;
} ts_struct_t;
#pragma pack(pop)
typedef union {
typedef union ts_t {
uint64_t ts64;
ts_struct_t ts32;
} ts_t;
@@ -42,14 +42,16 @@ typedef struct pc_timer_t {
#else
ts_t ts;
#endif
int flags, pad; /* The flags are defined above. */
double period; /* This is used for large period timers to count
the microseconds and split the period. */
int flags; /* The flags are defined above. */
int pad;
double period; /* This is used for large period timers to count
the microseconds and split the period. */
void (*callback)(void *p);
void *p;
struct pc_timer_t *prev, *next;
struct pc_timer_t *prev;
struct pc_timer_t *next;
} pc_timer_t;
#ifdef __cplusplus

View File

@@ -61,6 +61,7 @@ extern void ui_check_menu_item(int id, int checked);
extern wchar_t *ui_window_title(wchar_t *s);
extern void ui_status_update(void);
extern void ui_hard_reset_completed(void);
extern void ui_init_monitor(int monitor_index);
extern void ui_deinit_monitor(int monitor_index);
extern int ui_sb_find_part(int tag);

View File

@@ -22,21 +22,188 @@
extern "C" {
#endif
typedef struct
typedef struct usb_t usb_t;
typedef struct usb_device_t usb_device_t;
enum usb_pid
{
uint8_t uhci_io[32], ohci_mmio[4096];
USB_PID_OUT = 0xE1,
USB_PID_IN = 0x69,
USB_PID_SETUP = 0x2D
};
enum usb_errors
{
USB_ERROR_NO_ERROR = 0,
USB_ERROR_NAK = 1,
USB_ERROR_OVERRUN = 2,
USB_ERROR_UNDERRUN = 3
};
enum usb_bus_types
{
USB_BUS_OHCI = 0,
USB_BUS_UHCI = 1,
USB_BUS_MAX = 2
};
/* USB device creation parameters struct */
typedef struct usb_params_t
{
void (*update_interrupt)(usb_t*, void*);
/* Handle (but do not raise) SMI. Returns 1 if SMI can be raised, 0 otherwise. */
uint8_t (*smi_handle)(usb_t*, void*);
void* parent_priv;
} usb_params_t;
typedef union {
uint32_t l;
uint16_t w[2];
uint8_t b[4];
} ohci_mmio_t;
/* USB Host Controller device struct */
typedef struct usb_t {
uint8_t uhci_io[32];
ohci_mmio_t ohci_mmio[1024];
uint16_t uhci_io_base;
int uhci_enable, ohci_enable;
int uhci_enable;
int ohci_enable;
uint32_t ohci_mem_base;
uint32_t irq_level;
mem_mapping_t ohci_mmio_mapping;
pc_timer_t ohci_frame_timer;
pc_timer_t ohci_port_reset_timer[2];
uint8_t ohci_interrupt_counter : 3;
usb_device_t *ohci_devices[2];
usb_device_t *uhci_devices[2];
uint8_t ohci_usb_buf[4096];
uint8_t ohci_initial_start;
usb_params_t *usb_params;
} usb_t;
#pragma pack(push, 1)
/* Base USB descriptor struct. */
typedef struct usb_desc_base_t {
uint8_t bLength;
uint8_t bDescriptorType;
} usb_desc_base_t;
enum usb_desc_setup_req_types {
USB_SETUP_TYPE_DEVICE = 0x0,
USB_SETUP_TYPE_INTERFACE = 0x1,
USB_SETUP_TYPE_ENDPOING = 0x2,
USB_SETUP_TYPE_OTHER = 0x3,
};
#define USB_SETUP_TYPE_MAX 0x1F
#define USB_SETUP_DEV_TO_HOST 0x80
typedef struct usb_desc_setup_t {
uint8_t bmRequestType;
uint8_t bRequest;
uint16_t wValue;
uint16_t wIndex;
uint16_t wLength;
} usb_desc_setup_t;
typedef struct usb_desc_endpoint_t {
usb_desc_base_t base;
uint8_t bEndpointAddress;
uint8_t bmAttributes;
uint16_t wMaxPacketSize;
uint8_t bInterval;
} usb_desc_endpoint_t;
typedef struct usb_desc_hid_t {
usb_desc_base_t base;
uint16_t bcdHID;
uint8_t bCountryCode;
uint8_t bNumDescriptors;
uint8_t bDescriptorType;
uint16_t wDescriptorLength;
} usb_desc_hid_t;
typedef struct usb_desc_interface_t {
usb_desc_base_t base;
uint8_t bInterfaceNumber;
uint8_t bAlternateSetting;
uint8_t bNumEndpoints;
uint8_t bInterfaceClass;
uint8_t bInterfaceSubClass;
uint8_t bInterfaceProtocol;
uint8_t iInterface;
} usb_desc_interface_t;
typedef struct usb_desc_string_t {
usb_desc_base_t base;
uint16_t bString[];
} usb_desc_string_t;
typedef struct usb_desc_conf_t {
usb_desc_base_t base;
uint16_t wTotalLength;
uint8_t bNumInterfaces;
uint8_t bConfigurationValue;
uint8_t iConfiguration;
uint8_t bmAttributes;
uint8_t bMaxPower;
} usb_desc_conf_t;
typedef struct usb_desc_device_t {
usb_desc_base_t base;
uint16_t bcdUSB;
uint8_t bDeviceClass;
uint8_t bDeviceSubClass;
uint8_t bDeviceProtocol;
uint8_t bMaxPacketSize;
uint16_t idVendor;
uint16_t idProduct;
uint16_t bcdDevice;
uint8_t iManufacturer;
uint8_t iProduct;
uint8_t iSerialNumber;
uint8_t bNumConfigurations;
} usb_desc_device_t;
#pragma pack(pop)
/* USB endpoint device struct. Incomplete and unused. */
typedef struct usb_device_t {
usb_desc_device_t device_desc;
struct {
usb_desc_conf_t conf_desc;
usb_desc_base_t* other_descs[16];
} conf_desc_items;
/* General-purpose function for I/O. Non-zero value indicates error. */
uint8_t (*device_process)(void* priv, uint8_t* data, uint32_t *len, uint8_t pid_token, uint8_t endpoint, uint8_t underrun_not_allowed);
/* Device reset. */
void (*device_reset)(void* priv);
/* Get address. */
uint8_t (*device_get_address)(void* priv);
void* priv;
} usb_device_t;
/* Global variables. */
extern const device_t usb_device;
extern usb_t* usb_device_inst;
/* Functions. */
extern void uhci_update_io_mapping(usb_t *dev, uint8_t base_l, uint8_t base_h, int enable);
extern void ohci_update_mem_mapping(usb_t *dev, uint8_t base1, uint8_t base2, uint8_t base3, int enable);
/* Attach USB device to a port of a USB bus. Returns the port to which it got attached to. */
extern uint8_t usb_attach_device(usb_t *dev, usb_device_t* device, uint8_t bus_type);
/* Detach USB device from a port. */
extern void usb_detach_device(usb_t *dev, uint8_t port, uint8_t bus_type);
#ifdef __cplusplus
}

View File

@@ -83,6 +83,7 @@ typedef struct ibm8514_t {
} accel;
uint16_t test;
int ibm_mode;
int v_total, dispend, v_syncstart, split,
h_disp, h_disp_old, h_total, h_disp_time, rowoffset,
@@ -107,5 +108,6 @@ typedef struct ibm8514_t {
int blitter_busy;
uint64_t blitter_time;
uint64_t status_time;
int pitch;
} ibm8514_t;
#endif /*VIDEO_8514A_H*/

View File

@@ -113,6 +113,7 @@ extern int con, cursoron, cgablink;
extern int scrollcache;
extern uint8_t edatlookup[4][4];
extern uint8_t egaremap2bpp[256];
#if defined(EMU_MEM_H) && defined(EMU_ROM_H)
void ega_render_blank(ega_t *ega);
@@ -120,14 +121,8 @@ void ega_render_blank(ega_t *ega);
void ega_render_overscan_left(ega_t *ega);
void ega_render_overscan_right(ega_t *ega);
void ega_render_text_40(ega_t *ega);
void ega_render_text_80(ega_t *ega);
void ega_render_2bpp_lowres(ega_t *ega);
void ega_render_2bpp_highres(ega_t *ega);
void ega_render_4bpp_lowres(ega_t *ega);
void ega_render_4bpp_highres(ega_t *ega);
void ega_render_text(ega_t *ega);
void ega_render_graphics(ega_t *ega);
#endif
#endif /*VIDEO_EGA_H*/

View File

@@ -20,11 +20,11 @@
break; \
\
case VAR_WORD_MODE_MA13: \
out_addr = ((in_addr << 1) & 0x1fff8) | ((in_addr >> 13) & 0x4) | (in_addr & ~0x1ffff); \
out_addr = ((in_addr << 1) & 0x3fff8) | ((in_addr >> 13) & 0x4) | (in_addr & ~0x3ffff); \
break; \
\
case VAR_WORD_MODE_MA15: \
out_addr = ((in_addr << 1) & 0x1fff8) | ((in_addr >> 15) & 0x4) | (in_addr & ~0x1ffff); \
out_addr = ((in_addr << 1) & 0x3fff8) | ((in_addr >> 15) & 0x4) | (in_addr & ~0x3ffff); \
break; \
\
case VAR_DWORD_MODE: \
@@ -85,7 +85,7 @@ ega_recalc_remap_func(ega_t *ega)
func_nr = VAR_DWORD_MODE;
else if (ega->crtc[0x17] & 0x40)
func_nr = VAR_BYTE_MODE;
else if (ega->crtc[0x17] & 0x20)
else if ((ega->crtc[0x17] & 0x20) && ega->vram_limit > 64*1024)
func_nr = VAR_WORD_MODE_MA15;
else
func_nr = VAR_WORD_MODE_MA13;

View File

@@ -180,10 +180,18 @@ typedef struct svga_t {
monitor_t* monitor;
} svga_t;
extern int vga_on, ibm8514_on;
extern int vga_on;
extern int ibm8514_on;
extern void ibm8514_poll(ibm8514_t *dev, svga_t *svga);
extern void ibm8514_recalctimings(svga_t *svga);
extern uint8_t ibm8514_ramdac_in(uint16_t port, void *p);
extern void ibm8514_ramdac_out(uint16_t port, uint8_t val, void *p);
extern int ibm8514_cpu_src(svga_t *svga);
extern int ibm8514_cpu_dest(svga_t *svga);
extern void ibm8514_accel_out_pixtrans(svga_t *svga, uint16_t port, uint16_t val, int len);
extern void ibm8514_short_stroke_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, svga_t *svga, uint8_t ssv, int len);
extern void ibm8514_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, svga_t *svga, int len);
extern void xga_poll(xga_t *xga, svga_t *svga);
extern void xga_recalctimings(svga_t *svga);

View File

@@ -70,7 +70,8 @@ static __m128i xmm_01_w; // = 0x0001000100010001ull;
static __m128i xmm_ff_w; // = 0x00ff00ff00ff00ffull;
static __m128i xmm_ff_b; // = 0x00000000ffffffffull;
static __m128i alookup[257], aminuslookup[256];
static __m128i alookup[257];
static __m128i aminuslookup[256];
static __m128i minus_254; // = 0xff02ff02ff02ff02ull;
static __m128i bilinear_lookup[256 * 2];
static __m128i xmm_00_ff_w[2];

View File

@@ -69,9 +69,10 @@ static __m128i xmm_ff_w; // = 0x00ff00ff00ff00ffull;
static __m128i xmm_ff_b; // = 0x00000000ffffffffull;
static uint32_t zero = 0;
static double const_1_48 = (double) (1ull << 4);
static double const_1_48 = (double) (1ULL << 4);
static __m128i alookup[257], aminuslookup[256];
static __m128i alookup[257];
static __m128i aminuslookup[256];
static __m128i minus_254; // = 0xff02ff02ff02ff02ull;
static __m128i bilinear_lookup[256 * 2];
static __m128i xmm_00_ff_w[2];

View File

@@ -53,17 +53,25 @@ typedef union int_float {
} int_float;
typedef struct rgbvoodoo_t {
uint8_t b, g, r;
uint8_t b;
uint8_t g;
uint8_t r;
uint8_t pad;
} rgbvoodoo_t;
typedef struct rgba8_t {
uint8_t b, g, r, a;
uint8_t b;
uint8_t g;
uint8_t r;
uint8_t a;
} rgba8_t;
typedef union rgba_u {
struct
{
uint8_t b, g, r, a;
uint8_t b;
uint8_t g;
uint8_t r;
uint8_t a;
} rgba;
uint32_t u;
} rgba_u;
@@ -105,24 +113,53 @@ typedef struct
typedef struct voodoo_params_t {
int command;
int32_t vertexAx, vertexAy, vertexBx, vertexBy, vertexCx, vertexCy;
int32_t vertexAx;
int32_t vertexAy;
int32_t vertexBx;
int32_t vertexBy;
int32_t vertexCx;
int32_t vertexCy;
uint32_t startR, startG, startB, startZ, startA;
uint32_t startR;
uint32_t startG;
uint32_t startB;
uint32_t startZ;
uint32_t startA;
int32_t dBdX, dGdX, dRdX, dAdX, dZdX;
int32_t dBdX;
int32_t dGdX;
int32_t dRdX;
int32_t dAdX;
int32_t dZdX;
int32_t dBdY, dGdY, dRdY, dAdY, dZdY;
int32_t dBdY;
int32_t dGdY;
int32_t dRdY;
int32_t dAdY;
int32_t dZdY;
int64_t startW, dWdX, dWdY;
int64_t startW;
int64_t dWdX;
int64_t dWdY;
struct
{
int64_t startS, startT, startW, p1;
int64_t dSdX, dTdX, dWdX, p2;
int64_t dSdY, dTdY, dWdY, p3;
int64_t startS;
int64_t startT;
int64_t startW;
int64_t p1;
int64_t dSdX;
int64_t dTdX;
int64_t dWdX;
int64_t p2;
int64_t dSdY;
int64_t dTdY;
int64_t dWdY;
int64_t p3;
} tmu[2];
uint32_t color0, color1;
uint32_t color0;
uint32_t color1;
uint32_t fbzMode;
uint32_t fbzColorPath;
@@ -131,20 +168,26 @@ typedef struct voodoo_params_t {
rgbvoodoo_t fogColor;
struct
{
uint8_t fog, dfog;
uint8_t fog;
uint8_t dfog;
} fogTable[64];
uint32_t alphaMode;
uint32_t zaColor;
int chromaKey_r, chromaKey_g, chromaKey_b;
int chromaKey_r;
int chromaKey_g;
int chromaKey_b;
uint32_t chromaKey;
uint32_t textureMode[2];
uint32_t tLOD[2];
uint32_t texBaseAddr[2], texBaseAddr1[2], texBaseAddr2[2], texBaseAddr38[2];
uint32_t texBaseAddr[2];
uint32_t texBaseAddr1[2];
uint32_t texBaseAddr2[2];
uint32_t texBaseAddr38[2];
uint32_t tex_base[2][LOD_MAX + 2];
uint32_t tex_end[2][LOD_MAX + 2];
@@ -155,14 +198,23 @@ typedef struct voodoo_params_t {
int tex_shift[2][LOD_MAX + 2];
int tex_lod[2][LOD_MAX + 2];
int tex_entry[2];
int detail_max[2], detail_bias[2], detail_scale[2];
int detail_max[2];
int detail_bias[2];
int detail_scale[2];
uint32_t draw_offset, aux_offset;
uint32_t draw_offset;
uint32_t aux_offset;
int tformat[2];
int clipLeft, clipRight, clipLowY, clipHighY;
int clipLeft1, clipRight1, clipLowY1, clipHighY1;
int clipLeft;
int clipRight;
int clipLowY;
int clipHighY;
int clipLeft1;
int clipRight1;
int clipLowY1;
int clipHighY1;
int sign;
@@ -172,31 +224,46 @@ typedef struct voodoo_params_t {
uint32_t stipple;
int col_tiled, aux_tiled;
int row_width, aux_row_width;
int col_tiled;
int aux_tiled;
int row_width;
int aux_row_width;
} voodoo_params_t;
typedef struct texture_t {
uint32_t base;
uint32_t tLOD;
atomic_int refcount, refcount_r[4];
atomic_int refcount;
atomic_int refcount_r[4];
int is16;
uint32_t palette_checksum;
uint32_t addr_start[4], addr_end[4];
uint32_t addr_start[4];
uint32_t addr_end[4];
uint32_t *data;
} texture_t;
typedef struct vert_t {
float sVx, sVy;
float sRed, sGreen, sBlue, sAlpha;
float sVz, sWb;
float sW0, sS0, sT0;
float sW1, sS1, sT1;
float sVx;
float sVy;
float sRed;
float sGreen;
float sBlue;
float sAlpha;
float sVz;
float sWb;
float sW0;
float sS0;
float sT0;
float sW1;
float sS1;
float sT1;
} vert_t;
typedef struct clip_t {
int x_min, x_max;
int y_min, y_max;
int x_min;
int x_max;
int y_min;
int y_max;
} clip_t;
typedef struct voodoo_t {
@@ -205,7 +272,8 @@ typedef struct voodoo_t {
int pci_enable;
uint8_t dac_data[8];
int dac_reg, dac_reg_ff;
int dac_reg;
int dac_reg_ff;
uint8_t dac_readdata;
uint16_t dac_pll_regs[16];
@@ -214,8 +282,14 @@ typedef struct voodoo_t {
voodoo_params_t params;
uint32_t fbiInit0, fbiInit1, fbiInit2, fbiInit3, fbiInit4;
uint32_t fbiInit5, fbiInit6, fbiInit7; /*Voodoo 2*/
uint32_t fbiInit0;
uint32_t fbiInit1;
uint32_t fbiInit2;
uint32_t fbiInit3;
uint32_t fbiInit4;
uint32_t fbiInit5;
uint32_t fbiInit6;
uint32_t fbiInit7; /*Voodoo 2*/
uint32_t initEnable;
@@ -223,18 +297,28 @@ typedef struct voodoo_t {
uint32_t memBaseAddr;
int_float fvertexAx, fvertexAy, fvertexBx, fvertexBy, fvertexCx, fvertexCy;
int_float fvertexAx;
int_float fvertexAy;
int_float fvertexBx;
int_float fvertexBy;
int_float fvertexCx;
int_float fvertexCy;
uint32_t front_offset, back_offset;
uint32_t front_offset;
uint32_t back_offset;
uint32_t fb_read_offset, fb_write_offset;
uint32_t fb_read_offset;
uint32_t fb_write_offset;
int row_width, aux_row_width;
int row_width;
int aux_row_width;
int block_width;
int col_tiled, aux_tiled;
int col_tiled;
int aux_tiled;
uint8_t *fb_mem, *tex_mem[2];
uint8_t *fb_mem;
uint8_t *tex_mem[2];
uint16_t *tex_mem_w[2];
int rgb_sel;
@@ -246,7 +330,8 @@ typedef struct voodoo_t {
mutex_t *swap_mutex;
int swap_count;
int disp_buffer, draw_buffer;
int disp_buffer;
int draw_buffer;
pc_timer_t timer;
int line;
@@ -254,15 +339,20 @@ typedef struct voodoo_t {
uint32_t backPorch;
uint32_t videoDimensions;
uint32_t hSync, vSync;
uint32_t hSync;
uint32_t vSync;
int h_total, v_total, v_disp;
int h_total;
int v_total;
int v_disp;
int h_disp;
int v_retrace;
struct
{
uint32_t y[4], i[4], q[4];
uint32_t y[4];
uint32_t i[4];
uint32_t q[4];
} nccTable[2][2];
rgba_u palette[2][256];
@@ -284,9 +374,15 @@ typedef struct voodoo_t {
int render_threads;
int odd_even_mask;
int pixel_count[4], texel_count[4], tri_count, frame_count;
int pixel_count_old[4], texel_count_old[4];
int wr_count, rd_count, tex_count;
int pixel_count[4];
int texel_count[4];
int tri_count;
int frame_count;
int pixel_count_old[4];
int texel_count_old[4];
int wr_count;
int rd_count;
int tex_count;
int retrace_count;
int swap_interval;
@@ -306,18 +402,27 @@ typedef struct voodoo_t {
int type;
fifo_entry_t fifo[FIFO_SIZE];
atomic_int fifo_read_idx, fifo_write_idx;
atomic_int cmd_read, cmd_written, cmd_written_fifo;
atomic_int fifo_read_idx;
atomic_int fifo_write_idx;
atomic_int cmd_read;
atomic_int cmd_written;
atomic_int cmd_written_fifo;
voodoo_params_t params_buffer[PARAM_SIZE];
atomic_int params_read_idx[4], params_write_idx;
atomic_int params_read_idx[4];
atomic_int params_write_idx;
uint32_t cmdfifo_base, cmdfifo_end, cmdfifo_size;
int cmdfifo_rp, cmdfifo_ret_addr;
uint32_t cmdfifo_base;
uint32_t cmdfifo_end;
uint32_t cmdfifo_size;
int cmdfifo_rp;
int cmdfifo_ret_addr;
int cmdfifo_in_sub;
atomic_int cmdfifo_depth_rd, cmdfifo_depth_wr;
atomic_int cmdfifo_depth_rd;
atomic_int cmdfifo_depth_wr;
atomic_int cmdfifo_enabled;
uint32_t cmdfifo_amin, cmdfifo_amax;
uint32_t cmdfifo_amin;
uint32_t cmdfifo_amax;
int cmdfifo_holecount;
atomic_uint cmd_status;
@@ -346,21 +451,37 @@ typedef struct voodoo_t {
uint32_t bltSrcBaseAddr;
uint32_t bltDstBaseAddr;
int bltSrcXYStride, bltDstXYStride;
uint32_t bltSrcChromaRange, bltDstChromaRange;
int bltSrcChromaMinR, bltSrcChromaMinG, bltSrcChromaMinB;
int bltSrcChromaMaxR, bltSrcChromaMaxG, bltSrcChromaMaxB;
int bltDstChromaMinR, bltDstChromaMinG, bltDstChromaMinB;
int bltDstChromaMaxR, bltDstChromaMaxG, bltDstChromaMaxB;
int bltSrcXYStride;
int bltDstXYStride;
uint32_t bltSrcChromaRange;
uint32_t bltDstChromaRange;
int bltSrcChromaMinR;
int bltSrcChromaMinG;
int bltSrcChromaMinB;
int bltSrcChromaMaxR;
int bltSrcChromaMaxG;
int bltSrcChromaMaxB;
int bltDstChromaMinR;
int bltDstChromaMinG;
int bltDstChromaMinB;
int bltDstChromaMaxR;
int bltDstChromaMaxG;
int bltDstChromaMaxB;
int bltClipRight, bltClipLeft;
int bltClipHighY, bltClipLowY;
int bltClipRight;
int bltClipLeft;
int bltClipHighY;
int bltClipLowY;
int bltSrcX, bltSrcY;
int bltDstX, bltDstY;
int bltSizeX, bltSizeY;
int bltSrcX;
int bltSrcY;
int bltDstX;
int bltDstY;
int bltSizeX;
int bltSizeY;
int bltRop[4];
uint16_t bltColorFg, bltColorBg;
uint16_t bltColorFg;
uint16_t bltColorBg;
uint32_t bltCommand;
@@ -368,20 +489,28 @@ typedef struct voodoo_t {
struct
{
int dst_x, dst_y;
int dst_x;
int dst_y;
int cur_x;
int size_x, size_y;
int x_dir, y_dir;
int size_x;
int size_y;
int x_dir;
int y_dir;
int dst_stride;
} blt;
struct
{
uint32_t bresError0, bresError1;
uint32_t clip0Min, clip0Max;
uint32_t clip1Min, clip1Max;
uint32_t colorBack, colorFore;
uint32_t command, commandExtra;
uint32_t bresError0;
uint32_t bresError1;
uint32_t clip0Min;
uint32_t clip0Max;
uint32_t clip1Min;
uint32_t clip1Max;
uint32_t colorBack;
uint32_t colorFore;
uint32_t command;
uint32_t commandExtra;
uint32_t dstBaseAddr;
uint32_t dstFormat;
uint32_t dstSize;
@@ -396,20 +525,31 @@ typedef struct voodoo_t {
uint32_t colorPattern[64];
int bres_error_0, bres_error_1;
uint32_t colorPattern8[64], colorPattern16[64], colorPattern24[64];
int cur_x, cur_y;
int bres_error_0;
int bres_error_1;
uint32_t colorPattern8[64];
uint32_t colorPattern16[64];
uint32_t colorPattern24[64];
int cur_x;
int cur_y;
uint32_t dstBaseAddr_tiled;
uint32_t dstColorkeyMin, dstColorkeyMax;
int dstSizeX, dstSizeY;
int dstX, dstY;
uint32_t dstColorkeyMin;
uint32_t dstColorkeyMax;
int dstSizeX;
int dstSizeY;
int dstX;
int dstY;
int dst_stride;
int patoff_x, patoff_y;
int patoff_x;
int patoff_y;
uint8_t rops[4];
uint32_t srcBaseAddr_tiled;
uint32_t srcColorkeyMin, srcColorkeyMax;
int srcSizeX, srcSizeY;
int srcX, srcY;
uint32_t srcColorkeyMin;
uint32_t srcColorkeyMax;
int srcSizeX;
int srcSizeY;
int srcX;
int srcY;
int src_stride;
int old_srcX;
@@ -418,39 +558,52 @@ typedef struct voodoo_t {
uint32_t old_host_data;
/*Polyfill coordinates*/
int lx[2], rx[2];
int ly[2], ry[2];
int lx[2];
int rx[2];
int ly[2];
int ry[2];
/*Polyfill state*/
int error[2];
int dx[2], dy[2];
int dx[2];
int dy[2];
int x_inc[2]; /*y_inc is always 1 for polyfill*/
int lx_cur, rx_cur;
int lx_cur;
int rx_cur;
clip_t clip[2];
uint8_t host_data[16384];
int host_data_count;
int host_data_size_src, host_data_size_dest;
int src_stride_src, src_stride_dest;
int host_data_size_src;
int host_data_size_dest;
int src_stride_src;
int src_stride_dest;
int src_bpp;
int line_pix_pos, line_bit_pos;
int line_rep_cnt, line_bit_mask_size;
int line_pix_pos;
int line_bit_pos;
int line_rep_cnt;
int line_bit_mask_size;
} banshee_blt;
struct
{
uint32_t vidOverlayStartCoords;
uint32_t vidOverlayEndScreenCoords;
uint32_t vidOverlayDudx, vidOverlayDudxOffsetSrcWidth;
uint32_t vidOverlayDvdy, vidOverlayDvdyOffset;
uint32_t vidOverlayDudx;
uint32_t vidOverlayDudxOffsetSrcWidth;
uint32_t vidOverlayDvdy;
uint32_t vidOverlayDvdyOffset;
// uint32_t vidDesktopOverlayStride;
int start_x, start_y;
int end_x, end_y;
int size_x, size_y;
int start_x;
int start_y;
int end_x;
int end_y;
int size_x;
int size_y;
int overlay_bytes;
unsigned int src_y;
@@ -462,17 +615,24 @@ typedef struct voodoo_t {
uint32_t video_16to32[0x10000];
uint8_t dirty_line[2048];
int dirty_line_low, dirty_line_high;
int dirty_line_low;
int dirty_line_high;
int fb_write_buffer, fb_draw_buffer;
int fb_write_buffer;
int fb_draw_buffer;
int buffer_cutoff;
uint32_t tile_base, tile_stride;
int tile_stride_shift, tile_x, tile_x_real;
uint32_t tile_base;
uint32_t tile_stride;
int tile_stride_shift;
int tile_x;
int tile_x_real;
int y_origin_swap;
int read_time, write_time, burst_time;
int read_time;
int write_time;
int burst_time;
pc_timer_t wake_timer;
@@ -501,9 +661,11 @@ typedef struct voodoo_t {
struct voodoo_set_t *set;
uint8_t fifo_thread_run, render_thread_run[4];
uint8_t fifo_thread_run;
uint8_t render_thread_run[4];
uint8_t *vram, *changedvram;
uint8_t *vram;
uint8_t *changedvram;
void *p;
uint8_t monitor_index;
@@ -517,7 +679,12 @@ typedef struct voodoo_set_t {
int nr_cards;
} voodoo_set_t;
extern rgba8_t rgb332[0x100], ai44[0x100], rgb565[0x10000], argb1555[0x10000], argb4444[0x10000], ai88[0x10000];
extern rgba8_t rgb332[0x100];
extern rgba8_t ai44[0x100];
extern rgba8_t rgb565[0x10000];
extern rgba8_t argb1555[0x10000];
extern rgba8_t argb4444[0x10000];
extern rgba8_t ai88[0x10000];
void voodoo_generate_vb_filters(voodoo_t *voodoo, int fcr, int fcg);

View File

@@ -22,7 +22,12 @@
typedef struct {
int ena;
int x, y, xoff, yoff, cur_xsize, cur_ysize;
int x;
int y;
int xoff;
int yoff;
int cur_xsize;
int cur_ysize;
uint32_t addr;
} xga_hwcursor_t;

View File

@@ -63,47 +63,54 @@ enum {
#define VIDEO_FLAG_TYPE_NONE 3
#define VIDEO_FLAG_TYPE_MASK 3
typedef struct {
typedef struct video_timings_t {
int type;
int write_b, write_w, write_l;
int read_b, read_w, read_l;
int write_b;
int write_w;
int write_l;
int read_b;
int read_w;
int read_l;
} video_timings_t;
typedef struct {
int w, h;
typedef struct bitmap_t {
int w;
int h;
uint32_t *dat;
uint32_t *line[2112];
} bitmap_t;
typedef struct {
uint8_t r, g, b;
typedef struct rgb_t {
uint8_t r;
uint8_t g;
uint8_t b;
} rgb_t;
typedef struct {
typedef struct dbcs_font_t {
uint8_t chr[32];
} dbcs_font_t;
struct blit_data_struct;
typedef struct monitor_t {
char name[512];
int mon_xsize;
int mon_ysize;
int mon_scrnsz_x;
int mon_scrnsz_y;
int mon_efscrnsz_y;
int mon_unscaled_size_x;
int mon_unscaled_size_y;
int mon_res_x;
int mon_res_y;
int mon_bpp;
bitmap_t *target_buffer;
int mon_video_timing_read_b,
mon_video_timing_read_w,
mon_video_timing_read_l;
int mon_video_timing_write_b,
mon_video_timing_write_w,
mon_video_timing_write_l;
char name[512];
int mon_xsize;
int mon_ysize;
int mon_scrnsz_x;
int mon_scrnsz_y;
int mon_efscrnsz_y;
int mon_unscaled_size_x;
int mon_unscaled_size_y;
int mon_res_x;
int mon_res_y;
int mon_bpp;
bitmap_t *target_buffer;
int mon_video_timing_read_b;
int mon_video_timing_read_w;
int mon_video_timing_read_l;
int mon_video_timing_write_b;
int mon_video_timing_write_w;
int mon_video_timing_write_l;
int mon_overscan_x;
int mon_overscan_y;
int mon_force_resize;
@@ -137,10 +144,14 @@ extern int video_fullscreen_scale_maximized;
typedef rgb_t PALETTE[256];
// extern int changeframecount;
#if 0
extern int changeframecount;
#endif
extern volatile int screenshots;
// extern bitmap_t *buffer32;
#if 0
extern bitmap_t *buffer32;
#endif
#define buffer32 (monitors[monitor_index_global].target_buffer)
#define pal_lookup (monitors[monitor_index_global].mon_pal_lookup)
#define overscan_x (monitors[monitor_index_global].mon_overscan_x)
@@ -163,12 +174,14 @@ extern volatile int screenshots;
#define efscrnsz_y (monitors[monitor_index_global].mon_efscrnsz_y)
#define unscaled_size_x (monitors[monitor_index_global].mon_unscaled_size_x)
#define unscaled_size_y (monitors[monitor_index_global].mon_unscaled_size_y)
extern PALETTE cgapal,
cgapal_mono[6];
// extern uint32_t pal_lookup[256];
extern int video_fullscreen,
video_fullscreen_scale,
video_fullscreen_first;
extern PALETTE cgapal;
extern PALETTE cgapal_mono[6];
#if 0
extern uint32_t pal_lookup[256];
#endif
extern int video_fullscreen;
extern int video_fullscreen_scale;
extern int video_fullscreen_first;
extern uint8_t fontdat[2048][8];
extern uint8_t fontdatm[2048][16];
extern uint8_t fontdatw[512][32];
@@ -176,23 +189,23 @@ extern uint8_t fontdat8x12[256][16];
extern uint8_t fontdat12x18[256][36];
extern dbcs_font_t *fontdatksc5601;
extern dbcs_font_t *fontdatksc5601_user;
extern uint32_t *video_6to8,
*video_8togs,
*video_8to32,
*video_15to32,
*video_16to32;
extern int enable_overscan;
extern int force_43;
extern int vid_resize;
extern int herc_blend;
extern int vid_cga_contrast;
extern int video_grayscale;
extern int video_graytype;
extern uint32_t *video_6to8;
extern uint32_t *video_8togs;
extern uint32_t *video_8to32;
extern uint32_t *video_15to32;
extern uint32_t *video_16to32;
extern int enable_overscan;
extern int force_43;
extern int vid_resize;
extern int herc_blend;
extern int vid_cga_contrast;
extern int video_grayscale;
extern int video_graytype;
extern double cpuclock;
extern int emu_fps,
frames;
extern int readflash;
extern int emu_fps;
extern int frames;
extern int readflash;
/* Function handler pointers. */
extern void (*video_recalctimings)(void);

View File

@@ -103,17 +103,21 @@ extern "C" {
#endif
extern HINSTANCE hinstance;
extern HWND hwndMain,
hwndRender,
hwndRender2;
extern HANDLE ghMutex;
extern HICON hIcon[256];
extern int dpi;
extern RECT oldclip;
extern int sbar_height, tbar_height, user_resize;
extern int acp_utf8;
extern HWND hwndMain;
extern HWND hwndRender;
extern HWND hwndRender2;
extern HANDLE ghMutex;
extern HICON hIcon[256];
extern int dpi;
extern RECT oldclip;
extern int sbar_height;
extern int tbar_height;
extern int user_resize;
extern int acp_utf8;
// extern int status_is_open;
#if 0
extern int status_is_open;
#endif
extern char openfilestring[512];
extern WCHAR wopenfilestring[512];

View File

@@ -17,7 +17,7 @@
#define WIN_OPENGL_H
#define UNICODE
#include <Windows.h>
#include <windows.h>
extern int opengl_init(HWND hwnd);
extern int opengl_pause(void);

View File

@@ -32,60 +32,75 @@
enum {
ZIP_BUS_DISABLED = 0,
ZIP_BUS_ATAPI = 5,
ZIP_BUS_SCSI,
ZIP_BUS_USB
ZIP_BUS_SCSI = 6,
ZIP_BUS_USB = 7
};
typedef struct {
typedef struct zip_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;
char image_path[1024],
prev_image_path[1024];
char image_path[1024];
char prev_image_path[1024];
uint32_t is_250, medium_size,
base;
uint32_t is_250;
uint32_t medium_size;
uint32_t base;
} zip_drive_t;
typedef struct {
typedef struct zip_t {
mode_sense_pages_t ms_pages_saved;
zip_drive_t *drv;
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;
uint8_t status;
uint8_t phase;
uint8_t error;
uint8_t id;
uint8_t features;
uint8_t cur_lun;
uint8_t pad0;
uint8_t pad1;
uint16_t request_length, max_transfer_len;
uint16_t request_length;
uint16_t max_transfer_len;
int requested_blocks, packet_status,
total_length, do_page_save,
unit_attention, request_pos,
old_len, pad3;
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, sector_len,
packet_len, pos;
uint32_t sector_pos;
uint32_t sector_len;
uint32_t packet_len;
uint32_t pos;
double callback;
} zip_t;

View File

@@ -9,7 +9,7 @@
#define _DISCORD_GAME_SDK_H_
#ifdef _WIN32
#include <Windows.h>
#include <windows.h>
#include <dxgi.h>
#endif