PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
|
|
|
/*
|
2023-01-06 15:36:05 -05:00
|
|
|
* 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.
|
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
|
|
|
*
|
2023-01-06 15:36:05 -05:00
|
|
|
* This file is part of the 86Box distribution.
|
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
|
|
|
*
|
2023-01-06 15:36:05 -05:00
|
|
|
* Header of the implementation of the Intel PIC chip emulation,
|
|
|
|
|
* partially ported from reenigne's XTCE.
|
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
|
|
|
*
|
2023-01-06 15:36:05 -05:00
|
|
|
* Authors: Andrew Jenner, <https://www.reenigne.org>
|
|
|
|
|
* Miran Grca, <mgrca8@gmail.com>
|
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
|
|
|
*
|
2023-01-06 15:36:05 -05:00
|
|
|
* Copyright 2015-2020 Andrew Jenner.
|
|
|
|
|
* Copyright 2016-2020 Miran Grca.
|
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
|
|
|
*/
|
2022-02-18 19:42:21 -05:00
|
|
|
|
2017-11-02 02:28:00 -05:00
|
|
|
#ifndef EMU_PIC_H
|
2022-09-18 17:15:38 -04:00
|
|
|
#define EMU_PIC_H
|
2017-11-02 02:28:00 -05:00
|
|
|
|
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
|
|
|
typedef struct pic {
|
2023-06-26 12:47:04 -04:00
|
|
|
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;
|
2022-09-18 17:15:38 -04:00
|
|
|
uint32_t at;
|
|
|
|
|
struct pic *slaves[8];
|
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
|
|
|
} pic_t;
|
2017-11-02 02:28:00 -05:00
|
|
|
|
2023-05-11 03:02:36 -04:00
|
|
|
extern pic_t pic;
|
|
|
|
|
extern pic_t pic2;
|
2022-09-18 17:15:38 -04:00
|
|
|
|
|
|
|
|
extern void pic_reset_smi_irq_mask(void);
|
|
|
|
|
extern void pic_set_smi_irq_mask(int irq, int set);
|
|
|
|
|
extern uint16_t pic_get_smi_irq_status(void);
|
|
|
|
|
extern void pic_clear_smi_irq_status(int irq);
|
|
|
|
|
|
|
|
|
|
extern int pic_elcr_get_enabled(void);
|
|
|
|
|
extern void pic_elcr_set_enabled(int enabled);
|
|
|
|
|
extern void pic_elcr_io_handler(int set);
|
|
|
|
|
extern void pic_elcr_write(uint16_t port, uint8_t val, void *priv);
|
|
|
|
|
extern uint8_t pic_elcr_read(uint16_t port, void *priv);
|
|
|
|
|
|
|
|
|
|
extern void pic_set_shadow(int sh);
|
2023-04-08 00:40:57 +02:00
|
|
|
extern int pic_get_pci_flag(void);
|
2022-09-18 17:15:38 -04:00
|
|
|
extern void pic_set_pci_flag(int pci);
|
|
|
|
|
extern void pic_set_pci(void);
|
2023-04-11 23:21:52 +02:00
|
|
|
extern void pic_kbd_latch(int enable);
|
|
|
|
|
extern void pic_mouse_latch(int enable);
|
2022-09-18 17:15:38 -04:00
|
|
|
extern void pic_init(void);
|
|
|
|
|
extern void pic_init_pcjr(void);
|
|
|
|
|
extern void pic2_init(void);
|
|
|
|
|
extern void pic_reset(void);
|
|
|
|
|
|
|
|
|
|
extern int picint_is_level(int irq);
|
|
|
|
|
extern void picint_common(uint16_t num, int level, int set);
|
|
|
|
|
extern void picint(uint16_t num);
|
|
|
|
|
extern void picintlevel(uint16_t num);
|
|
|
|
|
extern void picintc(uint16_t num);
|
|
|
|
|
extern int picinterrupt(void);
|
|
|
|
|
|
|
|
|
|
extern uint8_t pic_irq_ack(void);
|
|
|
|
|
|
|
|
|
|
#endif /*EMU_PIC_H*/
|