This commit is contained in:
OBattler
2025-06-11 22:45:59 +02:00
63 changed files with 1862 additions and 1724 deletions

View File

@@ -30,13 +30,13 @@ typedef struct pcjr_s
uint8_t array[32];
int array_ff;
int memctrl;
uint8_t stat;
uint8_t status;
int addr_mode;
uint8_t *vram;
uint8_t *b8000;
int linepos;
int displine;
int sc;
int scanline;
int vc;
int dispon;
int cursorvisible; // Is the cursor visible on the current scanline?
@@ -45,8 +45,8 @@ typedef struct pcjr_s
int vsynctime;
int fullchange;
int vadj;
uint16_t ma;
uint16_t maback;
uint16_t memaddr;
uint16_t memaddr_backup;
uint64_t dispontime;
uint64_t dispofftime;
pc_timer_t timer;

View File

@@ -27,7 +27,7 @@ typedef struct t1kvid_t {
int memctrl;
uint8_t mode;
uint8_t col;
uint8_t stat;
uint8_t status;
uint8_t *vram;
uint8_t *b8000;
@@ -38,7 +38,7 @@ typedef struct t1kvid_t {
int linepos;
int displine;
int sc;
int scanline;
int vc;
int dispon;
int cursorvisible;
@@ -47,8 +47,8 @@ typedef struct t1kvid_t {
int fullchange;
int vsynctime;
int vadj;
uint16_t ma;
uint16_t maback;
uint16_t memaddr;
uint16_t memaddr_backup;
uint64_t dispontime;
uint64_t dispofftime;

View File

@@ -80,7 +80,7 @@ typedef struct ibm8514_t {
uint32_t vram_mask;
uint32_t pallook[512];
uint32_t bios_addr;
uint32_t ma_latch;
uint32_t memaddr_latch;
PALETTE vgapal;
uint8_t hwcursor_oddeven;
@@ -220,8 +220,8 @@ typedef struct ibm8514_t {
int lastline_draw;
int displine;
int fullchange;
uint32_t ma;
uint32_t maback;
uint32_t memaddr;
uint32_t memaddr_backup;
uint8_t *vram;
uint8_t *changedvram;
@@ -236,7 +236,7 @@ typedef struct ibm8514_t {
int hdisp;
int hdisp2;
int hdisped;
int sc;
int scanline;
int vsyncstart;
int vsyncwidth;
int vtotal;

View File

@@ -87,7 +87,7 @@ typedef struct cga_t {
int fontbase;
int linepos;
int displine;
int sc;
int scanline;
int vc;
int cgadispon;
int cursorvisible; // Determines if the cursor is visible FOR THE CURRENT SCANLINE.
@@ -95,8 +95,8 @@ typedef struct cga_t {
int cgablink;
int vsynctime;
int vadj;
uint16_t ma;
uint16_t maback;
uint16_t memaddr;
uint16_t memaddr_backup;
int oddeven;
uint64_t dispontime;

View File

@@ -39,7 +39,7 @@ typedef struct ega_t {
uint8_t lb;
uint8_t lc;
uint8_t ld;
uint8_t stat;
uint8_t status;
uint8_t colourcompare;
uint8_t colournocare;
uint8_t scrblank;
@@ -73,7 +73,7 @@ typedef struct ega_t {
int oddeven_chain;
int vc;
int real_vc;
int sc;
int scanline;
int dispon;
int hdisp_on;
int cursoron;
@@ -115,14 +115,14 @@ typedef struct ega_t {
int chipset;
int mono_display;
int mdacols[256][2][2];
int mda_attr_to_color_table[256][2][2];
uint32_t charseta;
uint32_t charsetb;
uint32_t ma_latch;
uint32_t ma;
uint32_t maback;
uint32_t ca;
uint32_t memaddr_latch;
uint32_t memaddr;
uint32_t memaddr_backup;
uint32_t cursoraddr;
uint32_t vram_limit;
uint32_t overscan_color;
uint32_t cca;
@@ -189,10 +189,10 @@ extern void ega_set_type(void *priv, uint32_t local);
extern int firstline_draw;
extern int lastline_draw;
extern int displine;
extern int sc;
extern int scanline;
extern uint32_t ma;
extern uint32_t ca;
extern uint32_t memaddr;
extern uint32_t cursoraddr;
extern int cursorvisible;
extern int cursoron;
extern int cgablink;

View File

@@ -33,9 +33,9 @@
} \
\
if (nr & VAR_ROW0_MA13) \
out_addr = (out_addr & ~0x8000) | ((ega->sc & 1) ? 0x8000 : 0); \
out_addr = (out_addr & ~0x8000) | ((ega->scanline & 1) ? 0x8000 : 0); \
if (nr & VAR_ROW1_MA14) \
out_addr = (out_addr & ~0x10000) | ((ega->sc & 2) ? 0x10000 : 0); \
out_addr = (out_addr & ~0x10000) | ((ega->scanline & 2) ? 0x10000 : 0); \
\
return out_addr; \
}

View File

@@ -13,10 +13,12 @@
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* Jasmine Iwanek, <jriwanek@gmail.com>
*
* Connor Hyde / starfrost, <mario64crashed@gmail.com
*
* Copyright 2008-2019 Sarah Walker.
* Copyright 2016-2019 Miran Grca.
* Copyright 2021 Jasmine Iwanek.
* Copyright 2025 starfrost
*/
#ifndef VIDEO_HERCULES_H
@@ -31,7 +33,7 @@ typedef struct {
uint8_t ctrl;
uint8_t ctrl2;
uint8_t stat;
uint8_t status;
uint64_t dispontime;
uint64_t dispofftime;
@@ -43,9 +45,9 @@ typedef struct {
int linepos;
int displine;
int vc;
int sc;
uint16_t ma;
uint16_t maback;
int scanline;
uint16_t memaddr;
uint16_t memaddr_backup;
int cursorvisible;
int cursoron;
int dispon;
@@ -53,10 +55,10 @@ typedef struct {
int vsynctime;
int vadj;
int lp_ff;
int fullchange;
int lp_ff;
int fullchange;
int cols[256][2][2];
int cols[256][2][2];
uint8_t *vram;
int monitor_index;

View File

@@ -1,18 +1,79 @@
/* Copyright holders: Sarah Walker
see COPYING for more details
*/
/*
* 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 IBM Monochrome Display and Printer card.
*
* Authors: Sarah Walker, starfrost
*
* Copyright 2007-2024 Sarah Walker
* Copyright 2025 Connor Hyde / starfrost, <mario64crashed@gmail.com>
*/
#ifndef VIDEO_MDA_H
#define VIDEO_MDA_H
// Defines
#define MDA_CRTC_NUM_REGISTERS 32
// Enums & structures
typedef enum mda_registers_e
{
MDA_REGISTER_START = 0x3B0,
MDA_REGISTER_CRTC_INDEX = 0x3B4,
MDA_REGISTER_CRTC_DATA = 0x3B5,
MDA_REGISTER_MODE_CONTROL = 0x3B8,
MDA_REGISTER_CRT_STATUS = 0x3BA,
MDA_REGISTER_PARALLEL_DATA = 0x3BC,
MDA_REGISTER_PRINTER_STATUS = 0x3BD,
MDA_REGISTER_PRINTER_CONTROL = 0x3BE,
MDA_REGISTER_END = 0x3BF,
} mda_registers;
// Motorola MC6845 CRTC registers (without light pen for some reason)
typedef enum mda_crtc_registers_e
{
MDA_CRTC_HTOTAL = 0x0, // Horizontal total (total number of characters incl. hsync)
MDA_CRTC_HDISP = 0x1, // Horizontal display
MDA_CRTC_HSYNC_POS = 0x2, // Horizontal position of horizontal ysnc
MDA_CRTC_HSYNC_WIDTH = 0x3, // Width of horizontal sync
MDA_CRTC_VTOTAL = 0x4, // Vertical total (total number of scanlines incl. vsync)
MDA_CRTC_VTOTAL_ADJUST = 0x5, // Vertical total adjust value
MDA_CRTC_VDISP = 0x6, // Vertical display (total number of displayed scanline)
MDA_CRTC_VSYNC = 0x7, // Vertical sync scanline number
MDA_CRTC_INTERLACE = 0x8, // Interlacing mode
MDA_CRTC_MAX_SCANLINE_ADDR = 0x9, // Maximum scanline address
MDA_CRTC_CURSOR_START = 0xA, // Cursor start scanline
MDA_CRTC_CURSOR_END = 0xB, // Cursor end scanline
MDA_CRTC_START_ADDR_HIGH = 0xC, // Screen start address high 8 bits
MDA_CRTC_START_ADDR_LOW = 0xD, // Screen start address low 8 bits
MDA_CRTC_CURSOR_ADDR_HIGH = 0xE, // Cursor address high 8 bits
MDA_CRTC_CURSOR_ADDR_LOW = 0xF, // Cursor address low 8 bits
} mda_crtc_registers;
typedef enum mda_mode_flags_e
{
MDA_MODE_HIGHRES = 1 << 0, // MUST be enabled for sane operation
MDA_MODE_BLACKANDWHITE = 1 << 1, // UNUSED in most cases. Not present on Hercules
MDA_MODE_VIDEO_ENABLE = 1 << 3,
MDA_MODE_BLINK = 1 << 5,
} mda_mode_flags;
typedef struct mda_t {
mem_mapping_t mapping;
uint8_t crtc[32];
uint8_t crtc[MDA_CRTC_NUM_REGISTERS];
int crtcreg;
uint8_t ctrl;
uint8_t stat;
uint8_t mode;
uint8_t status;
uint64_t dispontime;
uint64_t dispofftime;
@@ -25,9 +86,9 @@ typedef struct mda_t {
int linepos;
int displine;
int vc;
int sc;
uint16_t ma;
uint16_t maback;
int scanline;
uint16_t memaddr;
uint16_t memaddr_backup;
int cursorvisible;
int cursoron;
int dispon;

View File

@@ -120,8 +120,8 @@ typedef struct pgc {
int cgablink;
int vsynctime;
int vadj;
uint16_t ma;
uint16_t maback;
uint16_t memaddr;
uint16_t memaddr_backup;
int oddeven;
uint64_t dispontime;

View File

@@ -100,7 +100,7 @@ typedef struct svga_t {
int dispon;
int hdisp_on;
int vc;
int sc;
int scanline;
int linepos;
int vslines;
int linecountff;
@@ -152,15 +152,15 @@ typedef struct svga_t {
uint32_t charseta;
uint32_t charsetb;
uint32_t adv_flags;
uint32_t ma_latch;
uint32_t memaddr_latch;
uint32_t ca_adj;
uint32_t ma;
uint32_t maback;
uint32_t memaddr;
uint32_t memaddr_backup;
uint32_t write_bank;
uint32_t read_bank;
uint32_t extra_banks[2];
uint32_t banked_mask;
uint32_t ca;
uint32_t cursoraddr;
uint32_t overscan_color;
uint32_t *map8;
uint32_t pallook[512];

View File

@@ -23,10 +23,10 @@
extern int firstline_draw;
extern int lastline_draw;
extern int displine;
extern int sc;
extern int scanline;
extern uint32_t ma;
extern uint32_t ca;
extern uint32_t memaddr;
extern uint32_t cursoraddr;
extern int cursorvisible;
extern int cursoron;
extern int cgablink;

View File

@@ -47,9 +47,9 @@
} \
\
if (nr & VAR_ROW0_MA13) \
out_addr = (out_addr & ~0x8000) | ((svga->sc & 1) ? 0x8000 : 0); \
out_addr = (out_addr & ~0x8000) | ((svga->scanline & 1) ? 0x8000 : 0); \
if (nr & VAR_ROW1_MA14) \
out_addr = (out_addr & ~0x10000) | ((svga->sc & 2) ? 0x10000 : 0); \
out_addr = (out_addr & ~0x10000) | ((svga->scanline & 2) ? 0x10000 : 0); \
\
return out_addr; \
}

View File

@@ -127,7 +127,7 @@ typedef struct xga_t {
int dispon;
int h_disp_on;
int vc;
int sc;
int scanline;
int linepos;
int oddeven;
int firstline;
@@ -160,12 +160,12 @@ typedef struct xga_t {
uint32_t hwc_color0;
uint32_t hwc_color1;
uint32_t disp_start_addr;
uint32_t ma_latch;
uint32_t memaddr_latch;
uint32_t vram_size;
uint32_t vram_mask;
uint32_t rom_addr;
uint32_t ma;
uint32_t maback;
uint32_t memaddr;
uint32_t memaddr_backup;
uint32_t read_bank;
uint32_t write_bank;
uint32_t px_map_base;