Merge branch 'master' into master

This commit is contained in:
Jose Phillips
2024-12-01 18:31:58 -05:00
committed by GitHub
490 changed files with 70062 additions and 34561 deletions

View File

@@ -21,7 +21,8 @@
#define EMU_86BOX_H
/* Configuration values. */
#define SERIAL_MAX 4
#define GFXCARD_MAX 2
#define SERIAL_MAX 7
#define PARALLEL_MAX 4
#define SCREEN_RES_X 640
#define SCREEN_RES_Y 480
@@ -124,7 +125,7 @@ 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 int gfxcard[GFXCARD_MAX]; /* (C) graphics/video card */
extern char video_shader[512]; /* (C) video */
extern int bugger_enabled; /* (C) enable ISAbugger */
extern int novell_keycard_enabled; /* (C) enable Novell NetWare 2.x key card emulation. */
@@ -152,6 +153,7 @@ extern int enable_discord; /* (C) enable Discord integration */
extern int other_ide_present; /* IDE controllers from non-IDE cards are present */
extern int other_scsi_present; /* SCSI controllers from non-SCSI cards are present */
extern int hard_reset_pending;
extern int fixed_size_x;
extern int fixed_size_y;
extern int do_auto_pause; /* (C) Auto-pause the emulator on focus loss */

View File

@@ -35,6 +35,8 @@
* USA.
*/
#ifndef __NetBSD__
#ifndef BSWAP_H
#define BSWAP_H
@@ -239,3 +241,5 @@ cpu_to_be32wu(uint32_t *p, uint32_t v)
#undef be_bswaps
#endif /*BSWAP_H*/
#endif

View File

