This commit is contained in:
OBattler
2023-08-04 16:44:01 +02:00
29 changed files with 1112 additions and 833 deletions

View File

@@ -1723,6 +1723,7 @@ acpi_init(const device_t *info)
dev->suspend_types[2] = SUS_SUSPEND | SUS_NVR | SUS_RESET_CPU | SUS_RESET_PCI;
dev->suspend_types[3] = SUS_SUSPEND;
dev->suspend_types[5] = SUS_POWER_OFF; /* undocumented, used for S4/S5 by ASUS P5A ACPI table */
dev->suspend_types[7] = SUS_POWER_OFF; /* undocumented, used for S5 by Gigabyte GA-5AX ACPI table */
break;
case VEN_VIA:

View File

@@ -202,7 +202,7 @@ umc_8886_write(int func, int addr, uint8_t val, void *priv)
case 0x56:
dev->pci_conf_sb[func][addr] = val;
switch (val & 2) {
switch (val & 3) {
case 0:
cpu_set_isa_pci_div(3);
break;

View File

@@ -31,9 +31,13 @@ typedef struct ibm8514_t {
uint32_t vram_mask;
PALETTE vgapal;
uint8_t dac_mask, dac_status;
uint8_t dac_mask;
uint8_t dac_status;
uint32_t *map8;
int dac_addr, dac_pos, dac_r, dac_g;
int dac_addr;
int dac_pos;
int dac_r;
int dac_g;
int internal_pitch;
struct {
@@ -143,7 +147,7 @@ typedef struct ibm8514_t {
uint8_t *vram;
uint8_t *changedvram;
uint8_t linedbl;
uint8_t linedbl;
uint8_t data_available;
uint8_t data_available2;

View File

@@ -69,12 +69,12 @@ typedef struct cga_t {
} cga_t;
void cga_init(cga_t *cga);
void cga_out(uint16_t addr, uint8_t val, void *p);
uint8_t cga_in(uint16_t addr, void *p);
void cga_write(uint32_t addr, uint8_t val, void *p);
uint8_t cga_read(uint32_t addr, void *p);
void cga_out(uint16_t addr, uint8_t val, void *priv);
uint8_t cga_in(uint16_t addr, void *priv);
void cga_write(uint32_t addr, uint8_t val, void *priv);
uint8_t cga_read(uint32_t addr, void *priv);
void cga_recalctimings(cga_t *cga);
void cga_poll(void *p);
void cga_poll(void *priv);
#ifdef EMU_DEVICE_H
extern const device_config_t cga_config[];

View File

@@ -21,13 +21,11 @@
#ifndef VIDEO_CGA_COMP_H
#define VIDEO_CGA_COMP_H
#define Bit8u uint8_t
#define Bit32u uint32_t
#define Bitu unsigned int
#define bool uint8_t
#define Bitu unsigned int
#define bool uint8_t
void update_cga16_color(uint8_t cgamode);
void cga_comp_init(int revision);
Bit32u *Composite_Process(uint8_t cgamode, Bit8u border, Bit32u blocks /*, bool doublewidth*/, Bit32u *TempLine);
Bit32u *Composite_Process(uint8_t cgamode, uint8_t border, uint32_t blocks /*, bool doublewidth*/, uint32_t *TempLine);
#endif /*VIDEO_CGA_COMP_H*/

View File

@@ -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) && ega->vram_limit > 64*1024)
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

@@ -52,12 +52,12 @@ typedef struct mda_t {
void mda_init(mda_t *mda);
void mda_setcol(int chr, int blink, int fg, uint8_t cga_ink);
void mda_out(uint16_t addr, uint8_t val, void *p);
uint8_t mda_in(uint16_t addr, void *p);
void mda_write(uint32_t addr, uint8_t val, void *p);
uint8_t mda_read(uint32_t addr, void *p);
void mda_out(uint16_t addr, uint8_t val, void *priv);
uint8_t mda_in(uint16_t addr, void *priv);
void mda_write(uint32_t addr, uint8_t val, void *priv);
uint8_t mda_read(uint32_t addr, void *priv);
void mda_recalctimings(mda_t *mda);
void mda_poll(void *p);
void mda_poll(void *priv);
#ifdef EMU_DEVICE_H
extern const device_t mda_device;

View File

@@ -31,7 +31,7 @@
# define FLAG_NOSKEW 16
# define FLAG_ADDR_BY16 32
# define FLAG_RAMDAC_SHIFT 64
# define FLAG_ATI 128
# define FLAG_ATI 128
# define FLAG_S3_911_16BIT 256
# define FLAG_512K_MASK 512
struct monitor_t;
@@ -144,24 +144,24 @@ typedef struct svga_t {
For the example memory map, decode_mask would be 4MB-1 (4MB address space), vram_max would be 2MB
(present video memory only responds to first 2MB), vram_mask would be 1MB-1 (video memory wraps at 1MB)
*/
uint32_t decode_mask;
uint32_t vram_max;
uint32_t vram_mask;
uint32_t charseta;
uint32_t charsetb;
uint32_t adv_flags;
uint32_t ma_latch;
uint32_t ca_adj;
uint32_t ma;
uint32_t maback;
uint32_t write_bank;
uint32_t read_bank;
uint32_t extra_banks[2];
uint32_t banked_mask;
uint32_t ca;
uint32_t overscan_color;
uint32_t decode_mask;
uint32_t vram_max;
uint32_t vram_mask;
uint32_t charseta;
uint32_t charsetb;
uint32_t adv_flags;
uint32_t ma_latch;
uint32_t ca_adj;
uint32_t ma;
uint32_t maback;
uint32_t write_bank;
uint32_t read_bank;
uint32_t extra_banks[2];
uint32_t banked_mask;
uint32_t ca;
uint32_t overscan_color;
uint32_t *map8;
uint32_t pallook[512];
uint32_t pallook[512];
PALETTE vgapal;
@@ -183,8 +183,8 @@ typedef struct svga_t {
void (*render)(struct svga_t *svga);
void (*recalctimings_ex)(struct svga_t *svga);
void (*video_out)(uint16_t addr, uint8_t val, void *p);
uint8_t (*video_in)(uint16_t addr, void *p);
void (*video_out)(uint16_t addr, uint8_t val, void *priv);
uint8_t (*video_in)(uint16_t addr, void *priv);
void (*hwcursor_draw)(struct svga_t *svga, int displine);
@@ -195,7 +195,7 @@ typedef struct svga_t {
void (*vblank_start)(struct svga_t *svga);
void (*ven_write)(struct svga_t *svga, uint8_t val, uint32_t addr);
float (*getclock)(int clock, void *p);
float (*getclock)(int clock, void *priv);
/* Called when VC=R18 and friends. If this returns zero then MA resetting
is skipped. Matrox Mystique in Power mode reuses this counter for
@@ -205,17 +205,17 @@ typedef struct svga_t {
/*Called at the start of vertical sync*/
void (*vsync_callback)(struct svga_t *svga);
uint32_t (*translate_address)(uint32_t addr, void *p);
uint32_t (*translate_address)(uint32_t addr, void *priv);
/*If set then another device is driving the monitor output and the SVGA
card should not attempt to display anything */
int override;
void *priv;
uint8_t crtc[256];
uint8_t gdcreg[256];
uint8_t attrregs[32];
uint8_t seqregs[256];
uint8_t egapal[16];
uint8_t crtc[256];
uint8_t gdcreg[256];
uint8_t attrregs[32];
uint8_t seqregs[256];
uint8_t egapal[16];
uint8_t *vram;
uint8_t *changedvram;
@@ -266,55 +266,55 @@ typedef struct svga_t {
uint8_t monitor_index;
/* Pointer to monitor */
monitor_t* monitor;
monitor_t *monitor;
} svga_t;
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 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 *priv);
extern void ibm8514_ramdac_out(uint16_t port, uint8_t val, void *priv);
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);
extern int svga_init(const device_t *info, svga_t *svga, void *p, int memsize,
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 *p),
void (*video_out)(uint16_t addr, uint8_t val, void *p),
uint8_t (*video_in)(uint16_t addr, void *priv),
void (*video_out)(uint16_t addr, uint8_t val, void *priv),
void (*hwcursor_draw)(struct svga_t *svga, int displine),
void (*overlay_draw)(struct svga_t *svga, int displine));
extern void svga_recalctimings(svga_t *svga);
extern void svga_close(svga_t *svga);
uint8_t svga_read(uint32_t addr, void *p);
uint16_t svga_readw(uint32_t addr, void *p);
uint32_t svga_readl(uint32_t addr, void *p);
void svga_write(uint32_t addr, uint8_t val, void *p);
void svga_writew(uint32_t addr, uint16_t val, void *p);
void svga_writel(uint32_t addr, uint32_t val, void *p);
uint8_t svga_read_linear(uint32_t addr, void *p);
uint8_t svga_readb_linear(uint32_t addr, void *p);
uint16_t svga_readw_linear(uint32_t addr, void *p);
uint32_t svga_readl_linear(uint32_t addr, void *p);
void svga_write_linear(uint32_t addr, uint8_t val, void *p);
void svga_writeb_linear(uint32_t addr, uint8_t val, void *p);
void svga_writew_linear(uint32_t addr, uint16_t val, void *p);
void svga_writel_linear(uint32_t addr, uint32_t val, void *p);
uint8_t svga_read(uint32_t addr, void *priv);
uint16_t svga_readw(uint32_t addr, void *priv);
uint32_t svga_readl(uint32_t addr, void *priv);
void svga_write(uint32_t addr, uint8_t val, void *priv);
void svga_writew(uint32_t addr, uint16_t val, void *priv);
void svga_writel(uint32_t addr, uint32_t val, void *priv);
uint8_t svga_read_linear(uint32_t addr, void *priv);
uint8_t svga_readb_linear(uint32_t addr, void *priv);
uint16_t svga_readw_linear(uint32_t addr, void *priv);
uint32_t svga_readl_linear(uint32_t addr, void *priv);
void svga_write_linear(uint32_t addr, uint8_t val, void *priv);
void svga_writeb_linear(uint32_t addr, uint8_t val, void *priv);
void svga_writew_linear(uint32_t addr, uint16_t val, void *priv);
void svga_writel_linear(uint32_t addr, uint32_t val, void *priv);
void svga_add_status_info(char *s, int max_len, void *p);
void svga_add_status_info(char *s, int max_len, void *priv);
extern uint8_t svga_rotate[8][256];
void svga_out(uint16_t addr, uint8_t val, void *p);
uint8_t svga_in(uint16_t addr, void *p);
void svga_out(uint16_t addr, uint8_t val, void *priv);
uint8_t svga_in(uint16_t addr, void *priv);
svga_t *svga_get_pri(void);
void svga_set_override(svga_t *svga, int val);
@@ -334,65 +334,65 @@ enum {
/* We need a way to add a device with a pointer to a parent device so it can attach itself to it, and
possibly also a second ATi 68860 RAM DAC type that auto-sets SVGA render on RAM DAC render change. */
extern void ati68860_ramdac_out(uint16_t addr, uint8_t val, void *p, svga_t *svga);
extern uint8_t ati68860_ramdac_in(uint16_t addr, void *p, svga_t *svga);
extern void ati68860_set_ramdac_type(void *p, int type);
extern void ati68860_ramdac_set_render(void *p, svga_t *svga);
extern void ati68860_ramdac_set_pallook(void *p, int i, uint32_t col);
extern void ati68860_ramdac_out(uint16_t addr, uint8_t val, void *priv, svga_t *svga);
extern uint8_t ati68860_ramdac_in(uint16_t addr, void *priv, svga_t *svga);
extern void ati68860_set_ramdac_type(void *priv, int type);
extern void ati68860_ramdac_set_render(void *priv, svga_t *svga);
extern void ati68860_ramdac_set_pallook(void *priv, int i, uint32_t col);
extern void ati68860_hwcursor_draw(svga_t *svga, int displine);
extern void att49x_ramdac_out(uint16_t addr, int rs2, uint8_t val, void *p, svga_t *svga);
extern uint8_t att49x_ramdac_in(uint16_t addr, int rs2, void *p, svga_t *svga);
extern void att49x_ramdac_out(uint16_t addr, int rs2, uint8_t val, void *priv, svga_t *svga);
extern uint8_t att49x_ramdac_in(uint16_t addr, int rs2, void *priv, svga_t *svga);
extern void att498_ramdac_out(uint16_t addr, int rs2, uint8_t val, void *p, svga_t *svga);
extern uint8_t att498_ramdac_in(uint16_t addr, int rs2, void *p, svga_t *svga);
extern float av9194_getclock(int clock, void *p);
extern void att498_ramdac_out(uint16_t addr, int rs2, uint8_t val, void *priv, svga_t *svga);
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 bt48x_ramdac_out(uint16_t addr, int rs2, int rs3, uint8_t val, void *p, svga_t *svga);
extern uint8_t bt48x_ramdac_in(uint16_t addr, int rs2, int rs3, void *p, svga_t *svga);
extern void bt48x_recalctimings(void *p, 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);
extern void bt48x_hwcursor_draw(svga_t *svga, int displine);
extern void ibm_rgb528_ramdac_out(uint16_t addr, int rs2, uint8_t val, void *p, svga_t *svga);
extern uint8_t ibm_rgb528_ramdac_in(uint16_t addr, int rs2, void *p, svga_t *svga);
extern void ibm_rgb528_recalctimings(void *p, svga_t *svga);
extern void ibm_rgb528_ramdac_out(uint16_t addr, int rs2, uint8_t val, void *priv, svga_t *svga);
extern uint8_t ibm_rgb528_ramdac_in(uint16_t addr, int rs2, void *priv, svga_t *svga);
extern void ibm_rgb528_recalctimings(void *priv, svga_t *svga);
extern void ibm_rgb528_hwcursor_draw(svga_t *svga, int displine);
extern void icd2061_write(void *p, int val);
extern float icd2061_getclock(int clock, void *p);
extern void icd2061_write(void *priv, int val);
extern float icd2061_getclock(int clock, void *priv);
/* The code is the same, the #define's are so that the correct name can be used. */
# define ics9161_write icd2061_write
# define ics9161_getclock icd2061_getclock
extern float ics2494_getclock(int clock, void *p);
extern float ics2494_getclock(int clock, void *priv);
extern void ics2595_write(void *p, int strobe, int dat);
extern double ics2595_getclock(void *p);
extern void ics2595_setclock(void *p, double clock);
extern void ics2595_write(void *priv, int strobe, int dat);
extern double ics2595_getclock(void *priv);
extern void ics2595_setclock(void *priv, double clock);
extern void sc1148x_ramdac_out(uint16_t addr, int rs2, uint8_t val, void *p, svga_t *svga);
extern uint8_t sc1148x_ramdac_in(uint16_t addr, int rs2, void *p, svga_t *svga);
extern void sc1148x_ramdac_out(uint16_t addr, int rs2, uint8_t val, void *priv, svga_t *svga);
extern uint8_t sc1148x_ramdac_in(uint16_t addr, int rs2, void *priv, svga_t *svga);
extern void sc1502x_ramdac_out(uint16_t addr, uint8_t val, void *p, svga_t *svga);
extern uint8_t sc1502x_ramdac_in(uint16_t addr, void *p, svga_t *svga);
extern void sc1502x_ramdac_out(uint16_t addr, uint8_t val, void *priv, svga_t *svga);
extern uint8_t sc1502x_ramdac_in(uint16_t addr, void *priv, svga_t *svga);
extern void sdac_ramdac_out(uint16_t addr, int rs2, uint8_t val, void *p, svga_t *svga);
extern uint8_t sdac_ramdac_in(uint16_t addr, int rs2, void *p, svga_t *svga);
extern float sdac_getclock(int clock, void *p);
extern void sdac_ramdac_out(uint16_t addr, int rs2, uint8_t val, void *priv, svga_t *svga);
extern uint8_t sdac_ramdac_in(uint16_t addr, int rs2, void *priv, svga_t *svga);
extern float sdac_getclock(int clock, void *priv);
extern void stg_ramdac_out(uint16_t addr, uint8_t val, void *p, svga_t *svga);
extern uint8_t stg_ramdac_in(uint16_t addr, void *p, svga_t *svga);
extern float stg_getclock(int clock, void *p);
extern void stg_ramdac_out(uint16_t addr, uint8_t val, void *priv, svga_t *svga);
extern uint8_t stg_ramdac_in(uint16_t addr, void *priv, svga_t *svga);
extern float stg_getclock(int clock, void *priv);
extern void tkd8001_ramdac_out(uint16_t addr, uint8_t val, void *p, svga_t *svga);
extern uint8_t tkd8001_ramdac_in(uint16_t addr, void *p, svga_t *svga);
extern void tkd8001_ramdac_out(uint16_t addr, uint8_t val, void *priv, svga_t *svga);
extern uint8_t tkd8001_ramdac_in(uint16_t addr, void *priv, svga_t *svga);
extern void tvp3026_ramdac_out(uint16_t addr, int rs2, int rs3, uint8_t val, void *p, svga_t *svga);
extern uint8_t tvp3026_ramdac_in(uint16_t addr, int rs2, int rs3, void *p, svga_t *svga);
extern void tvp3026_recalctimings(void *p, svga_t *svga);
extern void tvp3026_ramdac_out(uint16_t addr, int rs2, int rs3, uint8_t val, void *priv, svga_t *svga);
extern uint8_t tvp3026_ramdac_in(uint16_t addr, int rs2, int rs3, void *priv, svga_t *svga);
extern void tvp3026_recalctimings(void *priv, svga_t *svga);
extern void tvp3026_hwcursor_draw(svga_t *svga, int displine);
extern float tvp3026_getclock(int clock, void *p);
extern float tvp3026_getclock(int clock, void *priv);
# ifdef EMU_DEVICE_H
extern const device_t ati68860_ramdac_device;

View File

@@ -30,7 +30,7 @@ typedef struct 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 *p);
uint8_t vga_in(uint16_t addr, void *p);
void vga_out(uint16_t addr, uint8_t val, void *priv);
uint8_t vga_in(uint16_t addr, void *priv);
#endif /*VIDEO_VGA_H*/

View File

@@ -20,7 +20,7 @@
#include <86box/rom.h>
typedef struct {
typedef struct xga_hwcursor_t {
int ena;
int x;
int y;
@@ -36,12 +36,15 @@ typedef struct xga_t {
mem_mapping_t linear_mapping;
mem_mapping_t video_mapping;
rom_t bios_rom;
rom_t vga_bios_rom;
xga_hwcursor_t hwcursor, hwcursor_latch;
rom_t vga_bios_rom;
xga_hwcursor_t hwcursor;
xga_hwcursor_t hwcursor_latch;
PALETTE extpal;
uint8_t test, atest[2], testpixel;
;
uint8_t test;
uint8_t atest[2];
uint8_t testpixel;
uint8_t pos_regs[8];
uint8_t disp_addr;
uint8_t cfg_reg;
@@ -54,34 +57,44 @@ typedef struct xga_t {
uint8_t regs_idx;
uint8_t hwc_hotspot_x;
uint8_t hwc_hotspot_y;
uint8_t disp_cntl_1, disp_cntl_2;
uint8_t clk_sel_1, clk_sel_2;
uint8_t disp_cntl_1;
uint8_t disp_cntl_2;
uint8_t clk_sel_1;
uint8_t clk_sel_2;
uint8_t hwc_control;
uint8_t bus_arb;
uint8_t isa_pos_enable;
uint8_t hwcursor_oddeven;
uint8_t cfg_reg_instance;
uint8_t rowcount;
uint8_t pal_idx, pal_idx_prefetch;
uint8_t pal_idx;
uint8_t pal_idx_prefetch;
uint8_t pal_seq;
uint8_t pal_mask;
uint8_t pal_r, pal_r_prefetch;
uint8_t pal_g, pal_g_prefetch;
uint8_t pal_b, pal_b_prefetch;
uint8_t pal_r;
uint8_t pal_r_prefetch;
uint8_t pal_g;
uint8_t pal_g_prefetch;
uint8_t pal_b;
uint8_t pal_b_prefetch;
uint8_t sprite_data[1024];
uint8_t scrollcache;
uint8_t border_color;
uint8_t direct_color;
uint8_t dma_channel;
uint8_t instance_isa, instance_num, ext_mem_addr;
uint8_t *vram, *changedvram;
uint8_t instance_isa;
uint8_t instance_num;
uint8_t ext_mem_addr;
uint8_t *vram;
uint8_t *changedvram;
int16_t hwc_pos_x;
int16_t hwc_pos_y;
uint16_t pos_idx;
uint16_t htotal;
uint16_t sprite_idx, sprite_idx_prefetch;
uint16_t sprite_idx;
uint16_t sprite_idx_prefetch;
uint16_t hdisp;
uint16_t vtotal;
uint16_t vdispend;
@@ -89,41 +102,74 @@ typedef struct xga_t {
uint16_t vsyncstart;
uint16_t linecmp;
uint16_t pix_map_width;
uint16_t sprite_pal_addr_idx, old_pal_addr_idx;
uint16_t sprite_pal_addr_idx;
uint16_t old_pal_addr_idx;
uint16_t sprite_pal_addr_idx_prefetch;
int v_total, dispend, v_syncstart, split, v_blankstart,
h_disp, h_disp_old, h_total, h_disp_time, rowoffset,
dispon, h_disp_on, vc, sc, linepos, oddeven, firstline, lastline,
firstline_draw, lastline_draw, displine, fullchange, interlace,
char_width, hwcursor_on;
int pal_pos, pal_pos_prefetch;
int v_total;
int dispend;
int v_syncstart;
int split;
int v_blankstart;
int h_disp;
int h_disp_old;
int h_total;
int h_disp_time;
int rowoffset;
int dispon;
int h_disp_on;
int vc;
int sc;
int linepos;
int oddeven;
int firstline;
int lastline;
int firstline_draw;
int lastline_draw;
int displine;
int fullchange;
int interlace;
int char_width;
int hwcursor_on;
int pal_pos;
int pal_pos_prefetch;
int on;
int op_mode_reset, linear_endian_reverse;
int sprite_pos, sprite_pos_prefetch, cursor_data_on;
int pal_test, a5_test;
int type, bus;
int op_mode_reset;
int linear_endian_reverse;
int sprite_pos;
int sprite_pos_prefetch;
int cursor_data_on;
int pal_test;
int a5_test;
int type;
int bus;
uint32_t linear_base, linear_size, banked_mask;
uint32_t linear_base;
uint32_t linear_size;
uint32_t banked_mask;
uint32_t base_addr_1mb;
uint32_t hwc_color0, hwc_color1;
uint32_t hwc_color0;
uint32_t hwc_color1;
uint32_t disp_start_addr;
uint32_t ma_latch;
uint32_t vram_size;
uint32_t vram_mask;
uint32_t rom_addr;
uint32_t ma, maback;
uint32_t ma;
uint32_t maback;
uint32_t extpallook[256];
uint32_t read_bank, write_bank;
uint32_t read_bank;
uint32_t write_bank;
uint32_t px_map_base;
uint64_t dispontime, dispofftime;
uint64_t dispontime;
uint64_t dispofftime;
struct
{
struct {
uint8_t control;
uint8_t px_map_idx;
uint8_t frgd_mix, bkgd_mix;
uint8_t frgd_mix;
uint8_t bkgd_mix;
uint8_t cc_cond;
uint8_t octant;
uint8_t draw_mode;
@@ -134,15 +180,19 @@ typedef struct xga_t {
uint8_t short_stroke_vector4;
int16_t bres_err_term;
int16_t bres_k1, bres_k2;
int16_t bres_k1;
int16_t bres_k2;
uint16_t blt_width;
uint16_t blt_height;
uint16_t mask_map_origin_x_off;
uint16_t mask_map_origin_y_off;
uint16_t src_map_x, src_map_y;
uint16_t dst_map_x, dst_map_y;
uint16_t pat_map_x, pat_map_y;
uint16_t src_map_x;
uint16_t src_map_y;
uint16_t dst_map_x;
uint16_t dst_map_y;
uint16_t pat_map_x;
uint16_t pat_map_y;
int ssv_state;
int pat_src;
@@ -150,7 +200,14 @@ typedef struct xga_t {
int dst_map;
int bkgd_src;
int fore_src;
int x, y, sx, sy, dx, dy, px, py;
int x;
int y;
int sx;
int sy;
int dx;
int dy;
int px;
int py;
int pattern;
int command_len;
@@ -158,7 +215,8 @@ typedef struct xga_t {
uint32_t color_cmp;
uint32_t carry_chain;
uint32_t plane_mask;
uint32_t frgd_color, bkgd_color;
uint32_t frgd_color;
uint32_t bkgd_color;
uint32_t command;
uint32_t dir_cmd;

View File

@@ -182,7 +182,7 @@ msgid "Take s&creenshot\tCtrl+F11"
msgstr "擷圖(&C)\tCtrl+F11"
msgid "&Preferences..."
msgstr "首選項(&P)..."
msgstr "偏好設定(&P)..."
msgid "Enable &Discord integration"
msgstr "啟用 Discord 整合(&D)"
@@ -278,7 +278,7 @@ msgid "&Remove shader"
msgstr "移除著色器(&R)"
msgid "Preferences"
msgstr "首選項"
msgstr "偏好設定"
msgid "Sound Gain"
msgstr "音量增益"
@@ -407,16 +407,16 @@ msgid "Joystick 4..."
msgstr "搖桿 4..."
msgid "Sound card 1:"
msgstr "音卡 1:"
msgstr "音卡 1:"
msgid "Sound card 2:"
msgstr "音卡 2:"
msgstr "音卡 2:"
msgid "Sound card 3:"
msgstr "音卡 3:"
msgstr "音卡 3:"
msgid "Sound card 4:"
msgstr "音卡 4:"
msgstr "音卡 4:"
msgid "MIDI Out Device:"
msgstr "MIDI 輸出裝置:"
@@ -557,7 +557,7 @@ msgid "Heads:"
msgstr "磁頭(H):"
msgid "Cylinders:"
msgstr "柱(C):"
msgstr "柱(C):"
msgid "Size (MB):"
msgstr "大小 (MB):"

View File

@@ -325,21 +325,15 @@ es1371_reset(void *priv)
/* Interrupt/Chip Select Control Register, Address 00H
Addressable as byte, word, longword */
dev->int_ctrl = 0xfc0f0000;
dev->int_ctrl = 0xfcff0000;
/* Interrupt/Chip Select Control Register, Address 00H
Addressable as longword only */
/* Bit 13 is supposed to be always 1 on ES1371, and one of the GPIO interrupt
flags on ES1373. The 5.12.01 WDM driver only initializes its GPIO interrupt
handler on chip revisions which support this feature (1371 >= 0x04 and 5880
all), but calls it anyway during interrupt servicing regardless of revision,
crashing on ES1371 as soon as an interrupt arrives while that bit is set.
Pending hardware research because actual early ES1371 cards are rare. */
dev->int_status = 0x7fffdec0;
dev->int_status = 0x7ffffec0;
/* UART Status Register, Address 09H
Addressable as byte only */
dev->uart_status = 0x00;
dev->uart_status = 0xff;
/* UART Control Register, Address 09H
Addressable as byte only */
@@ -347,15 +341,15 @@ es1371_reset(void *priv)
/* UART Reserved Register, Address 0AH
Addressable as byte only */
dev->uart_res = 0x00;
dev->uart_res = 0xff;
/* Memory Page Register, Address 0CH
Addressable as byte, word, longword */
dev->mem_page = 0x00;
dev->mem_page = 0xf0; /* FIXME: hardware reads 0xfffffff0 */
/* Sample Rate Converter Interface Register, Address 10H
Addressable as longword only */
dev->sr_cir = 0x00000000;
dev->sr_cir = 0x00470000;
/* CODEC Write Register, Address 14H
Addressable as longword only */
@@ -363,7 +357,7 @@ es1371_reset(void *priv)
/* Legacy Control/Status Register, Address 18H
Addressable as byte, word, longword */
dev->legacy_ctrl = 0x0000f800;
dev->legacy_ctrl = 0x0000f801;
/* Serial Interface Control Register, Address 20H
Addressable as byte, word, longword */
@@ -371,17 +365,17 @@ es1371_reset(void *priv)
/* DAC1 Channel Sample Count Register, Address 24H
Addressable as word, longword */
dev->dac[0].samp_ct = 0x00000000;
dev->dac[0].samp_ct = 0x00000000; /* FIXME: hardware reads 0x00010000 */
dev->dac[0].curr_samp_ct = 0x00000000;
/* DAC2 Channel Sample Count Register, Address 28H
Addressable as word, longword */
dev->dac[1].samp_ct = 0x00000000;
dev->dac[1].samp_ct = 0x00000000; /* FIXME: hardware reads 0x00010000 */
dev->dac[1].curr_samp_ct = 0x00000000;
/* ADC Channel Sample Count Register, Address 2CH
Addressable as word, longword */
dev->adc.samp_ct = 0x00000000;
dev->adc.samp_ct = 0x00000000; /* FIXME: hardware reads 0x00010000 */
dev->adc.curr_samp_ct = 0x00000000;
/* DAC1 Frame Register 1, Address 30H, Memory Page 1100b
@@ -1632,7 +1626,7 @@ es1371_pci_read(int func, int addr, void *priv)
return 0x00;
case 0x08:
return 0x02; /* Revision ID - 0x02 is supposed to be early Ensoniq-branded ES1371 but unconfirmed */
return 0x02; /* Revision ID - 0x02 is actual Ensoniq-branded ES1371 */
case 0x09:
return 0x00; /* Multimedia audio device */
case 0x0a:

View File

@@ -212,7 +212,7 @@ int ibm8514_has_vga = 0;
int
ibm8514_cpu_src(svga_t *svga)
{
ibm8514_t *dev = &svga->dev8514;
const ibm8514_t *dev = &svga->dev8514;
if (!(dev->accel.cmd & 0x100))
return 0;
@@ -226,7 +226,7 @@ ibm8514_cpu_src(svga_t *svga)
int
ibm8514_cpu_dest(svga_t *svga)
{
ibm8514_t *dev = &svga->dev8514;
const ibm8514_t *dev = &svga->dev8514;
if (!(dev->accel.cmd & 0x100))
return 0;
@@ -240,16 +240,16 @@ ibm8514_cpu_dest(svga_t *svga)
void
ibm8514_accel_out_pixtrans(svga_t *svga, UNUSED(uint16_t port), uint16_t val, int len)
{
ibm8514_t *dev = &svga->dev8514;
uint8_t nibble = 0;
uint32_t pixelxfer = 0;
uint32_t monoxfer = 0xffffffff;
int pixcnt = 0;
int pixcntl = (dev->accel.multifunc[0x0a] >> 6) & 3;
int frgd_mix = (dev->accel.frgd_mix >> 5) & 3;
int bkgd_mix = (dev->accel.bkgd_mix >> 5) & 3;
int cmd = dev->accel.cmd >> 13;
int and3 = dev->accel.cur_x & 3;
ibm8514_t *dev = &svga->dev8514;
uint8_t nibble = 0;
uint32_t pixelxfer = 0;
uint32_t monoxfer = 0xffffffff;
int pixcnt = 0;
int pixcntl = (dev->accel.multifunc[0x0a] >> 6) & 3;
int frgd_mix = (dev->accel.frgd_mix >> 5) & 3;
int bkgd_mix = (dev->accel.bkgd_mix >> 5) & 3;
int cmd = dev->accel.cmd >> 13;
int and3 = dev->accel.cur_x & 3;
if (dev->accel.cmd & 0x100) {
if (len != 1) {
@@ -537,7 +537,7 @@ ibm8514_accel_out_fifo(svga_t *svga, uint16_t port, uint32_t val, int len)
if (len != 1)
dev->test = val;
#ifdef FALLTHROUGH_ANNOTATION
[[fallthrough]];
[[fallthrough]];
#endif
case 0xd2e8:
if (len == 1)
@@ -981,8 +981,8 @@ ibm8514_accel_out(uint16_t port, uint32_t val, svga_t *svga, int len)
if (!val)
break;
dev->accel.advfunc_cntl = val & 7;
ibm8514_on = (dev->accel.advfunc_cntl & 1);
vga_on = !ibm8514_on;
ibm8514_on = (dev->accel.advfunc_cntl & 1);
vga_on = !ibm8514_on;
ibm8514_log("IBM 8514/A: VGA ON = %i, val = %02x\n", vga_on, val);
svga_recalctimings(svga);
break;
@@ -1013,8 +1013,8 @@ ibm8514_accel_in(uint16_t port, svga_t *svga, int len)
ibm8514_t *dev = &svga->dev8514;
uint32_t temp = 0;
int cmd;
int vpos = dev->displine + svga->y_add;
int vblankend = svga->vblankstart + svga->crtc[0x16];
int vpos = dev->displine + svga->y_add;
int vblankend = svga->vblankstart + svga->crtc[0x16];
switch (port) {
case 0x2e8:
@@ -1024,7 +1024,7 @@ ibm8514_accel_in(uint16_t port, svga_t *svga, int len)
if (vpos >= svga->vblankstart || vpos <= vblankend)
temp |= 2;
} else {
if (vpos >= svga->vblankstart && vpos <= vblankend)
if (vpos >= svga->vblankstart && vpos <= vblankend)
temp |= 2;
}
break;
@@ -1059,7 +1059,7 @@ ibm8514_accel_in(uint16_t port, svga_t *svga, int len)
if (vpos >= svga->vblankstart || vpos <= vblankend)
dev->subsys_stat |= 1;
} else {
if (vpos >= svga->vblankstart && vpos <= vblankend)
if (vpos >= svga->vblankstart && vpos <= vblankend)
dev->subsys_stat |= 1;
}
if (len != 1) {
@@ -1140,6 +1140,7 @@ static uint8_t
ibm8514_accel_inb(uint16_t port, void *priv)
{
svga_t *svga = (svga_t *) priv;
return ibm8514_accel_in(port, svga, 1);
}
@@ -1147,6 +1148,7 @@ static uint16_t
ibm8514_accel_inw(uint16_t port, void *priv)
{
svga_t *svga = (svga_t *) priv;
return ibm8514_accel_in(port, svga, 2);
}
@@ -1171,8 +1173,8 @@ ibm8514_short_stroke_start(int count, int cpu_input, uint32_t mix_dat, uint32_t
void
ibm8514_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, svga_t *svga, UNUSED(int len))
{
ibm8514_t *dev = &svga->dev8514;
uint16_t *vram_w = (uint16_t *)svga->vram;
ibm8514_t *dev = &svga->dev8514;
uint16_t *vram_w = (uint16_t *) svga->vram;
uint16_t src_dat = 0;
uint16_t dest_dat;
uint16_t old_dest_dat;
@@ -1181,7 +1183,7 @@ ibm8514_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat
uint16_t clip_b = dev->accel.multifunc[3];
uint16_t clip_r = dev->accel.multifunc[4];
int pixcntl = (dev->accel.multifunc[0x0a] >> 6) & 3;
uint16_t mix_mask = ((svga->bpp == 8) || (svga->bpp == 24)) ? 0x80 : 0x8000;
uint16_t mix_mask = ((svga->bpp == 8) || (svga->bpp == 24)) ? 0x80 : 0x8000;
uint16_t compare = dev->accel.color_cmp;
int compare_mode = dev->accel.multifunc[0x0a] & 0x38;
int cmd = dev->accel.cmd >> 13;
@@ -1340,9 +1342,9 @@ ibm8514_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat
READ((dev->accel.cy * dev->pitch) + dev->accel.cx, dest_dat);
if ((compare_mode == 0) || ((compare_mode == 0x10) && (dest_dat >= compare)) || ((compare_mode == 0x18) && (dest_dat < compare)) || ((compare_mode == 0x20) && (dest_dat != compare)) || ((compare_mode == 0x28) && (dest_dat == compare)) || ((compare_mode == 0x30) && (dest_dat <= compare)) || ((compare_mode == 0x38) && (dest_dat > compare))) {
old_dest_dat = dest_dat;
old_dest_dat = dest_dat;
MIX(mix_dat & mix_mask, dest_dat, src_dat);
dest_dat = (dest_dat & wrt_mask) | (old_dest_dat & ~wrt_mask);
dest_dat = (dest_dat & wrt_mask) | (old_dest_dat & ~wrt_mask);
if (dev->accel.ssv_draw) {
if ((dev->accel.cmd & 4) && dev->accel.ssv_len) {
@@ -2021,10 +2023,10 @@ ibm8514_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat
dev->accel.cy |= ~0x5ff;
if (dev->local && dev->accel.ge_offset && (svga->bpp == 24))
dev->accel.dest = (dev->accel.ge_offset << 2) + (dev->accel.cy * dev->pitch);
dev->accel.dest = (dev->accel.ge_offset << 2) + (dev->accel.cy * dev->pitch);
else
dev->accel.dest = dev->accel.cy * dev->pitch;
dev->accel.dest = dev->accel.cy * dev->pitch;
dev->accel.fill_state = 0;
if (cmd == 4)
@@ -2071,7 +2073,7 @@ ibm8514_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat
} else {
if (!(dev->accel.cmd & 0x40) && (frgd_mix == 2) && (bkgd_mix == 2) && (pixcntl == 0) && (cmd == 2)) {
if (!(dev->accel.sx & 1)) {
dev->accel.output = 1;
dev->accel.output = 1;
if (dev->local && dev->accel.ge_offset && (svga->bpp == 24))
dev->accel.newdest_out = (dev->accel.ge_offset << 2) + ((dev->accel.cy + 1) * dev->pitch);
else
@@ -2349,9 +2351,9 @@ rect_fill_pix:
dev->accel.cy--;
if (dev->local && dev->accel.ge_offset && (svga->bpp == 24))
dev->accel.dest = (dev->accel.ge_offset << 2) + (dev->accel.cy * dev->pitch);
dev->accel.dest = (dev->accel.ge_offset << 2) + (dev->accel.cy * dev->pitch);
else
dev->accel.dest = dev->accel.cy * dev->pitch;
dev->accel.dest = dev->accel.cy * dev->pitch;
dev->accel.sy--;
return;
@@ -2441,9 +2443,9 @@ rect_fill_pix:
dev->accel.cy--;
if (dev->local && dev->accel.ge_offset && (svga->bpp == 24))
dev->accel.dest = (dev->accel.ge_offset << 2) + (dev->accel.cy * dev->pitch);
dev->accel.dest = (dev->accel.ge_offset << 2) + (dev->accel.cy * dev->pitch);
else
dev->accel.dest = dev->accel.cy * dev->pitch;
dev->accel.dest = dev->accel.cy * dev->pitch;
dev->accel.sy--;
return;
@@ -2975,15 +2977,15 @@ rect_fill:
case 5: /*Draw Polygon Boundary Line*/
if (!cpu_input) {
dev->accel.cx = dev->accel.cur_x;
dev->accel.cy = dev->accel.cur_y;
dev->accel.cx = dev->accel.cur_x;
dev->accel.cy = dev->accel.cur_y;
if (dev->accel.cur_x >= 0x600)
dev->accel.cx |= ~0x5ff;
if (dev->accel.cur_y >= 0x600)
dev->accel.cy |= ~0x5ff;
dev->accel.oldcy = dev->accel.cy;
dev->accel.sy = 0;
dev->accel.sy = 0;
if (ibm8514_cpu_src(svga)) {
dev->data_available = 0;
@@ -3259,7 +3261,7 @@ bitblt_pix:
dev->accel.cy--;
}
dev->accel.src = dev->accel.cy * dev->pitch;
dev->accel.src = dev->accel.cy * dev->pitch;
dev->accel.dest = dev->accel.dy * dev->pitch;
dev->accel.sy--;
return;
@@ -3626,8 +3628,8 @@ bitblt:
int64_t cx;
int64_t dx;
cx = (int64_t)dev->accel.cx;
dx = (int64_t)dev->accel.dx;
cx = (int64_t) dev->accel.cx;
dx = (int64_t) dev->accel.dx;
while (1) {
if ((dx >= (((int64_t)dev->accel.clip_left) * 3)) && (dx <= (((uint64_t)clip_r) * 3)) &&
@@ -3864,7 +3866,7 @@ ibm8514_poll(ibm8514_t *dev, svga_t *svga)
dev->linepos = 0;
if (dev->dispon) {
if (dev->sc == dev->rowcount) {
dev->sc = 0;
dev->sc = 0;
dev->maback += (dev->rowoffset << 3);
if (dev->interlace)
dev->maback += (dev->rowoffset << 3);
@@ -3940,13 +3942,13 @@ ibm8514_recalctimings(svga_t *svga)
ibm8514_t *dev = &svga->dev8514;
if (ibm8514_on) {
dev->h_disp = (dev->hdisp + 1) << 3;
dev->pitch = (dev->accel.advfunc_cntl & 4) ? 1024 : 640;
dev->h_total = (dev->htotal + 1);
dev->v_total = (dev->vtotal + 1);
dev->v_syncstart = (dev->vsyncstart + 1);
dev->rowcount = !!(dev->disp_cntl & 0x08);
dev->dispend = ((dev->vdisp >> 1) + 1);
dev->h_disp = (dev->hdisp + 1) << 3;
dev->pitch = (dev->accel.advfunc_cntl & 4) ? 1024 : 640;
dev->h_total = (dev->htotal + 1);
dev->v_total = (dev->vtotal + 1);
dev->v_syncstart = (dev->vsyncstart + 1);
dev->rowcount = !!(dev->disp_cntl & 0x08);
dev->dispend = ((dev->vdisp >> 1) + 1);
if (dev->dispend == 766)
dev->dispend = 768;
@@ -3956,9 +3958,9 @@ ibm8514_recalctimings(svga_t *svga)
if (dev->accel.advfunc_cntl & 4) {
if (!vga_on && dev->ibm_mode) {
if (dev->h_disp == 8) {
dev->h_disp = 1024;
dev->dispend = 768;
dev->v_total = 1536;
dev->h_disp = 1024;
dev->dispend = 768;
dev->v_total = 1536;
dev->v_syncstart = 1536;
}
}
@@ -3976,7 +3978,7 @@ ibm8514_recalctimings(svga_t *svga)
}
if (ibm8514_has_vga) {
dev->pitch = dev->ext_pitch;
dev->pitch = dev->ext_pitch;
dev->rowoffset = dev->ext_crt_pitch;
} else
dev->rowoffset = 128;
@@ -3986,7 +3988,7 @@ ibm8514_recalctimings(svga_t *svga)
} else {
if (!vga_on && dev->ibm_mode) {
if (dev->h_disp == 1024) {
dev->h_disp = 640;
dev->h_disp = 640;
dev->dispend = 480;
}
}
@@ -4001,7 +4003,7 @@ ibm8514_recalctimings(svga_t *svga)
}
if (ibm8514_has_vga) {
dev->pitch = dev->ext_pitch;
dev->pitch = dev->ext_pitch;
dev->rowoffset = dev->ext_crt_pitch;
} else
dev->rowoffset = 128;
@@ -4017,8 +4019,8 @@ ibm8514_recalctimings(svga_t *svga)
static uint8_t
ibm8514_mca_read(int port, void *priv)
{
svga_t *svga = (svga_t *) priv;
ibm8514_t *dev = &svga->dev8514;
const svga_t *svga = (svga_t *) priv;
const ibm8514_t *dev = &svga->dev8514;
return (dev->pos_regs[port & 7]);
}
@@ -4040,15 +4042,14 @@ ibm8514_mca_write(int port, uint8_t val, void *priv)
static uint8_t
ibm8514_mca_feedb(void *priv)
{
svga_t *svga = (svga_t *) priv;
ibm8514_t *dev = &svga->dev8514;
const svga_t *svga = (svga_t *) priv;
const ibm8514_t *dev = &svga->dev8514;
return dev->pos_regs[2] & 1;
}
static void
*
ibm8514_init(const device_t *info)
static void *
ibm8514_init(const device_t *info)
{
if (svga_get_pri() == NULL)
return NULL;
@@ -4062,9 +4063,9 @@ static void
dev->vram_mask = dev->vram_size - 1;
dev->map8 = svga->pallook;
dev->type = info->flags;
dev->type = info->flags;
dev->ibm_mode = 1;
dev->bpp = 8;
dev->bpp = 8;
ibm8514_io_set(svga);

View File

@@ -171,7 +171,7 @@ ati18800_in(uint16_t addr, void *priv)
static void
ati18800_recalctimings(svga_t *svga)
{
ati18800_t *ati18800 = (ati18800_t *) svga->priv;
const ati18800_t *ati18800 = (ati18800_t *) svga->priv;
if (svga->crtc[0x17] & 4) {
svga->vtotal <<= 1;

View File

@@ -357,10 +357,10 @@ ati28800_in(uint16_t addr, void *priv)
static uint8_t
ati28800k_in(uint16_t addr, void *priv)
{
ati28800_t *ati28800 = (ati28800_t *) priv;
svga_t *svga = &ati28800->svga;
uint16_t oldaddr = addr;
uint8_t temp = 0xFF;
ati28800_t *ati28800 = (ati28800_t *) priv;
const svga_t *svga = &ati28800->svga;
uint16_t oldaddr = addr;
uint8_t temp = 0xFF;
if (addr != 0x3da)
ati28800_log("ati28800k_in : %04X ", addr);
@@ -400,7 +400,7 @@ ati28800k_in(uint16_t addr, void *priv)
static void
ati28800_recalctimings(svga_t *svga)
{
ati28800_t *ati28800 = (ati28800_t *) svga->priv;
const ati28800_t *ati28800 = (ati28800_t *) svga->priv;
if (ati28800->regs[0xa3] & 0x10)
svga->ma_latch |= 0x10000;
@@ -532,7 +532,7 @@ ati28800_recalctimings(svga_t *svga)
static void
ati28800k_recalctimings(svga_t *svga)
{
ati28800_t *ati28800 = (ati28800_t *) svga->priv;
const ati28800_t *ati28800 = (ati28800_t *) svga->priv;
ati28800_recalctimings(svga);

View File

@@ -35,7 +35,7 @@ ati_eeprom_load(ati_eeprom_t *eeprom, char *fn, int type)
int size;
eeprom->type = type;
strncpy(eeprom->fn, fn, sizeof(eeprom->fn) - 1);
fp = nvr_fopen(eeprom->fn, "rb");
fp = nvr_fopen(eeprom->fn, "rb");
size = eeprom->type ? 512 : 128;
if (!fp) {
memset(eeprom->data, 0xff, size);
@@ -53,7 +53,7 @@ ati_eeprom_load_mach8(ati_eeprom_t *eeprom, char *fn)
int size;
eeprom->type = 0;
strncpy(eeprom->fn, fn, sizeof(eeprom->fn) - 1);
fp = nvr_fopen(eeprom->fn, "rb");
fp = nvr_fopen(eeprom->fn, "rb");
size = 128;
if (!fp) { /*The ATI Graphics Ultra bios expects an immediate write to nvram if none is present at boot time otherwise
it would hang the machine.*/
@@ -95,7 +95,7 @@ ati_eeprom_write(ati_eeprom_t *eeprom, int ena, int clk, int dat)
break;
eeprom->state = EEPROM_OPCODE;
#ifdef FALLTHROUGH_ANNOTATION
[[fallthrough]];
[[fallthrough]];
#endif
case EEPROM_OPCODE:
eeprom->opcode = (eeprom->opcode << 1) | (dat ? 1 : 0);

View File

@@ -91,7 +91,8 @@ typedef struct mach64_t {
uint8_t regs[256];
int index;
int type, pci;
int type;
int pci;
uint8_t pci_regs[256];
uint8_t int_line;
@@ -503,7 +504,7 @@ mach64_in(uint16_t addr, void *priv)
void
mach64_recalctimings(svga_t *svga)
{
mach64_t *mach64 = (mach64_t *) svga->priv;
const mach64_t *mach64 = (mach64_t *) svga->priv;
if (((mach64->crtc_gen_cntl >> 24) & 3) == 3) {
svga->vtotal = (mach64->crtc_v_total_disp & 2047) + 1;
@@ -678,7 +679,7 @@ mach64_wait_fifo_idle(mach64_t *mach64)
}
#define READ8(addr, var) \
switch ((addr) & 3) { \
switch ((addr) &3) { \
case 0: \
ret = (var) &0xff; \
break; \
@@ -694,7 +695,7 @@ mach64_wait_fifo_idle(mach64_t *mach64)
}
#define WRITE8(addr, var, val) \
switch ((addr) & 3) { \
switch ((addr) &3) { \
case 0: \
var = (var & 0xffffff00) | (val); \
break; \
@@ -749,7 +750,7 @@ mach64_accel_write_fifo(mach64_t *mach64, uint32_t addr, uint8_t val)
case 0x11f:
WRITE8(addr, mach64->dst_height_width, val);
#ifdef FALLTHROUGH_ANNOTATION
[[fallthrough]];
[[fallthrough]];
#endif
case 0x113:
if (((addr & 0x3ff) == 0x11b || (addr & 0x3ff) == 0x11f || (addr & 0x3ff) == 0x113) && !(val & 0x80)) {
@@ -974,7 +975,7 @@ mach64_accel_write_fifo(mach64_t *mach64, uint32_t addr, uint8_t val)
case 0x2a5:
addr += 2;
#ifdef FALLTHROUGH_ANNOTATION
[[fallthrough]];
[[fallthrough]];
#endif
case 0x2aa:
case 0x2ab:
@@ -991,7 +992,7 @@ mach64_accel_write_fifo(mach64_t *mach64, uint32_t addr, uint8_t val)
case 0x2b1:
addr += 2;
#ifdef FALLTHROUGH_ANNOTATION
[[fallthrough]];
[[fallthrough]];
#endif
case 0x2b6:
case 0x2b7:
@@ -1245,8 +1246,8 @@ mach64_queue(mach64_t *mach64, uint32_t addr, uint32_t val, uint32_t type)
void
mach64_start_fill(mach64_t *mach64)
{
mach64->accel.dst_x = 0;
mach64->accel.dst_y = 0;
mach64->accel.dst_x = 0;
mach64->accel.dst_y = 0;
mach64->accel.dst_x_start = (mach64->dst_y_x >> 16) & 0xfff;
if ((mach64->dst_y_x >> 16) & 0x1000)
@@ -1263,11 +1264,11 @@ mach64_start_fill(mach64_t *mach64)
mach64->accel.dst_width = (mach64->accel.dst_width & ~7) + 8;
}
mach64->accel.x_count = mach64->accel.dst_width;
mach64->accel.x_count = mach64->accel.dst_width;
mach64->accel.xx_count = 0;
mach64->accel.src_x = 0;
mach64->accel.src_y = 0;
mach64->accel.src_x = 0;
mach64->accel.src_y = 0;
mach64->accel.src_x_start = (mach64->src_y_x >> 16) & 0xfff;
if ((mach64->src_y_x >> 16) & 0x1000)
@@ -1571,12 +1572,12 @@ mach64_blit(uint32_t cpu_dat, int count, mach64_t *mach64)
switch (mach64->accel.op) {
case OP_RECT:
while (count) {
uint8_t write_mask = 0;
uint32_t src_dat = 0;
uint8_t write_mask = 0;
uint32_t src_dat = 0;
uint32_t dest_dat;
uint32_t host_dat = 0;
uint32_t old_dest_dat;
int mix = 0;
int mix = 0;
int dst_x;
int dst_y;
int src_x;
@@ -1710,7 +1711,7 @@ mach64_blit(uint32_t cpu_dat, int count, mach64_t *mach64)
}
if (!(mach64->dst_cntl & DST_POLYGON_EN) || mach64->accel.poly_draw) {
READ(mach64->accel.dst_offset + ((dst_y) * mach64->accel.dst_pitch) + (dst_x), dest_dat, mach64->accel.dst_size);
READ(mach64->accel.dst_offset + ((dst_y) *mach64->accel.dst_pitch) + (dst_x), dest_dat, mach64->accel.dst_size);
switch (mach64->accel.clr_cmp_fn) {
case 1: /*TRUE*/
@@ -1777,8 +1778,8 @@ mach64_blit(uint32_t cpu_dat, int count, mach64_t *mach64)
mach64->accel.x_count--;
if (mach64->accel.x_count <= 0) {
mach64->accel.xx_count = 0;
mach64->accel.x_count = mach64->accel.dst_width;
mach64->accel.dst_x = 0;
mach64->accel.x_count = mach64->accel.dst_width;
mach64->accel.dst_x = 0;
mach64->accel.dst_y += mach64->accel.yinc;
mach64->accel.src_x_start = (mach64->src_y_x >> 16) & 0xfff;
mach64->accel.src_x_count = mach64->accel.src_width1;
@@ -1830,7 +1831,7 @@ mach64_blit(uint32_t cpu_dat, int count, mach64_t *mach64)
if (((mach64->crtc_gen_cntl >> 8) & 7) == BPP_24) {
int x = 0;
while (count) {
uint32_t src_dat = 0;
uint32_t src_dat = 0;
uint32_t dest_dat;
uint32_t host_dat = 0;
int mix = 0;
@@ -1965,7 +1966,7 @@ mach64_blit(uint32_t cpu_dat, int count, mach64_t *mach64)
}
} else {
while (count) {
uint32_t src_dat = 0;
uint32_t src_dat = 0;
uint32_t dest_dat;
uint32_t host_dat = 0;
int mix = 0;
@@ -2879,8 +2880,9 @@ mach64_ext_readb(uint32_t addr, void *priv)
uint16_t
mach64_ext_readw(uint32_t addr, void *priv)
{
mach64_t *mach64 = (mach64_t *) priv;
const mach64_t *mach64 = (mach64_t *) priv;
uint16_t ret;
if (!(addr & 0x400)) {
mach64_log("nmach64_ext_readw: addr=%04x\n", addr);
ret = 0xffff;
@@ -2907,8 +2909,9 @@ mach64_ext_readw(uint32_t addr, void *priv)
uint32_t
mach64_ext_readl(uint32_t addr, void *priv)
{
mach64_t *mach64 = (mach64_t *) priv;
uint32_t ret;
const mach64_t *mach64 = (mach64_t *) priv;
uint32_t ret;
if (!(addr & 0x400)) {
mach64_log("nmach64_ext_readl: addr=%04x\n", addr);
ret = 0xffffffff;
@@ -3317,7 +3320,7 @@ uint8_t
mach64_ext_inb(uint16_t port, void *priv)
{
mach64_t *mach64 = (mach64_t *) priv;
uint8_t ret = 0xff;
uint8_t ret = 0xff;
switch (port) {
case 0x02ec:
@@ -4036,9 +4039,9 @@ mach64_overlay_draw(svga_t *svga, int displine)
}
} else {
for (x = 0; x < mach64->svga.overlay_latch.cur_xsize; x++) {
int h = h_acc >> 12;
int gr_cmp = 0;
int vid_cmp = 0;
int h = h_acc >> 12;
int gr_cmp = 0;
int vid_cmp = 0;
int use_video = 0;
switch (video_key_fn) {
@@ -4216,7 +4219,7 @@ mach64_io_set(mach64_t *mach64)
uint8_t
mach64_pci_read(UNUSED(int func), int addr, void *priv)
{
mach64_t *mach64 = (mach64_t *) priv;
const mach64_t *mach64 = (mach64_t *) priv;
switch (addr) {
case 0x00:
@@ -4448,7 +4451,7 @@ mach64gx_init(const device_t *info)
mach64->type = MACH64_GX;
mach64->pci = !!(info->flags & DEVICE_PCI);
mach64->pci_id = (int) 'X' | ((int) 'G' << 8);
mach64->pci_id = 'X' | ('G' << 8);
mach64->config_chip_id = 0x000000d7;
mach64->dac_cntl = 5 << 16; /*ATI 68860 RAMDAC*/
mach64->config_stat0 = (5 << 9) | (3 << 3); /*ATI-68860, 256Kx16 DRAM*/

File diff suppressed because it is too large Load Diff

View File

@@ -99,7 +99,7 @@ cga_out(uint16_t addr, uint8_t val, void *priv)
uint8_t
cga_in(uint16_t addr, void *priv)
{
cga_t *cga = (cga_t *) priv;
const cga_t *cga = (cga_t *) priv;
uint8_t ret = 0xff;
@@ -135,7 +135,7 @@ cga_pravetz_out(UNUSED(uint16_t addr), uint8_t val, void *priv)
uint8_t
cga_pravetz_in(UNUSED(uint16_t addr), void *priv)
{
cga_t *cga = (cga_t *) priv;
const cga_t *cga = (cga_t *) priv;
return (cga->fontbase >> 8);
}

View File

@@ -172,7 +172,7 @@ update_cga16_color(uint8_t cgamode)
video_sharpness = (int) (sharpness * 256 / 100);
}
static Bit8u
static uint8_t
byte_clamp(int v)
{
v >>= 13;
@@ -186,21 +186,20 @@ static int temp[SCALER_MAXWIDTH + 10] = { 0 };
static int atemp[SCALER_MAXWIDTH + 2] = { 0 };
static int btemp[SCALER_MAXWIDTH + 2] = { 0 };
Bit32u *
Composite_Process(uint8_t cgamode, Bit8u border, Bit32u blocks /*, bool doublewidth*/, Bit32u *TempLine)
uint32_t *
Composite_Process(uint8_t cgamode, uint8_t border, uint32_t blocks /*, bool doublewidth*/, uint32_t *TempLine)
{
int x;
Bit32u x2;
uint32_t x2;
int w = blocks * 4;
int *o;
Bit32u *rgbi;
int *b;
int *i;
Bit32u *srgb;
int *ap;
int *bp;
int *o;
const uint32_t *rgbi;
const int *b;
int *i;
uint32_t *srgb;
int *ap;
int *bp;
#define COMPOSITE_CONVERT(I, Q) \
do { \
@@ -230,15 +229,15 @@ Composite_Process(uint8_t cgamode, Bit8u border, Bit32u blocks /*, bool doublewi
o = temp;
rgbi = TempLine;
b = &CGA_Composite_Table[border * 68];
for (x = 0; x < 4; ++x)
for (uint8_t x = 0; x < 4; ++x)
OUT(b[(x + 3) & 3]);
OUT(CGA_Composite_Table[(border << 6) | ((*rgbi & 0x0f) << 2) | 3]);
for (x = 0; x < w - 1; ++x) {
for (int x = 0; x < w - 1; ++x) {
OUT(CGA_Composite_Table[((rgbi[0] & 0x0f) << 6) | ((rgbi[1] & 0x0f) << 2) | (x & 3)]);
++rgbi;
}
OUT(CGA_Composite_Table[((*rgbi & 0x0f) << 6) | (border << 2) | 3]);
for (x = 0; x < 5; ++x)
for (uint8_t x = 0; x < 5; ++x)
OUT(b[x & 3]);
if ((cgamode & 4) != 0) {
@@ -258,7 +257,7 @@ Composite_Process(uint8_t cgamode, Bit8u border, Bit32u blocks /*, bool doublewi
i = temp + 4;
ap = atemp + 1;
bp = btemp + 1;
for (x = -1; x < w + 1; ++x) {
for (int x = -1; x < w + 1; ++x) {
ap[x] = i[-4] - ((i[-2] - i[0] + i[2]) << 1) + i[4];
bp[x] = (i[-3] - i[-1] + i[1] - i[3]) << 1;
++i;

View File

@@ -56,7 +56,7 @@ static video_timings_t timing_ega = { .type = VIDEO_ISA, .write_b = 8, .write_w
static uint8_t ega_rotate[8][256];
static uint32_t pallook16[256];
static uint32_t pallook64[256];
static int ega_type = 0;
static int ega_type = 0;
static int old_overscan_color = 0;
uint8_t egaremap2bpp[256];
@@ -64,7 +64,7 @@ uint8_t egaremap2bpp[256];
/* 3C2 controls default mode on EGA. On VGA, it determines monitor type (mono or colour):
7=CGA mode (200 lines), 9=EGA mode (350 lines), 8=EGA mode (200 lines). */
int egaswitchread;
int egaswitches = 9;
int egaswitches = 9;
int update_overscan = 0;
uint8_t ega_in(uint16_t addr, void *priv);
@@ -102,6 +102,9 @@ ega_out(uint16_t addr, uint8_t val, void *priv)
case 0xb3:
ati_eeprom_write((ati_eeprom_t *) ega->eeprom, val & 8, val & 2, val & 1);
break;
default:
break;
}
break;
@@ -180,6 +183,9 @@ ega_out(uint16_t addr, uint8_t val, void *priv)
case 4:
ega->chain2_write = !(val & 4);
break;
default:
break;
}
break;
case 0x3ce:
@@ -213,11 +219,17 @@ ega_out(uint16_t addr, uint8_t val, void *priv)
case 0xC: /*32k at B8000*/
mem_mapping_set_addr(&ega->mapping, 0xb8000, 0x08000);
break;
default:
break;
}
break;
case 7:
ega->colournocare = val;
break;
default:
break;
}
break;
case 0x3d0:
@@ -244,6 +256,9 @@ ega_out(uint16_t addr, uint8_t val, void *priv)
}
}
break;
default:
break;
}
}
@@ -267,6 +282,7 @@ ega_in(uint16_t addr, void *priv)
if (ati_eeprom_read((ati_eeprom_t *) ega->eeprom))
ret |= 8;
break;
default:
ret = ega->regs[ega->index];
break;
@@ -315,7 +331,7 @@ ega_in(uint16_t addr, void *priv)
break;
case 0x3d1:
case 0x3d5:
switch(ega->crtcreg) {
switch (ega->crtcreg) {
case 0xc:
case 0xd:
case 0xe:
@@ -340,6 +356,9 @@ ega_in(uint16_t addr, void *priv)
ega->stat ^= 0x30; /*Fools IBM EGA video BIOS self-test*/
ret = ega->stat;
break;
default:
break;
}
return ret;
@@ -435,11 +454,11 @@ ega_recalctimings(ega_t *ega)
ega->hdisp *= (ega->seqregs[1] & 1) ? 16 : 18;
else
ega->hdisp *= (ega->seqregs[1] & 1) ? 8 : 9;
ega->render = ega_render_text;
ega->render = ega_render_text;
ega->hdisp_old = ega->hdisp;
} else {
ega->hdisp *= (ega->seqregs[1] & 8) ? 16 : 8;
ega->render = ega_render_graphics;
ega->render = ega_render_graphics;
ega->hdisp_old = ega->hdisp;
}
}
@@ -779,7 +798,7 @@ ega_remap_cpu_addr(uint32_t inaddr, ega_t *ega)
if (ega->gdcreg[6] & 2) {
a0mux |= 2;
}
if (ega->vram_limit <= 64*1024) {
if (ega->vram_limit <= 64 * 1024) {
a0mux |= 1;
}
@@ -798,6 +817,9 @@ ega_remap_cpu_addr(uint32_t inaddr, ega_t *ega)
case 0xC: // 32K B800
addr &= 0x7FFF;
break;
default:
break;
}
switch (a0mux) {
@@ -811,15 +833,18 @@ ega_remap_cpu_addr(uint32_t inaddr, ega_t *ega)
// A0 becomes the inversion of PGSEL (reg 0x3C2, miscout, bit 5)
// That is, 1 selects the "low" 64k, and 0 selects the "high" 64k.
addr &= ~1;
addr |= (~ega->miscout>>5)&1;
addr |= (~ega->miscout >> 5) & 1;
break;
case 3: // A0 becomes A14
addr &= ~1;
addr |= (inaddr>>14)&1;
addr |= (inaddr >> 14) & 1;
break;
case 6: // A0 becomes A16
addr &= ~1;
addr |= (inaddr>>16)&1;
addr |= (inaddr >> 16) & 1;
break;
default:
break;
}
@@ -940,6 +965,9 @@ ega_write(uint32_t addr, uint8_t val, void *priv)
if (writemask2 & 8)
ega->vram[addr | 0x3] = (vald & ega->gdcreg[8]) ^ ega->ld;
break;
default:
break;
}
}
break;
@@ -999,9 +1027,15 @@ ega_write(uint32_t addr, uint8_t val, void *priv)
if (writemask2 & 8)
ega->vram[addr | 0x3] = (vald & ega->gdcreg[8]) ^ ega->ld;
break;
default:
break;
}
}
break;
default:
break;
}
}
@@ -1111,6 +1145,9 @@ ega_init(ega_t *ega, int monitor_type, int is_mono)
case 3:
pallook64[c] = pallook16[c] = makecol32(0x34, 0xff, 0x5d);
break;
default:
break;
}
break;
case DISPLAY_AMBER:
@@ -1124,6 +1161,9 @@ ega_init(ega_t *ega, int monitor_type, int is_mono)
case 3:
pallook64[c] = pallook16[c] = makecol32(0xff, 0xe3, 0x34);
break;
default:
break;
}
break;
case DISPLAY_WHITE:
@@ -1138,6 +1178,9 @@ ega_init(ega_t *ega, int monitor_type, int is_mono)
case 3:
pallook64[c] = pallook16[c] = makecol32(0xff, 0xfd, 0xed);
break;
default:
break;
}
break;
}
@@ -1201,8 +1244,8 @@ ega_standalone_init(const device_t *info)
ega_type = 1;
switch (info->local) {
case EGA_IBM:
default:
case EGA_IBM:
rom_init(&ega->bios_rom, BIOS_IBM_PATH,
0xc0000, 0x8000, 0x7fff, 0, MEM_MAPPING_EXTERNAL);
break;

View File

@@ -115,16 +115,16 @@ ega_render_text(ega_t *ega)
ega->lastline_draw = ega->displine;
if (ega->fullchange) {
const bool doublewidth = ((ega->seqregs[1] & 8) != 0);
const bool attrblink = ((ega->attrregs[0x10] & 8) != 0);
const bool doublewidth = ((ega->seqregs[1] & 8) != 0);
const bool attrblink = ((ega->attrregs[0x10] & 8) != 0);
const bool attrlinechars = (ega->attrregs[0x10] & 4);
const bool crtcreset = ((ega->crtc[0x17] & 0x80) == 0);
const bool seq9dot = ((ega->seqregs[1] & 1) == 0);
const int dwshift = doublewidth ? 1 : 0;
const int dotwidth = 1 << dwshift;
const int charwidth = dotwidth*(seq9dot ? 9 : 8);
const bool blinked = ega->blink & 0x10;
uint32_t *p = &buffer32->line[ega->displine + ega->y_add][ega->x_add];
const bool crtcreset = ((ega->crtc[0x17] & 0x80) == 0);
const bool seq9dot = ((ega->seqregs[1] & 1) == 0);
const int dwshift = doublewidth ? 1 : 0;
const int dotwidth = 1 << dwshift;
const int charwidth = dotwidth * (seq9dot ? 9 : 8);
const bool blinked = ega->blink & 0x10;
uint32_t *p = &buffer32->line[ega->displine + ega->y_add][ega->x_add];
for (int x = 0; x < (ega->hdisp + ega->scrollcache); x += charwidth) {
uint32_t addr = ega->remap_func(ega, ega->ma) & ega->vrammask;
@@ -167,7 +167,7 @@ ega_render_text(ega_t *ega)
dat |= (dat >> 1) & 1;
for (int xx = 0; xx < charwidth; xx++)
p[xx] = (dat & (0x100 >> (xx>>dwshift))) ? fg : bg;
p[xx] = (dat & (0x100 >> (xx >> dwshift))) ? fg : bg;
ega->ma += 4;
p += charwidth;
@@ -186,28 +186,28 @@ ega_render_graphics(ega_t *ega)
ega->firstline_draw = ega->displine;
ega->lastline_draw = ega->displine;
const bool doublewidth = ((ega->seqregs[1] & 8) != 0);
const bool cga2bpp = ((ega->gdcreg[5] & 0x20) != 0);
const bool attrblink = ((ega->attrregs[0x10] & 8) != 0);
const bool blinked = ega->blink & 0x10;
const bool crtcreset = ((ega->crtc[0x17] & 0x80) == 0);
const bool seqoddeven = ((ega->seqregs[1] & 4) != 0);
const uint8_t blinkmask = (attrblink && blinked ? 0x8 : 0x0);
uint32_t *p = &buffer32->line[ega->displine + ega->y_add][ega->x_add];
const int dwshift = doublewidth ? 1 : 0;
const int dotwidth = 1 << dwshift;
const int charwidth = dotwidth*8;
int secondcclk = 0;
const bool doublewidth = ((ega->seqregs[1] & 8) != 0);
const bool cga2bpp = ((ega->gdcreg[5] & 0x20) != 0);
const bool attrblink = ((ega->attrregs[0x10] & 8) != 0);
const bool blinked = ega->blink & 0x10;
const bool crtcreset = ((ega->crtc[0x17] & 0x80) == 0);
const bool seqoddeven = ((ega->seqregs[1] & 4) != 0);
const uint8_t blinkmask = (attrblink && blinked ? 0x8 : 0x0);
uint32_t *p = &buffer32->line[ega->displine + ega->y_add][ega->x_add];
const int dwshift = doublewidth ? 1 : 0;
const int dotwidth = 1 << dwshift;
const int charwidth = dotwidth * 8;
int secondcclk = 0;
for (int x = 0; x <= (ega->hdisp + ega->scrollcache); x += charwidth) {
uint32_t addr = ega->remap_func(ega, ega->ma) & ega->vrammask;
uint8_t edat[4];
if (seqoddeven) {
// FIXME: Verify the behaviour of planes 1,3 on actual hardware
edat[0] = ega->vram[(addr | 0) ^ secondcclk];
edat[1] = ega->vram[(addr | 1) ^ secondcclk];
edat[2] = ega->vram[(addr | 2) ^ secondcclk];
edat[3] = ega->vram[(addr | 3) ^ secondcclk];
edat[0] = ega->vram[(addr | 0) ^ secondcclk];
edat[1] = ega->vram[(addr | 1) ^ secondcclk];
edat[2] = ega->vram[(addr | 2) ^ secondcclk];
edat[3] = ega->vram[(addr | 3) ^ secondcclk];
secondcclk = (secondcclk + 1) & 1;
if (secondcclk == 0)
ega->ma += 4;
@@ -219,25 +219,25 @@ ega_render_graphics(ega_t *ega)
if (cga2bpp) {
// Remap CGA 2bpp-chunky data into fully planar data
uint8_t dat0 = egaremap2bpp[edat[1] ] | (egaremap2bpp[edat[0] ] << 4);
uint8_t dat1 = egaremap2bpp[edat[1]>>1] | (egaremap2bpp[edat[0]>>1] << 4);
uint8_t dat2 = egaremap2bpp[edat[3] ] | (egaremap2bpp[edat[2] ] << 4);
uint8_t dat3 = egaremap2bpp[edat[3]>>1] | (egaremap2bpp[edat[2]>>1] << 4);
edat[0] = dat0;
edat[1] = dat1;
edat[2] = dat2;
edat[3] = dat3;
uint8_t dat0 = egaremap2bpp[edat[1]] | (egaremap2bpp[edat[0]] << 4);
uint8_t dat1 = egaremap2bpp[edat[1] >> 1] | (egaremap2bpp[edat[0] >> 1] << 4);
uint8_t dat2 = egaremap2bpp[edat[3]] | (egaremap2bpp[edat[2]] << 4);
uint8_t dat3 = egaremap2bpp[edat[3] >> 1] | (egaremap2bpp[edat[2] >> 1] << 4);
edat[0] = dat0;
edat[1] = dat1;
edat[2] = dat2;
edat[3] = dat3;
}
if (!crtcreset) {
for (int i = 0; i < 8; i += 2) {
const int outoffs = i << dwshift;
const int inshift = 6 - i;
uint8_t dat = (edatlookup[(edat[0] >> inshift) & 3][(edat[1] >> inshift) & 3] )
| (edatlookup[(edat[2] >> inshift) & 3][(edat[3] >> inshift) & 3] << 2);
uint8_t dat = (edatlookup[(edat[0] >> inshift) & 3][(edat[1] >> inshift) & 3])
| (edatlookup[(edat[2] >> inshift) & 3][(edat[3] >> inshift) & 3] << 2);
// FIXME: Confirm blink behaviour is actually XOR on real hardware
uint32_t p0 = ega->pallook[ega->egapal[((dat >> 4) & ega->plane_mask) ^ blinkmask]];
uint32_t p1 = ega->pallook[ega->egapal[(dat & ega->plane_mask) ^ blinkmask]];
uint32_t p1 = ega->pallook[ega->egapal[(dat & ega->plane_mask) ^ blinkmask]];
for (int subx = 0; subx < dotwidth; subx++)
p[outoffs + subx] = p0;
for (int subx = 0; subx < dotwidth; subx++)

View File

@@ -75,7 +75,7 @@ mda_out(uint16_t addr, uint8_t val, void *priv)
uint8_t
mda_in(uint16_t addr, void *priv)
{
mda_t *mda = (mda_t *) priv;
const mda_t *mda = (mda_t *) priv;
switch (addr) {
case 0x3b0:
@@ -107,7 +107,7 @@ mda_write(uint32_t addr, uint8_t val, void *priv)
uint8_t
mda_read(uint32_t addr, void *priv)
{
mda_t *mda = (mda_t *) priv;
const mda_t *mda = (mda_t *) priv;
return mda->vram[addr & 0xfff];
}

View File

@@ -169,7 +169,7 @@ svga_out(uint16_t addr, uint8_t val, void *priv)
case 0x3c3:
if (xga_enabled) {
svga->xga.on = (val & 0x01) ? 0 : 1;
vga_on = !svga->xga.on;
vga_on = !svga->xga.on;
}
break;
case 0x3c4:
@@ -205,6 +205,9 @@ svga_out(uint16_t addr, uint8_t val, void *priv)
svga->chain4 = val & 8;
svga->fast = (svga->gdcreg[8] == 0xff && !(svga->gdcreg[3] & 0x18) && !svga->gdcreg[1]) && ((svga->chain4 && (svga->packed_chain4 || svga->force_old_addr)) || svga->fb_only) && !(svga->adv_flags & FLAG_ADDR_BY8);
break;
default:
break;
}
break;
case 0x2ea:
@@ -245,6 +248,9 @@ svga_out(uint16_t addr, uint8_t val, void *priv)
svga->dac_pos = 0;
svga->dac_addr = (svga->dac_addr + 1) & 255;
break;
default:
break;
}
break;
case 0x3ce:
@@ -283,18 +289,27 @@ svga_out(uint16_t addr, uint8_t val, void *priv)
mem_mapping_set_addr(&svga->mapping, 0xb8000, 0x08000);
svga->banked_mask = 0x7fff;
break;
default:
break;
}
}
break;
case 7:
svga->colournocare = val;
break;
default:
break;
}
svga->gdcreg[svga->gdcaddr & 15] = val;
svga->fast = (svga->gdcreg[8] == 0xff && !(svga->gdcreg[3] & 0x18) && !svga->gdcreg[1]) && ((svga->chain4 && (svga->packed_chain4 || svga->force_old_addr)) || svga->fb_only);
if (((svga->gdcaddr & 15) == 5 && (val ^ o) & 0x70) || ((svga->gdcaddr & 15) == 6 && (val ^ o) & 1))
svga_recalctimings(svga);
break;
default:
break;
}
}
@@ -362,6 +377,9 @@ svga_in(uint16_t addr, void *priv)
else
ret = svga->vgapal[index].b & 0x3f;
break;
default:
break;
}
if (svga->adv_flags & FLAG_RAMDAC_SHIFT)
ret >>= 2;
@@ -403,6 +421,9 @@ svga_in(uint16_t addr, void *priv)
ret = svga->cgastat;
break;
default:
break;
}
return ret;
@@ -561,8 +582,14 @@ svga_recalctimings(svga_t *svga)
else
svga->render = svga_render_32bpp_highres;
break;
default:
break;
}
break;
default:
break;
}
}
}
@@ -698,15 +725,15 @@ svga_do_render(svga_t *svga)
void
svga_poll(void *priv)
{
svga_t *svga = (svga_t *) priv;
ibm8514_t *dev = &svga->dev8514;
uint32_t x;
uint32_t blink_delay;
int wx;
int wy;
int ret;
int old_ma;
int linecountff = 0;
svga_t *svga = (svga_t *) priv;
ibm8514_t *dev = &svga->dev8514;
uint32_t x;
uint32_t blink_delay;
int wx;
int wy;
int ret;
int old_ma;
int linecountff = 0;
if (!vga_on && ibm8514_enabled && ibm8514_on) {
if (!dev->local) {
@@ -808,14 +835,14 @@ svga_poll(void *priv)
if ((svga->sc == (svga->crtc[11] & 31)) || (svga->sc == svga->rowcount))
svga->con = 0;
if (svga->dispon) {
/*Real IBM 8514/A or compatibility mode doesn't have linedbl, so skip those.*/
/*Real IBM 8514/A or compatibility mode doesn't have linedbl, so skip those.*/
if (dev->local && ibm8514_on) {
svga->linedbl = 0;
svga->linedbl = 0;
svga->linecountff = 0;
linecountff = 1;
linecountff = 1;
}
if (svga->linedbl && !svga->linecountff && !linecountff) {
svga->linecountff = 1;
svga->linecountff = 1;
svga->ma = svga->maback;
} else if (svga->sc == svga->rowcount) {
svga->linecountff = 0;
@@ -920,7 +947,7 @@ svga_poll(void *priv)
svga->oddeven ^= 1;
svga->monitor->mon_changeframecount = svga->interlace ? 3 : 2;
svga->vslines = 0;
svga->vslines = 0;
if ((dev->local && vga_on) || !dev->local) {
if (svga->interlace && svga->oddeven)
@@ -933,7 +960,7 @@ svga_poll(void *priv)
else
svga->ma = svga->maback = svga->ma_latch;
}
svga->ca = ((svga->crtc[0xe] << 8) | svga->crtc[0xf]) + ((svga->crtc[0xb] & 0x60) >> 5) + svga->ca_adj;
svga->ca = ((svga->crtc[0xe] << 8) | svga->crtc[0xf]) + ((svga->crtc[0xb] & 0x60) >> 5) + svga->ca_adj;
svga->ma = (svga->ma << 2);
svga->maback = (svga->maback << 2);
svga->ca = (svga->ca << 2);
@@ -994,9 +1021,9 @@ svga_init(const device_t *info, svga_t *svga, void *priv, int memsize,
{
int e;
svga->priv = priv;
svga->priv = priv;
svga->monitor_index = monitor_index_global;
svga->monitor = &monitors[svga->monitor_index];
svga->monitor = &monitors[svga->monitor_index];
for (int c = 0; c < 256; c++) {
e = c;
@@ -1010,10 +1037,10 @@ svga_init(const device_t *info, svga_t *svga, void *priv, int memsize,
svga->attrregs[0x11] = 0;
svga->overscan_color = 0x000000;
svga->monitor->mon_overscan_x = 16;
svga->monitor->mon_overscan_y = 32;
svga->x_add = 8;
svga->y_add = 16;
svga->monitor->mon_overscan_x = 16;
svga->monitor->mon_overscan_y = 32;
svga->x_add = 8;
svga->y_add = 16;
svga->crtc[0] = 63;
svga->crtc[6] = 255;
@@ -1127,7 +1154,7 @@ svga_write_common(uint32_t addr, uint8_t val, uint8_t linear, void *priv)
svga_t *svga = (svga_t *) priv;
int writemask2 = svga->writemask;
int reset_wm = 0;
int reset_wm = 0;
latch_t vall;
uint8_t wm = svga->writemask;
uint8_t count;
@@ -1156,7 +1183,7 @@ svga_write_common(uint32_t addr, uint8_t val, uint8_t linear, void *priv)
}
} else {
svga->xga.on = 0;
vga_on = !svga->xga.on;
vga_on = !svga->xga.on;
}
}
addr = svga_decode_addr(svga, addr, 1);
@@ -1328,6 +1355,9 @@ svga_write_common(uint32_t addr, uint8_t val, uint8_t linear, void *priv)
}
}
break;
default:
break;
}
if (reset_wm)
@@ -1354,11 +1384,11 @@ svga_read_common(uint32_t addr, uint8_t linear, void *priv)
if (((svga->xga.op_mode & 7) >= 4) && (svga->xga.aperture_cntl >= 1)) {
if (svga->xga.test == 0xa5) { /*Memory size test of XGA*/
svga->xga.on = 1;
vga_on = !svga->xga.on;
vga_on = !svga->xga.on;
return svga->xga.test;
} else if (svga->xga.test == 0x5a) {
svga->xga.on = 1;
vga_on = !svga->xga.on;
vga_on = !svga->xga.on;
return svga->xga.test;
} else if ((addr == 0xa0000) || (addr == 0xa0010)) {
addr += svga->xga.read_bank;
@@ -1366,7 +1396,7 @@ svga_read_common(uint32_t addr, uint8_t linear, void *priv)
}
} else {
svga->xga.on = 0;
vga_on = !svga->xga.on;
vga_on = !svga->xga.on;
}
}
addr = svga_decode_addr(svga, addr, 0);
@@ -1404,7 +1434,7 @@ svga_read_common(uint32_t addr, uint8_t linear, void *priv)
addr &= ~1;
if (linear && ibm8514_on && (svga->adv_flags & FLAG_ATI))
addr &= svga->vram_mask;
else
else
addr <<= 2;
} else {
if (linear && ibm8514_on && (svga->adv_flags & FLAG_ATI)) {
@@ -1586,8 +1616,8 @@ svga_writeb_linear(uint32_t addr, uint8_t val, void *priv)
if (addr >= svga->vram_max)
return;
addr &= svga->vram_mask;
svga->changedvram[addr >> 12] = svga->monitor->mon_changeframecount;
*(uint8_t *) &svga->vram[addr] = val;
svga->changedvram[addr >> 12] = svga->monitor->mon_changeframecount;
*&svga->vram[addr] = val;
}
void
@@ -1713,7 +1743,7 @@ svga_writel_linear(uint32_t addr, uint32_t val, void *priv)
uint8_t
svga_readb_linear(uint32_t addr, void *priv)
{
svga_t *svga = (svga_t *) priv;
const svga_t *svga = (svga_t *) priv;
if (!svga->fast)
return svga_read_linear(addr, priv);
@@ -1722,7 +1752,7 @@ svga_readb_linear(uint32_t addr, void *priv)
if (addr >= svga->vram_max)
return 0xff;
return *(uint8_t *) &svga->vram[addr & svga->vram_mask];
return *&svga->vram[addr & svga->vram_mask];
}
uint16_t
@@ -1744,8 +1774,8 @@ svga_readw_common(uint32_t addr, uint8_t linear, void *priv)
addr &= svga->decode_mask;
if (svga->translate_address) {
uint8_t val1 = 0xff;
uint8_t val2 = 0xff;
uint8_t val1 = 0xff;
uint8_t val2 = 0xff;
uint32_t addr2 = svga->translate_address(addr, priv);
if (addr2 < svga->vram_max)
val1 = svga->vram[addr2 & svga->vram_mask];
@@ -1792,10 +1822,10 @@ svga_readl_common(uint32_t addr, uint8_t linear, void *priv)
addr &= svga->decode_mask;
if (svga->translate_address) {
uint8_t val1 = 0xff;
uint8_t val2 = 0xff;
uint8_t val3 = 0xff;
uint8_t val4 = 0xff;
uint8_t val1 = 0xff;
uint8_t val2 = 0xff;
uint8_t val3 = 0xff;
uint8_t val4 = 0xff;
uint32_t addr2 = svga->translate_address(addr, priv);
if (addr2 < svga->vram_max)
val1 = svga->vram[addr2 & svga->vram_mask];

View File

@@ -65,6 +65,9 @@ svga_render_blank(svga_t *svga)
case 9:
char_width = 16;
break;
default:
break;
}
uint32_t *line_ptr = &svga->monitor->target_buffer->line[svga->displine + svga->y_add][svga->x_add];
@@ -1305,7 +1308,7 @@ svga_render_15bpp_mix_lowres(svga_t *svga)
svga->lastline_draw = svga->displine;
for (x = 0; x <= (svga->hdisp + svga->scrollcache); x += 4) {
dat = *(uint32_t *) (&svga->vram[(svga->ma + (x << 1)) & svga->vram_display_mask]);
dat = *(uint32_t *) (&svga->vram[(svga->ma + (x << 1)) & svga->vram_display_mask]);
p[x << 1] = p[(x << 1) + 1] = (dat & 0x00008000) ? svga->pallook[dat & 0xff] : video_15to32[dat & 0xffff];
dat >>= 16;
@@ -1386,7 +1389,7 @@ svga_render_16bpp_lowres(svga_t *svga)
svga->lastline_draw = svga->displine;
for (x = 0; x <= (svga->hdisp + svga->scrollcache); x += 4) {
dat = *(uint32_t *) (&svga->vram[(svga->ma + (x << 1)) & svga->vram_display_mask]);
dat = *(uint32_t *) (&svga->vram[(svga->ma + (x << 1)) & svga->vram_display_mask]);
p[x << 1] = p[(x << 1) + 1] = video_16to32[dat & 0xffff];
p[(x << 1) + 2] = p[(x << 1) + 3] = video_16to32[dat >> 16];

View File

@@ -412,7 +412,7 @@ video_get_video_from_internal_name(char *s)
int c = 0;
while (video_cards[c].device != NULL) {
if (!strcmp((char *) video_cards[c].device->internal_name, s))
if (!strcmp(video_cards[c].device->internal_name, s))
return c;
c++;
}

View File

@@ -69,6 +69,9 @@ vga_out(uint16_t addr, uint8_t val, void *priv)
}
}
break;
default:
break;
}
svga_out(addr, val, svga);
}

File diff suppressed because it is too large Load Diff

View File

@@ -109,7 +109,7 @@ BEGIN
MENUITEM SEPARATOR
MENUITEM "擷圖(&C)\tCtrl+F11", IDM_ACTION_SCREENSHOT
MENUITEM SEPARATOR
MENUITEM "首選項(&P)...", IDM_PREFERENCES
MENUITEM "偏好設定(&P)...", IDM_PREFERENCES
#ifdef DISCORD
MENUITEM "啟用 Discord 整合(&D)", IDM_DISCORD
#endif
@@ -240,7 +240,7 @@ END
// Dialog
//
#define STR_PREFERENCES "首選項"
#define STR_PREFERENCES "偏好設定"
#define STR_SND_GAIN "音量增益"
#define STR_NEW_FLOPPY "新增映像"
#define STR_CONFIG "設定"
@@ -293,10 +293,10 @@ END
#define STR_JOY3 "搖桿 3..."
#define STR_JOY4 "搖桿 4..."
#define STR_SOUND1 "音卡 1:"
#define STR_SOUND2 "音卡 2:"
#define STR_SOUND3 "音卡 3:"
#define STR_SOUND4 "音卡 4:"
#define STR_SOUND1 "音卡 1:"
#define STR_SOUND2 "音卡 2:"
#define STR_SOUND3 "音卡 3:"
#define STR_SOUND4 "音卡 4:"
#define STR_MIDI_OUT "MIDI 輸出裝置:"
#define STR_MIDI_IN "MIDI 輸入裝置:"
#define STR_MPU401 "獨立 MPU-401"
@@ -357,7 +357,7 @@ END
#define STR_SPECIFY "指定(&S)..."
#define STR_SECTORS "磁區(S):"
#define STR_HEADS "磁頭(H):"
#define STR_CYLS "柱(C):"
#define STR_CYLS "柱(C):"
#define STR_SIZE_MB "大小 (MB):"
#define STR_TYPE "類型:"
#define STR_IMG_FORMAT "映像格式:"