Files
86Box/src/include/86box/vid_pgc.h

185 lines
5.5 KiB
C
Raw Normal View History

Added the IBM 5161 ISA expansion for PC and XT; Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port; Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX); Finished the 586MC1; Added 8087 emulation; Moved Cyrix 6x86'es to the Dev branch; Sanitized/cleaned up memregs.c/h and intel.c/h; Split the chipsets from machines and sanitized Port 92 emulation; Added support for the 15bpp mode to the Compaq ATI 28800; Moved the MR 386DX and 486 machines to the Dev branch; Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00; Ported the new timer code from PCem; Cleaned up the CPU table of unused stuff and better optimized its structure; Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch; Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem; Added the AHA-1540A and the BusTek BT-542B; Moved the Sumo SCSI-AT to the Dev branch; Minor IDE, FDC, and floppy drive code clean-ups; Made NCR 5380/53C400-based cards' BIOS address configurable; Got rid of the legacy romset variable; Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit; Added the Amstead PPC512 per PCem patch by John Elliott; Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages); Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing; Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem; Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit; Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement; Amstrad MegaPC does now works correctly with non-internal graphics card; The SLiRP code no longer casts a packed struct type to a non-packed struct type; The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present; The S3 Virge on BeOS is no longer broken (was broken by build #1591); OS/2 2.0 build 6.167 now sees key presses again; Xi8088 now work on CGA again; 86F images converted from either the old or new variants of the HxC MFM format now work correctly; Hardware interrupts with a vector of 0xFF are now handled correctly; OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct; Fixed VNC keyboard input bugs; Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver; Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly; Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4; Compaq Portable now works with all graphics cards; Fixed various MDSI Genius bugs; Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly; Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355; OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400. Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391. Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389. Fixed a minor IDE timing bug, fixes #388. Fixed Toshiba T1000 RAM issues, fixes #379. Fixed EGA/(S)VGA overscan border handling, fixes #378; Got rid of the now long useless IDE channel 2 auto-removal, fixes #370; Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366; Ported the Unicode CD image file name fix from VARCem, fixes #365; Fixed high density floppy disks on the Xi8088, fixes #359; Fixed some bugs in the Hercules emulation, fixes #346, fixes #358; Fixed the SCSI hard disk mode sense pages, fixes #356; Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349; Fixed bugs in the serial mouse emulation, fixes #344; Compiled 86Box binaries now include all the required .DLL's, fixes #341; Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02: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.
*
* This file is part of the 86Box distribution.
*
* Definitions for the PGC driver.
*
2020-03-25 00:46:02 +02:00
*
Added the IBM 5161 ISA expansion for PC and XT; Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port; Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX); Finished the 586MC1; Added 8087 emulation; Moved Cyrix 6x86'es to the Dev branch; Sanitized/cleaned up memregs.c/h and intel.c/h; Split the chipsets from machines and sanitized Port 92 emulation; Added support for the 15bpp mode to the Compaq ATI 28800; Moved the MR 386DX and 486 machines to the Dev branch; Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00; Ported the new timer code from PCem; Cleaned up the CPU table of unused stuff and better optimized its structure; Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch; Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem; Added the AHA-1540A and the BusTek BT-542B; Moved the Sumo SCSI-AT to the Dev branch; Minor IDE, FDC, and floppy drive code clean-ups; Made NCR 5380/53C400-based cards' BIOS address configurable; Got rid of the legacy romset variable; Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit; Added the Amstead PPC512 per PCem patch by John Elliott; Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages); Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing; Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem; Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit; Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement; Amstrad MegaPC does now works correctly with non-internal graphics card; The SLiRP code no longer casts a packed struct type to a non-packed struct type; The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present; The S3 Virge on BeOS is no longer broken (was broken by build #1591); OS/2 2.0 build 6.167 now sees key presses again; Xi8088 now work on CGA again; 86F images converted from either the old or new variants of the HxC MFM format now work correctly; Hardware interrupts with a vector of 0xFF are now handled correctly; OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct; Fixed VNC keyboard input bugs; Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver; Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly; Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4; Compaq Portable now works with all graphics cards; Fixed various MDSI Genius bugs; Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly; Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355; OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400. Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391. Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389. Fixed a minor IDE timing bug, fixes #388. Fixed Toshiba T1000 RAM issues, fixes #379. Fixed EGA/(S)VGA overscan border handling, fixes #378; Got rid of the now long useless IDE channel 2 auto-removal, fixes #370; Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366; Ported the Unicode CD image file name fix from VARCem, fixes #365; Fixed high density floppy disks on the Xi8088, fixes #359; Fixed some bugs in the Hercules emulation, fixes #346, fixes #358; Fixed the SCSI hard disk mode sense pages, fixes #356; Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349; Fixed bugs in the serial mouse emulation, fixes #344; Compiled 86Box binaries now include all the required .DLL's, fixes #341; Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* John Elliott, <jce@seasip.info>
*
* Copyright 2019 Fred N. van Kempen.
* Copyright 2019 John Elliott.
*/
#ifndef VID_PGC_H
# define VID_PGC_H
#define PGC_ERROR_RANGE 0x01
#define PGC_ERROR_INTEGER 0x02
#define PGC_ERROR_MEMORY 0x03
#define PGC_ERROR_OVERFLOW 0x04
#define PGC_ERROR_DIGIT 0x05
#define PGC_ERROR_OPCODE 0x06
#define PGC_ERROR_RUNNING 0x07
#define PGC_ERROR_STACK 0x08
#define PGC_ERROR_TOOLONG 0x09
#define PGC_ERROR_AREA 0x0A
#define PGC_ERROR_MISSING 0x0B
struct pgc;
typedef struct pgc_cl {
uint8_t *list;
uint32_t listmax;
uint32_t wrptr;
uint32_t rdptr;
uint32_t repeat;
struct pgc_cl *chain;
} pgc_cl_t;
typedef struct pgc_cmd {
char ascii[6];
uint8_t hex;
void (*handler)(struct pgc *);
int (*parser) (struct pgc *, pgc_cl_t *, int);
int p;
} pgc_cmd_t;
typedef struct pgc {
int8_t type; /* board type */
int8_t cga_enabled;
int8_t cga_selected;
volatile int8_t stopped;
mem_mapping_t mapping;
mem_mapping_t cga_mapping;
pgc_cl_t *clist,
*clcur;
const pgc_cmd_t *master,
*commands;
uint8_t mapram[2048]; /* host <> PGC communication buffer */
uint8_t *cga_vram;
uint8_t *vram;
char asc_command[7];
uint8_t hex_command;
uint32_t palette[256];
uint32_t userpal[256];
uint32_t maxw, maxh; /* maximum framebuffer size */
uint32_t visw, vish; /* maximum screen size */
uint32_t screenw, screenh;
int16_t pan_x, pan_y;
uint16_t win_x1, win_x2, win_y1, win_y2;
uint16_t vp_x1, vp_x2, vp_y1, vp_y2;
int16_t fill_pattern[16];
int16_t line_pattern;
uint8_t draw_mode;
uint8_t fill_mode;
uint8_t color;
uint8_t tjust_h; /* hor alignment 1=left 2=ctr 3=right*/
uint8_t tjust_v; /* vert alignment 1=bottom 2=ctr 3=top*/
int32_t tsize; /* horizontal spacing */
int32_t x, y, z; /* drawing position */
thread_t *pgc_thread;
event_t *pgc_wake_thread;
pc_timer_t wake_timer;
int waiting_input_fifo;
int waiting_output_fifo;
int waiting_error_fifo;
int ascii_mode;
int result_count;
int fontbase;
int linepos,
displine;
int vc;
int cgadispon;
int con, coff, cursoron, cgablink;
int vsynctime, vadj;
uint16_t ma, maback;
int oddeven;
uint64_t dispontime,
dispofftime;
pc_timer_t timer;
double native_pixel_clock;
int drawcursor;
int (*inputbyte)(struct pgc *, uint8_t *result);
} pgc_t;
/* I/O functions and worker thread handlers. */
extern void pgc_out(uint16_t addr, uint8_t val, void *priv);
extern uint8_t pgc_in(uint16_t addr, void *priv);
extern void pgc_write(uint32_t addr, uint8_t val, void *priv);
extern uint8_t pgc_read(uint32_t addr, void *priv);
extern void pgc_recalctimings(pgc_t *);
extern void pgc_poll(void *priv);
extern void pgc_reset(pgc_t *);
extern void pgc_wake(pgc_t *);
extern void pgc_sleep(pgc_t *);
extern void pgc_setdisplay(pgc_t *, int cga);
extern void pgc_speed_changed(void *priv);
extern void pgc_close(void *priv);
extern void pgc_init(pgc_t *,
int maxw, int maxh, int visw, int vish,
int (*inpbyte)(pgc_t *, uint8_t *), double npc);
/* Misc support functions. */
extern void pgc_sto_raster(pgc_t *, int16_t *x, int16_t *y);
extern void pgc_ito_raster(pgc_t *, int32_t *x, int32_t *y);
extern void pgc_dto_raster(pgc_t *, double *x, double *y);
//extern int pgc_input_byte(pgc_t *, uint8_t *val);
//extern int pgc_output_byte(pgc_t *, uint8_t val);
extern int pgc_output_string(pgc_t *, const char *val);
//extern int pgc_error_byte(pgc_t *, uint8_t val);
extern int pgc_error_string(pgc_t *, const char *val);
extern int pgc_error(pgc_t *, int err);
/* Graphics functions. */
extern uint8_t *pgc_vram_addr(pgc_t *, int16_t x, int16_t y);
extern void pgc_write_pixel(pgc_t *, uint16_t x, uint16_t y, uint8_t ink);
extern uint8_t pgc_read_pixel(pgc_t *, uint16_t x, uint16_t y);
extern void pgc_plot(pgc_t *, uint16_t x, uint16_t y);
extern uint16_t pgc_draw_line_r(pgc_t *, int32_t x1, int32_t y1,
int32_t x2, int32_t y2, uint16_t linemask);
extern void pgc_fill_line_r(pgc_t *, int32_t x0, int32_t x1, int32_t y);
extern uint16_t pgc_draw_line(pgc_t *, int32_t x1, int32_t y1,
int32_t x2, int32_t y2, uint16_t linemask);
extern void pgc_draw_ellipse(pgc_t *, int32_t x, int32_t y);
extern void pgc_fill_polygon(pgc_t *,
unsigned corners, int32_t *x, int32_t *y);
/* Command and parameter handling functions. */
extern int pgc_clist_byte(pgc_t *, uint8_t *val);
extern int pgc_cl_append(pgc_cl_t *, uint8_t v);
extern int pgc_parse_bytes(pgc_t *, pgc_cl_t *, int p);
extern int pgc_parse_words(pgc_t *, pgc_cl_t *, int p);
extern int pgc_parse_coords(pgc_t *, pgc_cl_t *, int p);
extern int pgc_param_byte(pgc_t *, uint8_t *val);
extern int pgc_param_word(pgc_t *, int16_t *val);
extern int pgc_param_coord(pgc_t *, int32_t *val);
extern int pgc_result_byte(pgc_t *, uint8_t val);
extern int pgc_result_word(pgc_t *, int16_t val);
extern int pgc_result_coord(pgc_t *, int32_t val);
/* Special overload functions for non-IBM implementations. */
extern void pgc_hndl_lut8(pgc_t *);
extern void pgc_hndl_lut8rd(pgc_t *);
#endif /*VID_PGC_H*/