@@ -21,7 +21,10 @@
extern "C" {
#endif
#define CART_IMAGE_HISTORY 4
extern char cart_fns[2][512];
extern char *cart_image_history[2][CART_IMAGE_HISTORY];
extern void cart_load(int drive, char *fn);
extern void cart_close(int drive);

View File

@@ -153,10 +153,13 @@ void pc_cas_print_state(const pc_cassette_t *cas);
void pc_cas_clock(pc_cassette_t *cas, unsigned long cnt);
void pc_cas_advance(pc_cassette_t *cas);
#define CASSETTE_IMAGE_HISTORY 4
extern pc_cassette_t *cassette;
extern char cassette_fname[512];
extern char cassette_mode[512];
extern char * cassette_image_history[CASSETTE_IMAGE_HISTORY];
extern unsigned long cassette_pos;
extern unsigned long cassette_srate;
extern int cassette_enable;

View File

@@ -25,6 +25,7 @@
#define CD_STATUS_PLAYING_COMPLETED 5
/* Medium changed flag. */
#define CD_STATUS_TRANSITION 0x40
#define CD_STATUS_MEDIUM_CHANGED 0x80
#define CD_TRACK_AUDIO 0x08
@@ -194,10 +195,25 @@ typedef struct track_info_t {
uint8_t f;
} track_info_t;
typedef struct raw_track_info_t {
uint8_t session;
uint8_t adr_ctl;
uint8_t tno;
uint8_t point;
uint8_t m;
uint8_t s;
uint8_t f;
uint8_t zero;
uint8_t pm;
uint8_t ps;
uint8_t pf;
} raw_track_info_t;
/* Define the various CD-ROM drive operations (ops). */
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_raw_track_info)(struct cdrom *dev, int *num, raw_track_info_t *rti);
void (*get_subchannel)(struct cdrom *dev, uint32_t lba, subchannel_t *subc);
int (*is_track_pre)(struct cdrom *dev, uint32_t lba);
int (*sector_size)(struct cdrom *dev, uint32_t lba);
@@ -226,7 +242,6 @@ typedef struct cdrom {
uint8_t speed;
uint8_t cur_speed;
int is_dir;
void *priv;
char image_path[1024];
@@ -248,7 +263,7 @@ typedef struct cdrom {
const cdrom_ops_t *ops;
void *image;
void *local;
void (*insert)(void *priv);
void (*close)(void *priv);
@@ -299,6 +314,7 @@ extern void cdrom_seek(cdrom_t *dev, uint32_t pos, uint8_t vendor_type);
extern void cdrom_close_handler(uint8_t id);
extern void cdrom_insert(uint8_t id);
extern void cdrom_exit(uint8_t id);
extern void cdrom_eject(uint8_t id);
extern void cdrom_reload(uint8_t id);

View File

@@ -53,9 +53,35 @@ typedef struct track_file_t {
char fn[260];
FILE *fp;
void *priv;
int motorola;
} track_file_t;
#define BLOCK_EMPTY 0 /* Empty block. */
#define BLOCK_ZERO 1 /* Block not in the file, return all 0x00's. */
#define BLOCK_NORMAL 2 /* Block in the file. */
#define BLOCK_NONE ((uint64_t) -1LL)
typedef struct track_block_t {
/* Is the current block in the file? If not, return all 0x00's. */
int type;
/* The amount of bytes to skip at the beginning of each sector. */
int skip;
/* Starting and ending sector LBA - negative in order to accomodate LBA -150 to -1
to read the pregap of track 1. */
int64_t start_sector;
int64_t end_sector;
/* Starting and ending offset in the file. */
uint64_t start_offs;
uint64_t end_offs;
} track_block_t;
typedef struct track_t {
int pregap_len; /* Pre-gap - not in file. */
int index0_len; /* Pre-gap - in file. */
int postgap_len; /* Post-gap - not in file. */
int blocks_num; /* Number of blocks. */
int number;
int track_number;
int attr;
@@ -63,10 +89,11 @@ typedef struct track_t {
int mode2;
int form;
int pre;
int pad;
int noskip; /* Do not skip by 8 bytes.*/
uint64_t start;
uint64_t length;
uint64_t skip;
track_block_t blocks[256];
track_file_t *file;
} track_t;

View File

@@ -39,6 +39,7 @@ extern const device_t amd640_device;
/* Compaq */
extern const device_t compaq_386_device;
extern const device_t compaq_genoa_device;
/* Contaq/Cypress */
extern const device_t contaq_82c596a_device;
@@ -110,8 +111,12 @@ extern const device_t ioapic_device;
/* OPTi */
extern const device_t opti283_device;
extern const device_t opti291_device;
extern const device_t opti381_device;
extern const device_t opti391_device;
extern const device_t opti481_device;
extern const device_t opti493_device;
extern const device_t opti495_device;
extern const device_t opti499_device;
extern const device_t opti601_device;
extern const device_t opti602_device;
extern const device_t opti802g_device;
@@ -190,7 +195,7 @@ extern const device_t nec_mate_unk_device;
extern const device_t phoenix_486_jumper_device;
extern const device_t phoenix_486_jumper_pci_device;
#if defined(DEV_BRANCH) && defined(USE_OLIVETTI)
#ifdef USE_OLIVETTI
extern const device_t olivetti_eva_device;
#endif
#endif /* USE_OLIVETTI */
#endif /*EMU_CHIPSET_H*/

View File

@@ -113,7 +113,8 @@ typedef struct config_t {
# endif
/* Other peripherals category */
int fdc_type; /* Floppy disk controller type */
int fdc_current[FDC_MAX]; /* Floppy disk controller type */
int hdc_current[HDC_MAX]; /* Hard disk controller type */
int hdc; /* Hard disk controller */
int scsi_card; /* SCSI controller */
int ide_ter_enabled; /* Tertiary IDE controller enabled */

View File

@@ -101,6 +101,7 @@ enum {
DEVICE_COM = 0x100000, /* requires a serial port */
DEVICE_LPT = 0x200000, /* requires a parallel port */
DEVICE_KBC = 0x400000, /* is a keyboard controller */
DEVICE_SOFTRESET = 0x800000, /* requires to be reset on soft reset */
DEVICE_ONBOARD = 0x40000000, /* is on-board */
DEVICE_PIT = 0x80000000, /* device is a PIT */
@@ -244,6 +245,9 @@ extern const char *device_get_internal_name(const device_t *dev);
extern int machine_get_config_int(char *s);
extern char *machine_get_config_string(char *s);
extern const device_t device_none;
extern const device_t device_internal;
#ifdef __cplusplus
}
#endif

View File

@@ -22,8 +22,6 @@
#ifndef EMU_FDC_H
#define EMU_FDC_H
extern int fdc_type;
#define FDC_PRIMARY_ADDR 0x03f0
#define FDC_PRIMARY_IRQ 6
#define FDC_PRIMARY_DMA 2
@@ -40,23 +38,23 @@ extern int fdc_type;
#define FDC_QUATERNARY_IRQ 6
#define FDC_QUATERNARY_DMA 2
#define FDC_FLAG_PCJR 0x01 /* PCjr */
#define FDC_FLAG_DISKCHG_ACTLOW 0x02 /* Amstrad, PS/1, PS/2 ISA */
#define FDC_FLAG_AT 0x04 /* AT+, PS/x */
#define FDC_FLAG_PS1 0x08 /* PS/1, PS/2 ISA */
#define FDC_FLAG_SUPERIO 0x10 /* Super I/O chips */
#define FDC_FLAG_START_RWC_1 0x20 /* W83877F, W83977F */
#define FDC_FLAG_MORE_TRACKS 0x40 /* W83877F, W83977F, PC87306, PC87309 */
#define FDC_FLAG_NSC 0x80 /* PC87306, PC87309 */
#define FDC_FLAG_TOSHIBA 0x100 /* T1000, T1200 */
#define FDC_FLAG_AMSTRAD 0x200 /* Non-AT Amstrad machines */
#define FDC_FLAG_UMC 0x400 /* UMC UM8398 */
#define FDC_FLAG_ALI 0x800 /* ALi M512x / M1543C */
#define FDC_FLAG_SEC 0x1000 /* Is Secondary */
#define FDC_FLAG_TER 0x2000 /* Is Tertiary */
#define FDC_FLAG_QUA 0x3000 /* Is Quaternary */
#define FDC_FLAG_CHANNEL 0x3000 /* Channel mask */
#define FDC_FLAG_NO_DSR_RESET 0x4000 /* Has no DSR reset */
#define FDC_FLAG_PCJR 0x01 /* PCjr */
#define FDC_FLAG_DISKCHG_ACTLOW 0x02 /* Amstrad, PS/1, PS/2 ISA */
#define FDC_FLAG_AT 0x04 /* AT+, PS/x */
#define FDC_FLAG_PS1 0x08 /* PS/1, PS/2 ISA */
#define FDC_FLAG_SUPERIO 0x10 /* Super I/O chips */
#define FDC_FLAG_START_RWC_1 0x20 /* W83877F, W83977F */
#define FDC_FLAG_MORE_TRACKS 0x40 /* W83877F, W83977F, PC87306, PC87309 */
#define FDC_FLAG_NSC 0x80 /* PC87306, PC87309 */
#define FDC_FLAG_TOSHIBA 0x100 /* T1000, T1200 */
#define FDC_FLAG_AMSTRAD 0x200 /* Non-AT Amstrad machines */
#define FDC_FLAG_UMC 0x400 /* UMC UM8398 */
#define FDC_FLAG_ALI 0x800 /* ALi M512x / M1543C */
#define FDC_FLAG_NO_DSR_RESET 0x1000 /* Has no DSR reset */
#define FDC_FLAG_NEC 0x2000 /* Is NEC upd765-compatible */
#define FDC_FLAG_SEC 0x10000 /* Is Secondary */
#define FDC_FLAG_TER 0x20000 /* Is Tertiary */
#define FDC_FLAG_QUA 0x40000 /* Is Quaternary */
typedef struct fdc_t {
uint8_t dor;
@@ -122,7 +120,7 @@ typedef struct fdc_t {
uint8_t params[15];
uint8_t specify[2];
uint8_t res[11];
uint8_t eot[4];
uint16_t eot[4];
uint8_t rwc[4];
uint16_t pcn[4];

View File

@@ -22,10 +22,13 @@
#ifndef EMU_FDC_EXT_H
#define EMU_FDC_EXT_H
extern int fdc_type;
#define FDC_MAX 2
extern int fdc_current[FDC_MAX];
/* Controller types. */
#define FDC_INTERNAL 0
#define FDC_NONE 0
#define FDC_INTERNAL 1
extern const device_t fdc_b215_device;
extern const device_t fdc_pii151b_device;
@@ -41,4 +44,4 @@ extern const device_t *fdc_card_getdevice(int card);
extern int fdc_card_has_config(int card);
extern int fdc_card_available(int card);
#endif /*EMU_FDC_H*/
#endif /*EMU_FDC_EXT_H*/

View File

@@ -69,28 +69,80 @@ extern uint8_t fifo8_pop(Fifo8 *fifo);
/**
* fifo8_pop_buf:
* @fifo: FIFO to pop from
* @max: maximum number of bytes to pop
* @num: actual number of returned bytes
* @dest: the buffer to write the data into (can be NULL)
* @destlen: size of @dest and maximum number of bytes to pop
*
* Pop a number of elements from the FIFO up to a maximum of max. The buffer
* Pop a number of elements from the FIFO up to a maximum of @destlen.
* The popped data is copied into the @dest buffer.
* Care is taken when the data wraps around in the ring buffer.
*
* Returns: number of bytes popped.
*/
extern uint32_t fifo8_pop_buf(Fifo8 *fifo, uint8_t *dest, uint32_t destlen);
/**
* fifo8_pop_bufptr:
* @fifo: FIFO to pop from
* @max: maximum number of bytes to pop
* @numptr: pointer filled with number of bytes returned (can be NULL)
*
* New code should prefer to use fifo8_pop_buf() instead of fifo8_pop_bufptr().
*
* Pop a number of elements from the FIFO up to a maximum of @max. The buffer
* containing the popped data is returned. This buffer points directly into
* the FIFO backing store and data is invalidated once any of the fifo8_* APIs
* are called on the FIFO.
* the internal FIFO backing store and data (without checking for overflow!)
* and is invalidated once any of the fifo8_* APIs are called on the FIFO.
*
* The function may return fewer bytes than requested when the data wraps
* around in the ring buffer; in this case only a contiguous part of the data
* is returned.
*
* The number of valid bytes returned is populated in *num; will always return
* at least 1 byte. max must not be 0 or greater than the number of bytes in
* the FIFO.
* The number of valid bytes returned is populated in *@numptr; will always
* return at least 1 byte. max must not be 0 or greater than the number of
* bytes in the FIFO.
*
* Clients are responsible for checking the availability of requested data
* using fifo8_num_used().
*
* Returns: A pointer to popped data.
*/
extern const uint8_t *fifo8_pop_buf(Fifo8 *fifo, uint32_t max, uint32_t *num);
extern const uint8_t *fifo8_pop_bufptr(Fifo8 *fifo, uint32_t max, uint32_t *numptr);
/**
* fifo8_peek_bufptr: read upto max bytes from the fifo
* @fifo: FIFO to read from
* @max: maximum number of bytes to peek
* @numptr: pointer filled with number of bytes returned (can be NULL)
*
* Peek into a number of elements from the FIFO up to a maximum of @max.
* The buffer containing the data peeked into is returned. This buffer points
* directly into the FIFO backing store. Since data is invalidated once any
* of the fifo8_* APIs are called on the FIFO, it is the caller responsibility
* to access it before doing further API calls.
*
* The function may return fewer bytes than requested when the data wraps
* around in the ring buffer; in this case only a contiguous part of the data
* is returned.
*
* The number of valid bytes returned is populated in *@numptr; will always
* return at least 1 byte. max must not be 0 or greater than the number of
* bytes in the FIFO.
*
* Clients are responsible for checking the availability of requested data
* using fifo8_num_used().
*
* Returns: A pointer to peekable data.
*/
extern const uint8_t *fifo8_peek_bufptr(Fifo8 *fifo, uint32_t max, uint32_t *numptr);
/**
* fifo8_drop:
* @fifo: FIFO to drop bytes
* @len: number of bytes to drop
*
* Drop (consume) bytes from a FIFO.
*/
extern void fifo8_drop(Fifo8 *fifo, uint32_t len);
/**
* fifo8_reset:

View File

@@ -32,7 +32,9 @@
#define HDC_NONE 0
#define HDC_INTERNAL 1
extern int hdc_current;
#define HDC_MAX 2
extern int hdc_current[HDC_MAX];
extern const device_t st506_xt_xebec_device; /* st506_xt_xebec */
extern const device_t st506_xt_wdxt_gen_device; /* st506_xt_wdxt_gen */

View File

@@ -197,12 +197,12 @@ extern int hdd_is_valid(int c);
extern void hdd_image_init(void);
extern int hdd_image_load(int id);
extern void hdd_image_seek(uint8_t id, uint32_t sector);
extern void hdd_image_read(uint8_t id, uint32_t sector, uint32_t count, uint8_t *buffer);
extern int hdd_image_seek(uint8_t id, uint32_t sector);
extern int hdd_image_read(uint8_t id, uint32_t sector, uint32_t count, uint8_t *buffer);
extern int hdd_image_read_ex(uint8_t id, uint32_t sector, uint32_t count, uint8_t *buffer);
extern void hdd_image_write(uint8_t id, uint32_t sector, uint32_t count, uint8_t *buffer);
extern int hdd_image_write(uint8_t id, uint32_t sector, uint32_t count, uint8_t *buffer);
extern int hdd_image_write_ex(uint8_t id, uint32_t sector, uint32_t count, uint8_t *buffer);
extern void hdd_image_zero(uint8_t id, uint32_t sector, uint32_t count);
extern int hdd_image_zero(uint8_t id, uint32_t sector, uint32_t count);
extern int hdd_image_zero_ex(uint8_t id, uint32_t sector, uint32_t count);
extern uint32_t hdd_image_get_last_sector(uint8_t id);
extern uint32_t hdd_image_get_pos(uint8_t id);

View File

@@ -222,9 +222,9 @@ extern const device_t keyboard_xt86_device;
extern const device_t keyboard_xt_compaq_device;
extern const device_t keyboard_xt_t1x00_device;
extern const device_t keyboard_tandy_device;
# if defined(DEV_BRANCH) && defined(USE_LASERXT)
# ifdef USE_LASERXT
extern const device_t keyboard_xt_lxt3_device;
# endif /*defined(DEV_BRANCH) && defined(USE_LASERXT) */
# endif /* USE_LASERXT */
extern const device_t keyboard_xt_olivetti_device;
extern const device_t keyboard_xt_zenith_device;
extern const device_t keyboard_xt_hyundai_device;
@@ -272,12 +272,14 @@ 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_recv_ui(uint16_t key);
extern int keyboard_isfsenter(void);
extern int keyboard_isfsenter_up(void);
extern int keyboard_isfsexit(void);
extern int keyboard_isfsexit_up(void);
extern int keyboard_ismsexit(void);
extern void keyboard_set_is_amstrad(int ams);
extern void kbc_at_set_ps2(void *priv, uint8_t ps2);
extern void kbc_at_set_fast_reset(uint8_t new_fast_reset);
extern void kbc_at_handler(int set, void *priv);

View File

@@ -232,6 +232,9 @@ enum {
MACHINE_CHIPSET_INTEL_440GX,
MACHINE_CHIPSET_OPTI_283,
MACHINE_CHIPSET_OPTI_291,
MACHINE_CHIPSET_OPTI_381,
MACHINE_CHIPSET_OPTI_391,
MACHINE_CHIPSET_OPTI_481,
MACHINE_CHIPSET_OPTI_493,
MACHINE_CHIPSET_OPTI_495,
MACHINE_CHIPSET_OPTI_499,
@@ -274,6 +277,7 @@ enum {
MACHINE_CHIPSET_VLSI_VL82C481,
MACHINE_CHIPSET_VLSI_VL82C486,
MACHINE_CHIPSET_WD76C10,
MACHINE_CHIPSET_ZYMOS_POACH,
MACHINE_CHIPSET_MAX
};
@@ -432,9 +436,10 @@ extern int machine_at_ibmxt286_init(const machine_t *);
extern int machine_at_siemens_init(const machine_t *); // Siemens PCD-2L. N82330 discrete machine. It segfaults in some places
#if defined(DEV_BRANCH) && defined(USE_OPEN_AT)
extern int machine_at_wellamerastar_init(const machine_t *); // Wells American A*Star with custom award BIOS
#ifdef USE_OPEN_AT
extern int machine_at_openat_init(const machine_t *);
#endif
#endif /* USE_OPEN_AT */
/* m_at_286_386sx.c */
extern int machine_at_tg286m_init(const machine_t *);
@@ -463,9 +468,9 @@ extern int machine_at_deskmaster286_init(const machine_t *);
extern int machine_at_pc8_init(const machine_t *);
extern int machine_at_3302_init(const machine_t *);
#if defined(DEV_BRANCH) && defined(USE_OLIVETTI)
#ifdef USE_OLIVETTI
extern int machine_at_m290_init(const machine_t *);
#endif
#endif /* USE_OLIVETTI */
extern int machine_at_shuttle386sx_init(const machine_t *);
extern int machine_at_adi386sx_init(const machine_t *);
@@ -488,6 +493,14 @@ extern int machine_at_awardsx_init(const machine_t *);
extern int machine_at_pc916sx_init(const machine_t *);
/* m_at_386dx_486.c */
/* Note to jriwanek: When merging this into my branch, please make
sure this appear here (and in the .c file) in the order and position
in which they appear in the machine table. */
extern int machine_at_dataexpert386wb_init(const machine_t *);
extern int machine_at_genoa486_init(const machine_t *);
extern int machine_at_ga486l_init(const machine_t *);
extern int machine_at_cougar_init(const machine_t *);
extern int machine_at_acc386_init(const machine_t *);
extern int machine_at_asus386_init(const machine_t *);
extern int machine_at_ecs386_init(const machine_t *);
@@ -713,9 +726,9 @@ extern int machine_at_i430vx_init(const machine_t *);
extern int machine_at_ma23c_init(const machine_t *);
extern int machine_at_nupro592_init(const machine_t *);
extern int machine_at_tx97_init(const machine_t *);
#if defined(DEV_BRANCH) && defined(USE_AN430TX)
#ifdef USE_AN430TX
extern int machine_at_an430tx_init(const machine_t *);
#endif
#endif /* USE_AN430TX */
extern int machine_at_ym430tx_init(const machine_t *);
extern int machine_at_thunderbolt_init(const machine_t *);
extern int machine_at_mb540n_init(const machine_t *);
@@ -877,7 +890,7 @@ extern int machine_ps2_model_70_type4_init(const machine_t *);
/* m_tandy.c */
extern int tandy1k_eeprom_read(void);
extern int machine_tandy_init(const machine_t *);
extern int machine_tandy1000sx_init(const machine_t *);
extern int machine_tandy1000hx_init(const machine_t *);
extern int machine_tandy1000sl2_init(const machine_t *);
@@ -920,6 +933,7 @@ extern int machine_xt_v20xt_init(const machine_t *);
extern int machine_xt_iskra3104_init(const machine_t *);
extern int machine_xt_pravetz16_imko4_init(const machine_t *);
extern int machine_xt_pravetz16s_cpu12p_init(const machine_t *);
extern int machine_xt_micoms_xl7turbo_init(const machine_t *);
/* m_xt_compaq.c */
@@ -927,10 +941,10 @@ extern int machine_xt_compaq_deskpro_init(const machine_t *);
extern int machine_xt_compaq_portable_init(const machine_t *);
/* m_xt_laserxt.c */
#if defined(DEV_BRANCH) && defined(USE_LASERXT)
#ifdef USE_LASERXT
extern int machine_xt_laserxt_init(const machine_t *);
extern int machine_xt_lxt3_init(const machine_t *);
#endif
#endif /* USE_LASERXT */
/* m_xt_philips.c */
extern int machine_xt_p3105_init(const machine_t *);

View File

@@ -391,6 +391,11 @@ extern void mem_mapping_set_handler(mem_mapping_t *,
void (*write_w)(uint32_t addr, uint16_t val, void *priv),
void (*write_l)(uint32_t addr, uint32_t val, void *priv));
extern void mem_mapping_set_write_handler(mem_mapping_t *,
void (*write_b)(uint32_t addr, uint8_t val, void *priv),
void (*write_w)(uint32_t addr, uint16_t val, void *priv),
void (*write_l)(uint32_t addr, uint32_t val, void *priv));
extern void mem_mapping_set_p(mem_mapping_t *, void *priv);
extern void mem_mapping_set_addr(mem_mapping_t *,
@@ -441,6 +446,7 @@ extern void mem_flush_write_page(uint32_t addr, uint32_t virt);
extern void mem_reset_page_blocks(void);
extern void flushmmucache(void);
extern void flushmmucache_pc(void);
extern void flushmmucache_nopc(void);
extern void mem_debug_check_addr(uint32_t addr, int write);
@@ -451,6 +457,7 @@ extern void mem_a20_recalc(void);
extern void mem_init(void);
extern void mem_close(void);
extern void mem_reset(void);
extern void mem_remap_top_ex(int kb, uint32_t start);
extern void mem_remap_top(int kb);
extern void umc_smram_recalc(uint32_t start, int set);

View File

@@ -32,6 +32,7 @@ typedef struct midi_device_t {
void (*play_sysex)(uint8_t *sysex, unsigned int len);
void (*play_msg)(uint8_t *msg);
void (*poll)(void);
void (*reset)(void);
int (*write)(uint8_t val);
} midi_device_t;
@@ -77,6 +78,7 @@ extern void midi_raw_out_thru_rt_byte(uint8_t val);
extern void midi_raw_out_byte(uint8_t val);
extern void midi_clear_buffer(void);
extern void midi_poll(void);
extern void midi_reset(void);
extern void midi_in_handler(int set, void (*msg)(void *priv, uint8_t *msg, uint32_t len), int (*sysex)(void *priv, uint8_t *buffer, uint32_t len, int abort), void *priv);
extern void midi_in_handlers_clear(void);
@@ -102,18 +104,18 @@ extern void midi_in_sysex(uint8_t *buffer, uint32_t len);
#ifdef EMU_DEVICE_H
extern const device_t rtmidi_output_device;
extern const device_t rtmidi_input_device;
# if defined(DEV_BRANCH) && defined(USE_OPL4ML)
# ifdef USE_OPL4ML
extern const device_t opl4_midi_device;
# endif
# endif /* USE_OPL4ML */
# ifdef USE_FLUIDSYNTH
extern const device_t fluidsynth_device;
# endif
# endif /* USE_FLUIDSYNTH */
# ifdef USE_MUNT
extern const device_t mt32_old_device;
extern const device_t mt32_new_device;
extern const device_t cm32l_device;
extern const device_t cm32ln_device;
# endif
# endif /* USE_MUNT */
#endif
#endif /*EMU_SOUND_MIDI_H*/

View File

@@ -50,7 +50,7 @@ extern "C" {
#endif
extern int mouse_type;
extern int mouse_input_mode; /* 1 = Absolute, 0 = Relative */
extern int mouse_input_mode; /* 2 = Absolute (Visible Crosshair), 1 = Absolute, 0 = Relative */
extern int mouse_timed; /* 1 = Timed, 0 = Constant */
extern int mouse_tablet_in_proximity;
extern double mouse_x_abs;
@@ -71,8 +71,10 @@ 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;
# ifdef USE_WACOM
extern const device_t mouse_wacom_device;
extern const device_t mouse_wacom_artpad_device;
# endif
extern const device_t mouse_mtouch_device;
#endif

View File

@@ -171,6 +171,8 @@ typedef struct dp8390_t {
/* DP8390 memory */
uint8_t *mem; /* on-chip packet memory */
uint8_t sink_buffer[4096];
uint8_t macaddr[32]; /* ASIC ROM'd MAC address, even bytes */
uint8_t macaddr_size, /* Defaults to 16 but can be 32 */
flags, /* Flags affecting some behaviors. */

View File

@@ -37,15 +37,17 @@
#define NET_NE2000_H
enum {
NE2K_NONE = 0,
NE2K_NE1000 = 1, /* 8-bit ISA NE1000 */
NE2K_NE1000_COMPAT = 2, /* 8-bit ISA NE1000-Compatible */
NE2K_NE2000 = 3, /* 16-bit ISA NE2000 */
NE2K_NE2000_COMPAT = 4, /* 16-bit ISA NE2000-Compatible */
NE2K_ETHERNEXT_MC = 5, /* 16-bit MCA EtherNext/MC */
NE2K_RTL8019AS = 6, /* 16-bit ISA PnP Realtek 8019AS */
NE2K_DE220P = 7, /* 16-bit ISA PnP D-Link DE-220P */
NE2K_RTL8029AS = 8 /* 32-bit PCI Realtek 8029AS */
NE2K_NONE = 0,
NE2K_NE1000 = 1, /* 8-bit ISA NE1000 */
NE2K_NE1000_COMPAT = 2, /* 8-bit ISA NE1000-Compatible */
NE2K_NE2000 = 3, /* 16-bit ISA NE2000 */
NE2K_NE2000_COMPAT = 4, /* 16-bit ISA NE2000-Compatible */
NE2K_NE2000_COMPAT_8BIT = 5, /* 8-bit ISA NE2000-Compatible, like: https://github.com/skiselev/isa8_eth */
NE2K_ETHERNEXT_MC = 6, /* 16-bit MCA EtherNext/MC */
NE2K_RTL8019AS = 7, /* 16-bit ISA PnP Realtek 8019AS */
NE2K_DE220P = 8, /* 16-bit ISA PnP D-Link DE-220P */
NE2K_RTL8029AS = 9, /* 32-bit PCI Realtek 8029AS */
/* Check nic_init() if adding items after this point. */
};
#endif /*NET_NE2000_H*/

View File

@@ -211,6 +211,7 @@ extern const device_t ne1000_device;
extern const device_t ne1000_compat_device;
extern const device_t ne2000_device;
extern const device_t ne2000_compat_device;
extern const device_t ne2000_compat_8bit_device;
extern const device_t ethernext_mc_device;
extern const device_t rtl8019as_device;
extern const device_t de220p_device;

View File

@@ -19,6 +19,8 @@
#ifndef EMU_PIT_H
#define EMU_PIT_H
#define NUM_COUNTERS 3
typedef struct ctr_t {
uint8_t m;
uint8_t ctrl;
@@ -68,7 +70,7 @@ typedef struct PIT {
int clock;
pc_timer_t callback_timer;
ctr_t counters[3];
ctr_t counters[NUM_COUNTERS];
uint8_t ctrl;

View File

@@ -68,7 +68,7 @@ typedef struct ctrf_t {
typedef struct pitf_t {
int flags;
ctrf_t counters[3];
ctrf_t counters[NUM_COUNTERS];
uint8_t ctrl;

View File

@@ -47,7 +47,9 @@ enum {
STRING_HW_NOT_AVAILABLE_MACHINE, /* "Machine \"%hs\" is not available..." */
STRING_HW_NOT_AVAILABLE_VIDEO, /* "Video card \"%hs\" is not available..." */
STRING_HW_NOT_AVAILABLE_VIDEO2, /* "Video card #2 \"%hs\" is not available..." */
STRING_MONITOR_SLEEP /* "Monitor in sleep mode" */
STRING_MONITOR_SLEEP, /* "Monitor in sleep mode" */
STRING_GHOSTPCL_ERROR_TITLE, /* "Unable to initialize GhostPCL" */
STRING_GHOSTPCL_ERROR_DESC /* "gpcl6dll32.dll/gpcl6dll64.dll/libgpcl6 is required..." */
};
/* The Win32 API uses _wcsicmp. */
@@ -151,7 +153,7 @@ extern uint32_t plat_get_ticks(void);
extern void plat_delay_ms(uint32_t count);
extern void plat_pause(int p);
extern void plat_mouse_capture(int on);
extern int plat_vidapi(char *name);
extern int plat_vidapi(const char *name);
extern char *plat_vidapi_name(int api);
extern void plat_resize(int x, int y, int monitor_index);
extern void plat_resize_request(int x, int y, int monitor_index);

View File

@@ -49,19 +49,23 @@ typedef struct SMSF {
uint8_t fr;
} TMSF;
extern int plat_cdrom_is_track_audio(uint32_t sector);
extern int plat_cdrom_is_track_pre(uint32_t sector);
extern uint32_t plat_cdrom_get_last_block(void);
extern void plat_cdrom_get_audio_tracks(int *st_track, int *end, TMSF *lead_out);
extern int plat_cdrom_get_audio_track_info(int end, int track, int *track_num, TMSF *start, uint8_t *attr);
extern int plat_cdrom_get_audio_sub(uint32_t sector, uint8_t *attr, uint8_t *track, uint8_t *index, TMSF *rel_pos, TMSF *abs_pos);
extern int plat_cdrom_get_sector_size(uint32_t sector);
extern int plat_cdrom_read_sector(uint8_t *buffer, int raw, uint32_t sector);
extern void plat_cdrom_eject(void);
extern void plat_cdrom_close(void);
extern int plat_cdrom_set_drive(const char *drv);
extern int plat_cdrom_ext_medium_changed(void);
extern uint32_t plat_cdrom_get_track_start(uint32_t sector, uint8_t *attr, uint8_t *track);
extern void plat_cdrom_get_raw_track_info(void *local, int *num, raw_track_info_t *rti);
extern int plat_cdrom_is_track_audio(void *local, uint32_t sector);
extern int plat_cdrom_is_track_pre(void *local, uint32_t sector);
extern uint32_t plat_cdrom_get_last_block(void *local);
extern void plat_cdrom_get_audio_tracks(void *local, int *st_track, int *end, TMSF *lead_out);
extern int plat_cdrom_get_audio_track_info(void *local, int end, int track, int *track_num, TMSF *start,
uint8_t *attr);
extern int plat_cdrom_get_audio_sub(void *local, uint32_t sector, uint8_t *attr, uint8_t *track,
uint8_t *index, TMSF *rel_pos, TMSF *abs_pos);
extern int plat_cdrom_get_sector_size(void *local, uint32_t sector);
extern int plat_cdrom_read_sector(void *local, uint8_t *buffer, int raw, uint32_t sector);
extern void plat_cdrom_eject(void *local);
extern void plat_cdrom_close(void *local);
extern int plat_cdrom_set_drive(void *local, const char *drv);
extern int plat_cdrom_ext_medium_changed(void *local);
extern uint32_t plat_cdrom_get_track_start(void *local, uint32_t sector, uint8_t *attr, uint8_t *track);
extern int plat_cdrom_get_local_size(void);
#ifdef __cplusplus
}

View File

@@ -37,6 +37,7 @@ extern void port_92_add(void *priv);
extern void port_92_remove(void *priv);
extern const device_t port_92_device;
extern const device_t port_92_key_device;
extern const device_t port_92_inv_device;
extern const device_t port_92_word_device;
extern const device_t port_92_pci_device;

View File

@@ -4,5 +4,8 @@
extern const lpt_device_t lpt_prt_text_device;
extern const lpt_device_t lpt_prt_escp_device;
extern const lpt_device_t lpt_prt_ps_device;
#ifdef USE_PCL
extern const lpt_device_t lpt_prt_pcl_device;
#endif
#endif /*EMU_PRT_DEVS_H*/

View File

@@ -189,6 +189,7 @@
/* SCSI Sense Keys */
#define SENSE_NONE 0
#define SENSE_NOT_READY 2
#define SENSE_MEDIUM_ERROR 3
#define SENSE_ILLEGAL_REQUEST 5
#define SENSE_UNIT_ATTENTION 6
@@ -196,6 +197,8 @@
#define ASC_NONE 0x00
#define ASC_AUDIO_PLAY_OPERATION 0x00
#define ASC_NOT_READY 0x04
#define ASC_WRITE_ERROR 0x0c
#define ASC_UNRECOVERED_READ_ERROR 0x11
#define ASC_ILLEGAL_OPCODE 0x20
#define ASC_LBA_OUT_OF_RANGE 0x21
#define ASC_INV_FIELD_IN_CMD_PACKET 0x24
@@ -212,6 +215,7 @@
#define ASCQ_NONE 0x00
#define ASCQ_UNIT_IN_PROCESS_OF_BECOMING_READY 0x01
#define ASCQ_INITIALIZING_COMMAND_REQUIRED 0x02
#define ASCQ_CIRC_UNRECOVERED_ERROR 0x06
#define ASCQ_CAPACITY_DATA_CHANGED 0x09
#define ASCQ_AUDIO_PLAY_OPERATION_IN_PROGRESS 0x11
#define ASCQ_AUDIO_PLAY_OPERATION_PAUSED 0x12

View File

@@ -138,9 +138,6 @@ extern const device_t scsi_t128_device;
extern const device_t scsi_t228_device;
extern const device_t scsi_t130b_device;
extern const device_t scsi_ls2000_device;
#if defined(DEV_BRANCH) && defined(USE_SUMO)
extern const device_t scsi_scsiat_device;
#endif
#endif
#endif /*SCSI_NCR5380_H*/

View File

@@ -25,6 +25,7 @@
#ifndef SCSI_PCSCSI_H
#define SCSI_PCSCSI_H
extern const device_t am53c974_pci_device;
extern const device_t dc390_pci_device;
extern const device_t ncr53c90a_mca_device;

View File

@@ -476,7 +476,8 @@ typedef struct x54x_t {
/* 8 bytes */
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 */
char nvr_path[64]; /* path to NVR image file */
/* 56 bytes */
/* Pointer to a structure of vendor-specific data that only the vendor-specific code can understand */

View File

@@ -43,6 +43,18 @@
#define COM3_IRQ 4
#define COM4_ADDR 0x02e8
#define COM4_IRQ 3
// The following support being assingned IRQ 3, 4, 5, 9, 10, 11, 12 or 15
// There doesn't appear to be any specific standard however
// So defaults have been chosen arbitarily
// TODO: Allow configuration of the IRQ in the UI
//#define COM5_ADDR 0x03f0
//#define COM5_IRQ 3
#define COM5_ADDR 0x02f0
#define COM5_IRQ 11
#define COM6_ADDR 0x03e0
#define COM6_IRQ 10
#define COM7_ADDR 0x02e0
#define COM7_IRQ 9
struct serial_device_s;
struct serial_s;

View File

@@ -42,6 +42,7 @@ extern const device_t fdc37c931apm_device;
extern const device_t fdc37c931apm_compaq_device;
extern const device_t fdc37c932fr_device;
extern const device_t fdc37c932qf_device;
extern const device_t fdc37c932_device;
extern const device_t fdc37c935_device;
extern const device_t fdc37c935_370_device;
extern const device_t fdc37c935_no_nvr_device;
@@ -74,9 +75,9 @@ extern const device_t prime3b_ide_device;
extern const device_t prime3c_device;
extern const device_t prime3c_ide_device;
extern const device_t ps1_m2133_sio;
#if defined(DEV_BRANCH) && defined(USE_SIO_DETECT)
#ifdef USE_SIO_DETECT
extern const device_t sio_detect_device;
#endif
#endif /* USE_SIO_DETECT */
extern const device_t um8663af_device;
extern const device_t um8663af_ide_device;
extern const device_t um8663af_sec_device;
@@ -87,6 +88,7 @@ extern const device_t um8669f_device;
extern const device_t um8669f_ide_device;
extern const device_t um8669f_ide_sec_device;
extern const device_t via_vt82c686_sio_device;
extern const device_t vl82c113_device;
extern const device_t w83787f_88h_device;
extern const device_t w83787f_device;
extern const device_t w83787f_ide_device;

View File

@@ -26,9 +26,9 @@
#define MPU401_VERSION 0x15
#define MPU401_REVISION 0x01
#define MPU401_QUEUE 1024
#define MPU401_QUEUE 32
#define MPU401_INPUT_QUEUE 1024
#define MPU401_TIMECONSTANT (60000000 / 1000.0f)
#define MPU401_TIMECONSTANT (60000000.0 / 1000.0)
#define MPU401_RESETBUSY 27.0f
/*helpers*/
@@ -89,7 +89,7 @@ typedef struct mpu_t {
uint32_t ch_toref[16];
struct track {
int counter;
uint8_t value[3];
uint8_t value[8];
uint8_t sys_val;
uint8_t vlength;
uint8_t length;
@@ -106,7 +106,6 @@ typedef struct mpu_t {
int wsm;
int wsd_start;
int run_irq;
int irq_pending;
int track_req;
int send_now;
int eoi_scheduled;
@@ -116,9 +115,11 @@ typedef struct mpu_t {
int sysex_in_finished;
int rec_copy;
RecState rec;
uint8_t irq_pending;
uint8_t tmask;
uint8_t cmask;
uint8_t amask;
uint8_t queued_eois;
uint8_t last_rtcmd;
uint16_t midi_mask;
uint16_t req_mask;

View File

@@ -20,4 +20,181 @@
#ifndef SOUND_OPL_NUKED_H
#define SOUND_OPL_NUKED_H
#ifdef __cplusplus
extern "C" {
#endif
#include <inttypes.h>
#ifndef OPL_ENABLE_STEREOEXT
#define OPL_ENABLE_STEREOEXT 0
#endif
#define OPL_WRITEBUF_SIZE 1024
#define OPL_WRITEBUF_DELAY 2
typedef struct _opl3_slot opl3_slot;
typedef struct _opl3_channel opl3_channel;
typedef struct _opl3_chip opl3_chip;
struct _opl3_slot {
opl3_channel *channel;
opl3_chip *chip;
int16_t out;
int16_t fbmod;
int16_t *mod;
int16_t prout;
uint16_t eg_rout;
uint16_t eg_out;
uint8_t eg_inc;
uint8_t eg_gen;
uint8_t eg_rate;
uint8_t eg_ksl;
uint8_t *trem;
uint8_t reg_vib;
uint8_t reg_type;
uint8_t reg_ksr;
uint8_t reg_mult;
uint8_t reg_ksl;
uint8_t reg_tl;
uint8_t reg_ar;
uint8_t reg_dr;
uint8_t reg_sl;
uint8_t reg_rr;
uint8_t reg_wf;
uint8_t key;
uint32_t pg_reset;
uint32_t pg_phase;
uint16_t pg_phase_out;
uint8_t slot_num;
};
struct _opl3_channel {
opl3_slot *slotz[2]; // Don't use "slots" keyword to avoid conflict with Qt applications
opl3_channel *pair;
opl3_chip *chip;
int16_t *out[4];
#if OPL_ENABLE_STEREOEXT
int32_t leftpan;
int32_t rightpan;
#endif
uint8_t chtype;
uint16_t f_num;
uint8_t block;
uint8_t fb;
uint8_t con;
uint8_t alg;
uint8_t ksv;
uint16_t cha;
uint16_t chb;
uint16_t chc;
uint16_t chd;
uint8_t ch_num;
};
typedef struct _opl3_writebuf {
uint64_t time;
uint16_t reg;
uint8_t data;
} opl3_writebuf;
struct _opl3_chip {
opl3_channel channel[18];
opl3_slot slot[36];
uint16_t timer;
uint64_t eg_timer;
uint8_t eg_timerrem;
uint8_t eg_state;
uint8_t eg_add;
uint8_t eg_timer_lo;
uint8_t newm;
uint8_t nts;
uint8_t rhy;
uint8_t vibpos;
uint8_t vibshift;
uint8_t tremolo;
uint8_t tremolopos;
uint8_t tremoloshift;
uint32_t noise;
int16_t zeromod;
int32_t mixbuff[4];
uint8_t rm_hh_bit2;
uint8_t rm_hh_bit3;
uint8_t rm_hh_bit7;
uint8_t rm_hh_bit8;
uint8_t rm_tc_bit3;
uint8_t rm_tc_bit5;
#if OPL_ENABLE_STEREOEXT
uint8_t stereoext;
#endif
// OPL3L
int32_t rateratio;
int32_t samplecnt;
int32_t oldsamples[4];
int32_t samples[4];
uint64_t writebuf_samplecnt;
uint32_t writebuf_cur;
uint32_t writebuf_last;
uint64_t writebuf_lasttime;
opl3_writebuf writebuf[OPL_WRITEBUF_SIZE];
};
typedef struct {
opl3_chip opl;
int8_t flags;
int8_t pad;
uint16_t port;
uint8_t status;
uint8_t timer_ctrl;
uint16_t timer_count[2];
uint16_t timer_cur_count[2];
pc_timer_t timers[2];
int pos;
int32_t buffer[MUSICBUFLEN * 2];
} nuked_drv_t;
enum {
FLAG_CYCLES = 0x02,
FLAG_OPL3 = 0x01
};
enum {
STAT_TMR_OVER = 0x60,
STAT_TMR1_OVER = 0x40,
STAT_TMR2_OVER = 0x20,
STAT_TMR_ANY = 0x80
};
enum {
CTRL_RESET = 0x80,
CTRL_TMR_MASK = 0x60,
CTRL_TMR1_MASK = 0x40,
CTRL_TMR2_MASK = 0x20,
CTRL_TMR2_START = 0x02,
CTRL_TMR1_START = 0x01
};
void OPL3_Generate(opl3_chip *chip, int32_t *buf);
void OPL3_GenerateResampled(opl3_chip *chip, int32_t *buf);
void OPL3_Reset(opl3_chip *chip, uint32_t samplerate);
void OPL3_WriteReg(void *priv, uint16_t reg, uint8_t val);
void OPL3_WriteRegBuffered(void *priv, uint16_t reg, uint8_t val);
void OPL3_GenerateStream(opl3_chip *chip, int32_t *sndptr, uint32_t numsamples);
static void OPL3_Generate4Ch(void *priv, int32_t *buf4);
void OPL3_Generate4Ch_Resampled(opl3_chip *chip, int32_t *buf4);
void OPL3_Generate4Ch_Stream(opl3_chip *chip, int32_t *sndptr1, int32_t *sndptr2, uint32_t numsamples);
#ifdef __cplusplus
}
#endif
#endif /*SOUND_OPL_NUKED_H*/

View File

@@ -187,6 +187,8 @@ typedef struct sb_t {
uint8_t pnp_rom[512];
uint16_t opl_pnp_addr;
uint16_t midi_addr;
uint16_t gameport_addr;
void *opl_mixer;

View File

@@ -91,6 +91,8 @@ typedef struct sb_dsp_t {
uint8_t sbref;
int8_t sbstep;
uint8_t activity;
int sbdacpos;
int sbleftright;
@@ -141,6 +143,7 @@ typedef struct sb_dsp_t {
int wb_full;
pc_timer_t irq_timer;
pc_timer_t irq16_timer;
int busy_count;

View File

@@ -20,6 +20,9 @@ typedef struct sn76489_t {
int freqhi[4];
int vol[4];
uint32_t shift;
uint32_t white_noise_tap_1;
uint32_t white_noise_tap_2;
uint32_t feedback_mask;
uint8_t noise;
int lasttone;
uint8_t firstdat;

View File

@@ -185,6 +185,9 @@ timer_set_p(pc_timer_t *timer, void *priv)
extern void timer_stop(pc_timer_t *timer);
extern void timer_on_auto(pc_timer_t *timer, double period);
/* Change TSC, taking into account the timers. */
extern void timer_set_new_tsc(uint64_t new_tsc);
#ifdef __cplusplus
}
#endif

View File

@@ -41,6 +41,10 @@ typedef union {
typedef struct ibm8514_t {
rom_t bios_rom;
rom_t bios_rom2;
mem_mapping_t bios_mapping;
uint8_t *rom1;
uint8_t *rom2;
hwcursor8514_t hwcursor;
hwcursor8514_t hwcursor_latch;
uint8_t pos_regs[8];
@@ -50,7 +54,7 @@ typedef struct ibm8514_t {
int type;
int local;
int bpp;
int on[2];
int on;
int accel_bpp;
uint32_t vram_size;
@@ -100,6 +104,8 @@ typedef struct ibm8514_t {
uint16_t frgd_mix;
uint16_t multifunc_cntl;
uint16_t multifunc[16];
uint16_t clip_right;
uint16_t clip_bottom;
int16_t clip_left;
int16_t clip_top;
uint8_t pix_trans[2];
@@ -110,8 +116,6 @@ typedef struct ibm8514_t {
int x3;
int y1;
int y2;
int sys_cnt;
int sys_cnt2;
int temp_cnt;
int16_t cx;
int16_t cx_back;
@@ -125,20 +129,14 @@ typedef struct ibm8514_t {
int16_t err;
uint32_t src;
uint32_t dest;
uint32_t newsrc_blt;
uint32_t newdest_blt;
uint32_t newdest_in;
uint32_t newdest_out;
uint8_t *writemono;
uint8_t *nibbleset;
int x_count;
int xx_count;
int y_count;
int input;
int input2;
int output;
int output2;
uint16_t cur_x_bit12;
uint16_t cur_y_bit12;
int ssv_len;
uint8_t ssv_dir;
uint8_t ssv_draw;
@@ -154,7 +152,6 @@ typedef struct ibm8514_t {
} accel;
uint16_t test;
int vendor_mode[2];
int h_blankstart;
int h_blank_end_val;
int hblankstart;
@@ -203,18 +200,23 @@ typedef struct ibm8514_t {
int hsync_width;
int htotal;
int hdisp;
int hdisp2;
int hdisped;
int sc;
int vsyncstart;
int vsyncwidth;
int vtotal;
int v_disp;
int v_disp2;
int vdisp;
int vdisp2;
int disp_cntl;
int interlace;
uint8_t subsys_cntl;
uint8_t subsys_stat;
atomic_int fifo_idx;
atomic_int ext_fifo_idx;
atomic_int force_busy;
atomic_int force_busy2;
@@ -225,6 +227,11 @@ typedef struct ibm8514_t {
int ext_pitch;
int ext_crt_pitch;
int extensions;
int linear;
uint32_t vram_amount;
int vram_512k_8514;
int vendor_mode;
PALETTE _8514pal;
latch8514_t latch;
} ibm8514_t;

View File

@@ -0,0 +1,25 @@
/*
* 86Box A hypervisor and IBM PC system emulator that specializes in
* running old operating systems and software designed for IBM
* PC systems and compatibles from 1981 through fairly recent
* system designs based on the PCI bus.
*
* This file is part of the 86Box distribution.
*
* Emulation of the 8514/A card from IBM for the MCA bus and
* generic ISA bus clones without vendor extensions.
*
*
*
* Authors: TheCollector1995
*
* Copyright 2024 TheCollector1995.
*/
#ifndef VIDEO_8514A_DEVICE_H
#define VIDEO_8514A_DEVICE_H
#ifdef EMU_DEVICE_H
extern const device_t ibm8514_mca_device;
extern const device_t gen8514_isa_device;
#endif
#endif /*VIDEO_XGA_DEVICE_H*/

View File

@@ -47,7 +47,8 @@ typedef struct ati_eeprom_t {
} ati_eeprom_t;
void ati_eeprom_load(ati_eeprom_t *eeprom, char *fn, int type);
void ati_eeprom_load_mach8(ati_eeprom_t *eeprom, char *fn);
void ati_eeprom_load_mach8(ati_eeprom_t *eeprom, char *fn, int mca);
void ati_eeprom_load_mach8_vga(ati_eeprom_t *eeprom, char *fn);
void ati_eeprom_write(ati_eeprom_t *eeprom, int ena, int clk, int dat);
int ati_eeprom_read(ati_eeprom_t *eeprom);

View File

@@ -41,8 +41,6 @@ typedef struct mach_t {
int ramdac_type;
int old_mode;
uint32_t memory;
uint16_t config1;
uint16_t config2;
@@ -73,9 +71,7 @@ typedef struct mach_t {
uint8_t bank_r;
uint16_t shadow_set;
uint16_t shadow_cntl;
int ext_on[2];
int extended_mode;
int compat_mode;
int override_resolution;
struct {
uint8_t line_idx;
@@ -84,6 +80,12 @@ typedef struct mach_t {
uint8_t patt_len;
uint8_t pix_trans[2];
uint8_t eeprom_control;
uint8_t alu_bg_fn;
uint8_t alu_fg_fn;
uint16_t clip_left;
uint16_t clip_right;
uint16_t clip_top;
uint16_t clip_bottom;
uint16_t dest_x_end;
uint16_t dest_x_start;
uint16_t dest_y_end;
@@ -102,14 +104,14 @@ typedef struct mach_t {
uint16_t ge_offset_hi;
uint16_t linedraw_opt;
uint16_t max_waitstates;
uint8_t patt_data_idx;
uint8_t patt_data[0x18];
uint16_t scan_to_x;
uint16_t scratch0;
uint16_t scratch1;
uint16_t test;
uint16_t pattern;
uint16_t test2;
int patt_data_idx_reg;
int patt_data_idx;
int src_y_dir;
int cmd_type;
int block_write_mono_pattern_enable;
@@ -144,9 +146,8 @@ typedef struct mach_t {
int stepx;
int stepy;
int src_stepx;
uint8_t color_pattern[16];
uint8_t color_pattern_full[32];
uint16_t color_pattern_word[8];
uint8_t mono_pattern_normal[16];
uint8_t color_pattern[32];
int mono_pattern[8][8];
uint32_t ge_offset;
uint32_t crt_offset;

View File

@@ -31,6 +31,8 @@ typedef struct cga_t {
uint8_t cgamode;
uint8_t cgacol;
uint8_t lp_strobe;
int fontbase;
int linepos;
int displine;

View File

@@ -23,6 +23,7 @@
typedef struct ogc_t {
cga_t cga;
uint16_t ctrl_addr;
/* unused in OGC, required for M19 video card structure idiom */
uint8_t ctrl_3dd;
uint8_t ctrl_3de;

View File

@@ -79,6 +79,7 @@ typedef struct svga_t {
uint8_t fcr;
uint8_t hblank_overscan;
uint8_t vidsys_ena;
uint8_t sleep;
int dac_addr;
int dac_pos;
@@ -87,6 +88,7 @@ typedef struct svga_t {
int dac_b;
int vtotal;
int dispend;
int vdisp;
int vsyncstart;
int split;
int vblankstart;
@@ -170,9 +172,11 @@ typedef struct svga_t {
pc_timer_t timer;
pc_timer_t timer8514;
pc_timer_t timer_xga;
double clock;
double clock8514;
double clock_xga;
double multiplier;
@@ -294,8 +298,6 @@ typedef struct svga_t {
void * xga;
} svga_t;
extern int vga_on;
extern void ibm8514_poll(void *priv);
extern void ibm8514_recalctimings(svga_t *svga);
extern uint8_t ibm8514_ramdac_in(uint16_t port, void *priv);
@@ -310,17 +312,21 @@ extern void ibm8514_accel_out_pixtrans(svga_t *svga, uint16_t port, uint32_t
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);
#ifdef ATI_8514_ULTRA
extern void ati8514_out(uint16_t addr, uint8_t val, void *priv);
extern uint8_t ati8514_in(uint16_t addr, void *priv);
extern void ati8514_recalctimings(svga_t *svga);
extern uint8_t ati8514_mca_read(int port, void *priv);
extern void ati8514_mca_write(int port, uint8_t val, void *priv);
extern void ati8514_pos_write(uint16_t port, uint8_t val, void *priv);
extern void ati8514_init(svga_t *svga, void *ext8514, void *dev8514);
#endif
extern void xga_poll(void *priv, svga_t *svga);
extern void xga_write_test(uint32_t addr, uint8_t val, void *priv);
extern uint8_t xga_read_test(uint32_t addr, void *priv);
extern void xga_poll(void *priv);
extern void xga_recalctimings(svga_t *svga);
extern uint32_t svga_decode_addr(svga_t *svga, uint32_t addr, int write);
extern int svga_init(const device_t *info, svga_t *svga, void *priv, int memsize,
void (*recalctimings_ex)(struct svga_t *svga),
uint8_t (*video_in)(uint16_t addr, void *priv),
@@ -362,6 +368,7 @@ uint32_t svga_mask_addr(uint32_t addr, svga_t *svga);
uint32_t svga_mask_changedaddr(uint32_t addr, svga_t *svga);
void svga_doblit(int wx, int wy, svga_t *svga);
void svga_poll(void *priv);
enum {
RAMDAC_6BIT = 0,
@@ -389,6 +396,9 @@ extern void att498_ramdac_out(uint16_t addr, int rs2, uint8_t val, void *priv
extern uint8_t att498_ramdac_in(uint16_t addr, int rs2, void *priv, svga_t *svga);
extern float av9194_getclock(int clock, void *priv);
extern void bt481_ramdac_out(uint16_t addr, int rs2, uint8_t val, void *priv, svga_t *svga);
extern uint8_t bt481_ramdac_in(uint16_t addr, int rs2, void *priv, svga_t *svga);
extern void bt48x_ramdac_out(uint16_t addr, int rs2, int rs3, uint8_t val, void *priv, svga_t *svga);
extern uint8_t bt48x_ramdac_in(uint16_t addr, int rs2, int rs3, void *priv, svga_t *svga);
extern void bt48x_recalctimings(void *priv, svga_t *svga);
@@ -445,6 +455,7 @@ extern const device_t att491_ramdac_device;
extern const device_t att492_ramdac_device;
extern const device_t att498_ramdac_device;
extern const device_t av9194_device;
extern const device_t bt481_ramdac_device;
extern const device_t bt484_ramdac_device;
extern const device_t att20c504_ramdac_device;
extern const device_t bt485_ramdac_device;

View File

@@ -48,6 +48,8 @@ extern void svga_render_text_80_ksc5601(svga_t *svga);
extern void svga_render_2bpp_lowres(svga_t *svga);
extern void svga_render_2bpp_highres(svga_t *svga);
extern void svga_render_2bpp_s3_lowres(svga_t *svga);
extern void svga_render_2bpp_s3_highres(svga_t *svga);
extern void svga_render_2bpp_headland_highres(svga_t *svga);
extern void svga_render_4bpp_lowres(svga_t *svga);
extern void svga_render_4bpp_highres(svga_t *svga);

View File

@@ -28,9 +28,7 @@ typedef struct vga_t {
rom_t bios_rom;
} vga_t;
static video_timings_t timing_vga = { VIDEO_ISA, 8, 16, 32, 8, 16, 32 };
void vga_out(uint16_t addr, uint8_t val, void *priv);
uint8_t vga_in(uint16_t addr, void *priv);
extern void vga_out(uint16_t addr, uint8_t val, void *priv);
extern uint8_t vga_in(uint16_t addr, void *priv);
#endif /*VIDEO_VGA_H*/

View File

@@ -408,6 +408,7 @@ typedef struct voodoo_t {
atomic_int cmd_read;
atomic_int cmd_written;
atomic_int cmd_written_fifo;
atomic_int cmd_written_fifo_2;
voodoo_params_t params_buffer[PARAM_SIZE];
atomic_int params_read_idx[4];
@@ -426,7 +427,20 @@ typedef struct voodoo_t {
uint32_t cmdfifo_amax;
int cmdfifo_holecount;
atomic_uint cmd_status;
uint32_t cmdfifo_base_2;
uint32_t cmdfifo_end_2;
uint32_t cmdfifo_size_2;
int cmdfifo_rp_2;
int cmdfifo_ret_addr_2;
int cmdfifo_in_sub_2;
atomic_int cmdfifo_depth_rd_2;
atomic_int cmdfifo_depth_wr_2;
atomic_int cmdfifo_enabled_2;
uint32_t cmdfifo_amin_2;
uint32_t cmdfifo_amax_2;
int cmdfifo_holecount_2;
atomic_uint cmd_status, cmd_status_2;
uint32_t sSetupMode;
vert_t verts[4];

View File

@@ -338,17 +338,22 @@ enum {
};
enum {
LFB_FORMAT_RGB565 = 0,
LFB_FORMAT_RGB555 = 1,
LFB_FORMAT_ARGB1555 = 2,
LFB_FORMAT_ARGB8888 = 5,
LFB_FORMAT_DEPTH = 15,
LFB_FORMAT_MASK = 15
LFB_FORMAT_RGB565 = 0,
LFB_FORMAT_RGB555 = 1,
LFB_FORMAT_ARGB1555 = 2,
LFB_FORMAT_XRGB8888 = 4,
LFB_FORMAT_ARGB8888 = 5,
LFB_FORMAT_DEPTH_RGB565 = 12,
LFB_FORMAT_DEPTH_RGB555 = 13,
LFB_FORMAT_DEPTH_ARGB1555 = 14,
LFB_FORMAT_DEPTH = 15,
LFB_FORMAT_MASK = 15
};
enum {
LFB_WRITE_COLOUR = 1,
LFB_WRITE_DEPTH = 2
LFB_WRITE_DEPTH = 2,
LFB_WRITE_BOTH = 4
};
enum {

View File

@@ -35,7 +35,7 @@ typedef struct xga_t {
mem_mapping_t linear_mapping;
mem_mapping_t video_mapping;
rom_t bios_rom;
rom_t vga_bios_rom;
rom_t bios_rom2;
xga_hwcursor_t hwcursor;
xga_hwcursor_t hwcursor_latch;
PALETTE extpal;
@@ -47,6 +47,8 @@ typedef struct xga_t {
uint8_t pos_regs[8];
uint8_t disp_addr;
uint8_t dac_mask;
uint8_t dac_status;
uint8_t cfg_reg;
uint8_t instance;
uint8_t op_mode;
@@ -85,6 +87,8 @@ typedef struct xga_t {
uint8_t instance_isa;
uint8_t instance_num;
uint8_t ext_mem_addr;
uint8_t vga_post;
uint8_t addr_test;
uint8_t *vram;
uint8_t *changedvram;
@@ -106,6 +110,10 @@ typedef struct xga_t {
uint16_t old_pal_addr_idx;
uint16_t sprite_pal_addr_idx_prefetch;
int dac_addr;
int dac_pos;
int dac_r;
int dac_g;
int v_total;
int dispend;
int v_syncstart;
@@ -143,6 +151,7 @@ typedef struct xga_t {
int a5_test;
int type;
int bus;
int busy;
uint32_t linear_base;
uint32_t linear_size;
@@ -161,6 +170,9 @@ typedef struct xga_t {
uint32_t write_bank;
uint32_t px_map_base;
uint32_t pallook[512];
uint32_t bios_diag;
PALETTE xgapal;
uint64_t dispontime;
uint64_t dispofftime;

View File

@@ -326,13 +326,14 @@ extern const device_t ati18800_device;
/* ATi 28800 */
extern const device_t ati28800_device;
extern const device_t ati28800_wonder1024d_xl_plus_device;
extern const device_t ati28800k_device;
extern const device_t ati28800k_spc4620p_device;
extern const device_t ati28800k_spc6033p_device;
extern const device_t compaq_ati28800_device;
# if defined(DEV_BRANCH) && defined(USE_XL24)
# ifdef USE_XL24
extern const device_t ati28800_wonderxl24_device;
# endif
# endif /* USE_XL24 */
/* Bochs */
extern const device_t bochs_svga_device;
@@ -446,7 +447,9 @@ extern const device_t millennium_device;
extern const device_t mystique_device;
extern const device_t mystique_220_device;
extern const device_t millennium_ii_device;
#ifdef USE_G100
extern const device_t productiva_g100_device;
#endif /* USE_G100 */
/* Oak OTI-0x7 */
extern const device_t oti037c_device;
@@ -525,7 +528,9 @@ extern const device_t s3_trio64v2_dx_onboard_pci_device;
/* S3 ViRGE */
extern const device_t s3_virge_325_pci_device;
extern const device_t s3_virge_325_onboard_pci_device;
extern const device_t s3_diamond_stealth_2000_pci_device;
extern const device_t s3_mirocrystal_3d_pci_device;
extern const device_t s3_diamond_stealth_3000_pci_device;
extern const device_t s3_stb_velocity_3d_pci_device;
extern const device_t s3_virge_375_pci_device;

View File

@@ -1,24 +0,0 @@
/* SPDX-License-Identifier: BSD-3-Clause */
#ifndef LIBSLIRP_VERSION_H_
#define LIBSLIRP_VERSION_H_
#ifdef __cplusplus
extern "C" {
#endif
#define SLIRP_MAJOR_VERSION 4
#define SLIRP_MINOR_VERSION 7
#define SLIRP_MICRO_VERSION 0
#define SLIRP_VERSION_STRING "4.7.0-86Box"
#define SLIRP_CHECK_VERSION(major,minor,micro) \
(SLIRP_MAJOR_VERSION > (major) || \
(SLIRP_MAJOR_VERSION == (major) && SLIRP_MINOR_VERSION > (minor)) || \
(SLIRP_MAJOR_VERSION == (major) && SLIRP_MINOR_VERSION == (minor) && \
SLIRP_MICRO_VERSION >= (micro)))
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* LIBSLIRP_VERSION_H_ */

View File

@@ -1,273 +0,0 @@
/* SPDX-License-Identifier: BSD-3-Clause */
#ifndef LIBSLIRP_H
#define LIBSLIRP_H
#include <stdint.h>
#include <stdbool.h>
#include <sys/types.h>
#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#include <in6addr.h>
#else
#include <netinet/in.h>
#include <arpa/inet.h>
#endif
#include "libslirp-version.h"
/* Windows does not define ssize_t, so we need to define it here. */
#ifndef _SSIZE_T_DEFINED
# define _SSIZE_T_DEFINED
# undef ssize_t
# ifdef _WIN64
# define ssize_t int64_t
# else
# define ssize_t int32_t
# endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* Opaque structure containing the slirp state */
typedef struct Slirp Slirp;
/* Flags passed to SlirpAddPollCb and to be returned by SlirpGetREventsCb. */
enum {
SLIRP_POLL_IN = 1 << 0,
SLIRP_POLL_OUT = 1 << 1,
SLIRP_POLL_PRI = 1 << 2,
SLIRP_POLL_ERR = 1 << 3,
SLIRP_POLL_HUP = 1 << 4,
};
typedef ssize_t (*SlirpReadCb)(void *buf, size_t len, void *opaque);
typedef ssize_t (*SlirpWriteCb)(const void *buf, size_t len, void *opaque);
typedef void (*SlirpTimerCb)(void *opaque);
typedef int (*SlirpAddPollCb)(int fd, int events, void *opaque);
typedef int (*SlirpGetREventsCb)(int idx, void *opaque);
typedef enum SlirpTimerId {
SLIRP_TIMER_RA,
SLIRP_TIMER_NUM,
} SlirpTimerId;
/*
* Callbacks from slirp, to be set by the application.
*
* The opaque parameter is set to the opaque pointer given in the slirp_new /
* slirp_init call.
*/
typedef struct SlirpCb {
/*
* Send an ethernet frame to the guest network. The opaque parameter is the
* one given to slirp_init(). If the guest is not ready to receive a frame,
* the function can just drop the data. TCP will then handle retransmissions
* at a lower pace.
* <0 reports an IO error.
*/
SlirpWriteCb send_packet;
/* Print a message for an error due to guest misbehavior. */
void (*guest_error)(const char *msg, void *opaque);
/* Return the virtual clock value in nanoseconds */
int64_t (*clock_get_ns)(void *opaque);
/* Create a new timer with the given callback and opaque data. Not
* needed if timer_new_opaque is provided. */
void *(*timer_new)(SlirpTimerCb cb, void *cb_opaque, void *opaque);
/* Remove and free a timer */
void (*timer_free)(void *timer, void *opaque);
/* Modify a timer to expire at @expire_time (ms) */
void (*timer_mod)(void *timer, int64_t expire_time, void *opaque);
/* Register a fd for future polling */
void (*register_poll_fd)(int fd, void *opaque);
/* Unregister a fd */
void (*unregister_poll_fd)(int fd, void *opaque);
/* Kick the io-thread, to signal that new events may be processed because some TCP buffer
* can now receive more data, i.e. slirp_socket_can_recv will return 1. */
void (*notify)(void *opaque);
/*
* Fields introduced in SlirpConfig version 4 begin
*/
/* Initialization has completed and a Slirp* has been created. */
void (*init_completed)(Slirp *slirp, void *opaque);
/* Create a new timer. When the timer fires, the application passes
* the SlirpTimerId and cb_opaque to slirp_handle_timer. */
void *(*timer_new_opaque)(SlirpTimerId id, void *cb_opaque, void *opaque);
} SlirpCb;
#define SLIRP_CONFIG_VERSION_MIN 1
#define SLIRP_CONFIG_VERSION_MAX 4
typedef struct SlirpConfig {
/* Version must be provided */
uint32_t version;
/*
* Fields introduced in SlirpConfig version 1 begin
*/
int restricted;
bool in_enabled;
struct in_addr vnetwork;
struct in_addr vnetmask;
struct in_addr vhost;
bool in6_enabled;
struct in6_addr vprefix_addr6;
uint8_t vprefix_len;
struct in6_addr vhost6;
const char *vhostname;
const char *tftp_server_name;
const char *tftp_path;
const char *bootfile;
struct in_addr vdhcp_start;
struct in_addr vnameserver;
struct in6_addr vnameserver6;
const char **vdnssearch;
const char *vdomainname;
/* Default: IF_MTU_DEFAULT */
size_t if_mtu;
/* Default: IF_MRU_DEFAULT */
size_t if_mru;
/* Prohibit connecting to 127.0.0.1:* */
bool disable_host_loopback;
/*
* Enable emulation code (*warning*: this code isn't safe, it is not
* recommended to enable it)
*/
bool enable_emu;
/*
* Fields introduced in SlirpConfig version 2 begin
*/
struct sockaddr_in *outbound_addr;
struct sockaddr_in6 *outbound_addr6;
/*
* Fields introduced in SlirpConfig version 3 begin
*/
bool disable_dns; /* slirp will not redirect/serve any DNS packet */
/*
* Fields introduced in SlirpConfig version 4 begin
*/
bool disable_dhcp; /* slirp will not reply to any DHCP requests */
} SlirpConfig;
/* Create a new instance of a slirp stack */
Slirp *slirp_new(const SlirpConfig *cfg, const SlirpCb *callbacks,
void *opaque);
/* slirp_init is deprecated in favor of slirp_new */
Slirp *slirp_init(int restricted, bool in_enabled, struct in_addr vnetwork,
struct in_addr vnetmask, struct in_addr vhost,
bool in6_enabled, struct in6_addr vprefix_addr6,
uint8_t vprefix_len, struct in6_addr vhost6,
const char *vhostname, const char *tftp_server_name,
const char *tftp_path, const char *bootfile,
struct in_addr vdhcp_start, struct in_addr vnameserver,
struct in6_addr vnameserver6, const char **vdnssearch,
const char *vdomainname, const SlirpCb *callbacks,
void *opaque);
/* Shut down an instance of a slirp stack */
void slirp_cleanup(Slirp *slirp);
/* This is called by the application when it is about to sleep through poll().
* *timeout is set to the amount of virtual time (in ms) that the application intends to
* wait (UINT32_MAX if infinite). slirp_pollfds_fill updates it according to
* e.g. TCP timers, so the application knows it should sleep a smaller amount of
* time. slirp_pollfds_fill calls add_poll for each file descriptor
* that should be monitored along the sleep. The opaque pointer is passed as
* such to add_poll, and add_poll returns an index. */
void slirp_pollfds_fill(Slirp *slirp, uint32_t *timeout,
SlirpAddPollCb add_poll, void *opaque);
/* This is called by the application after sleeping, to report which file
* descriptors are available. slirp_pollfds_poll calls get_revents on each file
* descriptor, giving it the index that add_poll returned during the
* slirp_pollfds_fill call, to know whether the descriptor is available for
* read/write/etc. (SLIRP_POLL_*)
* select_error should be passed 1 if poll() returned an error. */
void slirp_pollfds_poll(Slirp *slirp, int select_error,
SlirpGetREventsCb get_revents, void *opaque);
/* This is called by the application when the guest emits a packet on the
* guest network, to be interpreted by slirp. */
void slirp_input(Slirp *slirp, const uint8_t *pkt, int pkt_len);
/* This is called by the application when a timer expires, if it provides
* the timer_new_opaque callback. It is not needed if the application only
* uses timer_new. */
void slirp_handle_timer(Slirp *slirp, SlirpTimerId id, void *cb_opaque);
/* These set up / remove port forwarding between a host port in the real world
* and the guest network. */
int slirp_add_hostfwd(Slirp *slirp, int is_udp, struct in_addr host_addr,
int host_port, struct in_addr guest_addr, int guest_port);
int slirp_remove_hostfwd(Slirp *slirp, int is_udp, struct in_addr host_addr,
int host_port);
#define SLIRP_HOSTFWD_UDP 1
#define SLIRP_HOSTFWD_V6ONLY 2
int slirp_add_hostxfwd(Slirp *slirp,
const struct sockaddr *haddr, socklen_t haddrlen,
const struct sockaddr *gaddr, socklen_t gaddrlen,
int flags);
int slirp_remove_hostxfwd(Slirp *slirp,
const struct sockaddr *haddr, socklen_t haddrlen,
int flags);
/* Set up port forwarding between a port in the guest network and a
* command running on the host */
int slirp_add_exec(Slirp *slirp, const char *cmdline,
struct in_addr *guest_addr, int guest_port);
/* Set up port forwarding between a port in the guest network and a
* Unix port on the host */
int slirp_add_unix(Slirp *slirp, const char *unixsock,
struct in_addr *guest_addr, int guest_port);
/* Set up port forwarding between a port in the guest network and a
* callback that will receive the data coming from the port */
int slirp_add_guestfwd(Slirp *slirp, SlirpWriteCb write_cb, void *opaque,
struct in_addr *guest_addr, int guest_port);
/* TODO: rather identify a guestfwd through an opaque pointer instead of through
* the guest_addr */
/* This is called by the application for a guestfwd, to determine how much data
* can be received by the forwarded port through a call to slirp_socket_recv. */
size_t slirp_socket_can_recv(Slirp *slirp, struct in_addr guest_addr,
int guest_port);
/* This is called by the application for a guestfwd, to provide the data to be
* sent on the forwarded port */
void slirp_socket_recv(Slirp *slirp, struct in_addr guest_addr, int guest_port,
const uint8_t *buf, int size);
/* Remove entries added by slirp_add_exec, slirp_add_unix or slirp_add_guestfwd */
int slirp_remove_guestfwd(Slirp *slirp, struct in_addr guest_addr,
int guest_port);
/* Return a human-readable state of the slirp stack */
char *slirp_connection_info(Slirp *slirp);
/* Return a human-readable state of the NDP/ARP tables */
char *slirp_neighbor_info(Slirp *slirp);
/* Save the slirp state through the write_cb. The opaque pointer is passed as
* such to the write_cb. */
void slirp_state_save(Slirp *s, SlirpWriteCb write_cb, void *opaque);
/* Returns the version of the slirp state, to be saved along the state */
int slirp_state_version(void);
/* Load the slirp state through the read_cb. The opaque pointer is passed as
* such to the read_cb. The version should be given as it was obtained from
* slirp_state_version when slirp_state_save was called. */
int slirp_state_load(Slirp *s, int version_id, SlirpReadCb read_cb,
void *opaque);
/* Return the version of the slirp implementation */
const char *slirp_version_string(void);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* LIBSLIRP_H */