Files
86Box/src/video/vid_mda.c

538 lines
19 KiB
C
Raw Normal View History

/*
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.
*
2023-01-06 15:36:05 -05:00
* This file is part of the 86Box distribution.
*
* IBM Monochrome Display and Printer Adapter emulation.
*
2020-03-25 00:46:02 +02:00
*
*
2023-01-06 15:36:29 -05:00
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
2023-01-06 15:36:05 -05:00
* Miran Grca, <mgrca8@gmail.com>
* Connor Hyde, <mario64crashed@gmail.com>
*
2023-01-06 15:36:05 -05:00
* Copyright 2008-2019 Sarah Walker.
* Copyright 2016-2025 Miran Grca.
* Copyright 2025 starfrost / Connor Hyde
*/
#include <stdbool.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <wchar.h>
#include <86box/86box.h>
#include <86box/io.h>
#include <86box/timer.h>
#include <86box/lpt.h>
#include <86box/pit.h>
#include <86box/mem.h>
#include <86box/rom.h>
#include <86box/device.h>
#include <86box/video.h>
#include <86box/vid_mda.h>
2023-06-09 23:46:54 -04:00
#include <86box/plat_unused.h>
// Enumerates MDA monitor types
2025-06-16 23:41:01 +01:00
enum mda_monitor_type_e {
MDA_MONITOR_TYPE_DEFAULT = 0, // Default MDA monitor type.
MDA_MONITOR_TYPE_GREEN = 1, // Green phosphor
MDA_MONITOR_TYPE_AMBER = 2, // Amber phosphor
MDA_MONITOR_TYPE_GRAY = 3, // Gray phosphor
MDA_MONITOR_TYPE_RGBI = 4, // RGBI colour monitor with modified rev1 or rev0 MDA card for colour support
} mda_monitor_type;
// [attr][blink][fg]
static int mda_attr_to_color_table[256][2][2];
2022-08-31 19:19:29 -04:00
static video_timings_t timing_mda = { .type = VIDEO_ISA, .write_b = 8, .write_w = 16, .write_l = 32, .read_b = 8, .read_w = 16, .read_l = 32 };
void mda_recalctimings(mda_t *mda);
2022-08-31 19:19:29 -04:00
void
2023-06-09 23:46:54 -04:00
mda_out(uint16_t addr, uint8_t val, void *priv)
{
2023-06-09 23:46:54 -04:00
mda_t *mda = (mda_t *) priv;
2025-06-16 23:41:01 +01:00
if (addr < MDA_REGISTER_START
|| addr > MDA_REGISTER_CRT_STATUS) // Maintain old behaviour for printer registers, just in case
return;
2023-06-09 23:46:54 -04:00
2025-06-16 23:41:01 +01:00
switch (addr) {
case MDA_REGISTER_MODE_CONTROL:
mda->mode = val;
return;
2023-06-09 23:46:54 -04:00
default:
break;
2022-08-31 19:19:29 -04:00
}
// addr & 1 == 1 = MDA_REGISTER_CRTC_DATA
// otherwise MDA_REGISTER_CRTC_INDEX
2025-06-16 23:41:01 +01:00
if (addr & 1) {
mda->crtc[mda->crtcreg] = val;
2025-06-16 23:41:01 +01:00
if (mda->crtc[MDA_CRTC_CURSOR_START] == 6
&& mda->crtc[MDA_CRTC_CURSOR_END] == 7) /*Fix for Generic Turbo XT BIOS, which sets up cursor registers wrong*/
{
mda->crtc[MDA_CRTC_CURSOR_START] = 0xb;
2025-06-16 23:41:01 +01:00
mda->crtc[MDA_CRTC_CURSOR_END] = 0xc;
}
mda_recalctimings(mda);
2025-06-16 23:41:01 +01:00
} else
mda->crtcreg = val & 31;
}
2022-08-31 19:19:29 -04:00
uint8_t
2023-06-09 23:46:54 -04:00
mda_in(uint16_t addr, void *priv)
{
2023-07-31 14:47:37 -04:00
const mda_t *mda = (mda_t *) priv;
2023-06-09 23:46:54 -04:00
2025-06-16 23:41:01 +01:00
switch (addr) {
case MDA_REGISTER_CRT_STATUS:
return mda->status | 0xF0;
2023-06-09 23:46:54 -04:00
default:
2025-06-16 23:41:01 +01:00
if (addr < MDA_REGISTER_START
|| addr > MDA_REGISTER_CRT_STATUS) // Maintain old behaviour for printer registers, just in case
return 0xFF;
// MDA_REGISTER_CRTC_DATA
if (addr & 1)
return mda->crtc[mda->crtcreg];
2025-06-16 23:41:01 +01:00
else
return mda->crtcreg;
2023-06-09 23:46:54 -04:00
break;
2022-08-31 19:19:29 -04:00
}
return 0xFF;
}
2022-08-31 19:19:29 -04:00
void
2023-06-09 23:46:54 -04:00
mda_write(uint32_t addr, uint8_t val, void *priv)
{
2023-06-09 23:46:54 -04:00
mda_t *mda = (mda_t *) priv;
2022-08-31 19:19:29 -04:00
mda->vram[addr & 0xfff] = val;
}
2022-08-31 19:19:29 -04:00
uint8_t
2023-06-09 23:46:54 -04:00
mda_read(uint32_t addr, void *priv)
{
2023-07-31 14:47:37 -04:00
const mda_t *mda = (mda_t *) priv;
2023-06-09 23:46:54 -04:00
2022-08-31 19:19:29 -04:00
return mda->vram[addr & 0xfff];
}
2022-08-31 19:19:29 -04:00
void
mda_recalctimings(mda_t *mda)
{
2023-06-01 18:32:25 -04:00
double _dispontime;
double _dispofftime;
double disptime;
disptime = mda->crtc[MDA_CRTC_HTOTAL] + 1;
_dispontime = mda->crtc[MDA_CRTC_HDISP];
2022-08-31 19:19:29 -04:00
_dispofftime = disptime - _dispontime;
_dispontime *= MDACONST;
_dispofftime *= MDACONST;
mda->dispontime = (uint64_t) (_dispontime);
mda->dispofftime = (uint64_t) (_dispofftime);
}
2022-08-31 19:19:29 -04:00
void
2023-06-09 23:46:54 -04:00
mda_poll(void *priv)
{
2025-06-16 23:41:01 +01:00
mda_t *mda = (mda_t *) priv;
uint16_t cursoraddr = (mda->crtc[MDA_CRTC_CURSOR_ADDR_LOW] | (mda->crtc[MDA_CRTC_CURSOR_ADDR_HIGH] << 8)) & 0x3fff;
bool drawcursor;
int32_t oldvc;
2023-06-01 18:32:25 -04:00
uint8_t chr;
uint8_t attr;
int32_t scanline_old;
int32_t blink;
2022-08-31 19:19:29 -04:00
VIDEO_MONITOR_PROLOGUE()
2025-06-16 23:41:01 +01:00
if (!mda->linepos) {
2022-08-31 19:19:29 -04:00
timer_advance_u64(&mda->timer, mda->dispofftime);
mda->status |= 1;
2022-08-31 19:19:29 -04:00
mda->linepos = 1;
2025-06-16 23:41:01 +01:00
scanline_old = mda->scanline;
if ((mda->crtc[MDA_CRTC_INTERLACE] & 3) == 3)
mda->scanline = (mda->scanline << 1) & 7;
2025-06-16 23:41:01 +01:00
if (mda->dispon) {
if (mda->displine < mda->firstline) {
2022-08-31 19:19:29 -04:00
mda->firstline = mda->displine;
video_wait_for_buffer();
}
mda->lastline = mda->displine;
2025-06-16 23:41:01 +01:00
for (uint32_t x = 0; x < mda->crtc[MDA_CRTC_HDISP]; x++) {
chr = mda->vram[(mda->memaddr << 1) & 0xfff];
attr = mda->vram[((mda->memaddr << 1) + 1) & 0xfff];
drawcursor = ((mda->memaddr == cursoraddr) && mda->cursorvisible && mda->cursoron);
blink = ((mda->blink & 16) && (mda->mode & MDA_MODE_BLINK) && (attr & 0x80) && !drawcursor);
2025-06-16 21:56:01 +01:00
// Colours that will be used
2025-06-16 23:41:01 +01:00
int32_t color_bg = 0, color_fg = 0;
// If we are using an RGBI monitor allow colour
2025-06-16 21:56:01 +01:00
if (mda->monitor_type == MDA_MONITOR_TYPE_RGBI
2025-06-16 23:41:01 +01:00
&& !(mda->mode & MDA_MODE_BW)) {
2025-06-16 21:56:01 +01:00
color_bg = (attr >> 4) & 0x0F;
2025-06-16 23:41:01 +01:00
color_fg = (attr & 0x0F);
2025-06-16 21:56:01 +01:00
// turn off bright bg colours in blink mode
if ((mda->mode & MDA_MODE_BLINK)
2025-06-16 23:41:01 +01:00
&& (color_bg & 0x8))
2025-06-16 21:56:01 +01:00
color_bg & ~(0x8);
// black-on-non black or white colours forced to white
// grey-on-colours forced to bright white
bool special_treatment = (color_bg != 0 && color_bg != 7);
2025-06-16 23:41:01 +01:00
if (color_fg == 8
&& special_treatment)
color_fg = 15;
2025-06-16 23:41:01 +01:00
if (color_fg == 0
2025-06-16 23:41:01 +01:00
&& special_treatment)
2025-06-16 23:33:43 +01:00
color_fg = 8;
2025-06-16 23:41:01 +01:00
// gray is black
2025-06-16 23:33:43 +01:00
if (color_fg == 8
2025-06-16 23:41:01 +01:00
&& (color_bg == 8 || color_bg == 0))
color_fg = 0;
}
2025-06-16 23:41:01 +01:00
if (mda->scanline == 12
&& ((attr & 7) == 1)) { // underline
for (uint32_t column = 0; column < 9; column++) {
if (mda->monitor_type == MDA_MONITOR_TYPE_RGBI
&& !(mda->mode & MDA_MODE_BW)) {
buffer32->line[mda->displine][(x * 9) + column] = CGAPAL_CGA_START + color_fg;
2025-06-16 23:41:01 +01:00
} else
buffer32->line[mda->displine][(x * 9) + column] = mda_attr_to_color_table[attr][blink][1];
2025-06-16 21:52:18 +01:00
}
2025-06-16 23:41:01 +01:00
} else { // character
for (uint32_t column = 0; column < 8; column++) {
// bg=0, fg=1
bool is_fg = (fontdatm[chr + mda->fontbase][mda->scanline] & (1 << (column ^ 7))) ? 1 : 0;
uint32_t font_char = mda_attr_to_color_table[attr][blink][is_fg];
2025-06-16 23:41:01 +01:00
if (mda->monitor_type == MDA_MONITOR_TYPE_RGBI
&& !(mda->mode & MDA_MODE_BW)) {
if (!is_fg)
2025-06-16 23:41:01 +01:00
font_char = CGAPAL_CGA_START + color_bg;
else
font_char = CGAPAL_CGA_START + color_fg;
}
2025-06-16 23:41:01 +01:00
buffer32->line[mda->displine][(x * 9) + column] = font_char;
}
2025-06-16 23:41:01 +01:00
// these characters (C0-DF) have their background extended to their 9th column
2025-06-16 23:41:01 +01:00
if ((chr & ~0x1f) == 0xc0) {
bool is_fg = fontdatm[chr + mda->fontbase][mda->scanline] & 1;
uint32_t final_result = mda_attr_to_color_table[attr][blink][is_fg];
2025-06-16 23:41:01 +01:00
if (mda->monitor_type == MDA_MONITOR_TYPE_RGBI
&& !(mda->mode & MDA_MODE_BW)) {
if (!is_fg)
2025-06-16 23:41:01 +01:00
final_result = CGAPAL_CGA_START + color_bg;
else
2025-06-16 23:41:01 +01:00
final_result = CGAPAL_CGA_START + color_fg;
}
2025-06-16 23:41:01 +01:00
buffer32->line[mda->displine][(x * 9) + 8] = final_result;
2025-06-16 21:00:36 +01:00
2025-06-16 23:41:01 +01:00
} else {
if (mda->monitor_type == MDA_MONITOR_TYPE_RGBI
&& !(mda->mode & MDA_MODE_BW)) {
buffer32->line[mda->displine][(x * 9) + 8] = CGAPAL_CGA_START + color_bg;
} else
buffer32->line[mda->displine][(x * 9) + 8] = mda_attr_to_color_table[attr][blink][0];
}
}
2025-06-16 23:41:01 +01:00
mda->memaddr++;
2025-06-16 21:52:18 +01:00
2025-06-16 23:41:01 +01:00
if (drawcursor) {
for (uint32_t column = 0; column < 9; column++) {
if (mda->monitor_type == MDA_MONITOR_TYPE_RGBI
&& !(mda->mode & MDA_MODE_BW)) {
buffer32->line[mda->displine][(x * 9) + column] ^= CGAPAL_CGA_START + color_fg;
} else
buffer32->line[mda->displine][(x * 9) + column] ^= mda_attr_to_color_table[attr][0][1];
}
}
2022-08-31 19:19:29 -04:00
}
2022-10-30 17:02:33 +01:00
video_process_8(mda->crtc[MDA_CRTC_HDISP] * 9, mda->displine);
}
mda->scanline = scanline_old;
if (mda->vc == mda->crtc[MDA_CRTC_VSYNC] && !mda->scanline) {
mda->status |= 8;
2022-08-31 19:19:29 -04:00
}
mda->displine++;
if (mda->displine >= 500)
mda->displine = 0;
} else {
timer_advance_u64(&mda->timer, mda->dispontime);
if (mda->dispon)
mda->status &= ~1;
2022-08-31 19:19:29 -04:00
mda->linepos = 0;
2025-06-16 23:41:01 +01:00
if (mda->vsynctime) {
2022-08-31 19:19:29 -04:00
mda->vsynctime--;
2025-06-16 23:41:01 +01:00
if (!mda->vsynctime) {
mda->status &= ~8;
2022-08-31 19:19:29 -04:00
}
}
2025-06-16 23:41:01 +01:00
if (mda->scanline == (mda->crtc[MDA_CRTC_CURSOR_END] & 31)
|| ((mda->crtc[MDA_CRTC_INTERLACE] & 3) == 3
&& mda->scanline == ((mda->crtc[MDA_CRTC_CURSOR_END] & 31) >> 1))) {
mda->cursorvisible = 0;
2022-08-31 19:19:29 -04:00
}
2025-06-16 23:41:01 +01:00
if (mda->vadj) {
mda->scanline++;
mda->scanline &= 31;
mda->memaddr = mda->memaddr_backup;
2022-08-31 19:19:29 -04:00
mda->vadj--;
2025-06-16 23:41:01 +01:00
if (!mda->vadj) {
mda->dispon = 1;
mda->memaddr = mda->memaddr_backup = (mda->crtc[MDA_CRTC_START_ADDR_LOW] | (mda->crtc[MDA_CRTC_START_ADDR_HIGH] << 8)) & 0x3fff;
2025-06-16 23:41:01 +01:00
mda->scanline = 0;
2022-08-31 19:19:29 -04:00
}
2025-06-16 23:41:01 +01:00
} else if (mda->scanline == mda->crtc[MDA_CRTC_MAX_SCANLINE_ADDR]
|| ((mda->crtc[MDA_CRTC_INTERLACE] & 3) == 3
&& mda->scanline == (mda->crtc[MDA_CRTC_MAX_SCANLINE_ADDR] >> 1))) {
mda->memaddr_backup = mda->memaddr;
2025-06-16 23:41:01 +01:00
mda->scanline = 0;
oldvc = mda->vc;
2022-08-31 19:19:29 -04:00
mda->vc++;
mda->vc &= 127;
if (mda->vc == mda->crtc[MDA_CRTC_VDISP])
2022-08-31 19:19:29 -04:00
mda->dispon = 0;
if (oldvc == mda->crtc[MDA_CRTC_VTOTAL]) {
2022-08-31 19:19:29 -04:00
mda->vc = 0;
mda->vadj = mda->crtc[MDA_CRTC_VTOTAL_ADJUST];
2022-08-31 19:19:29 -04:00
if (!mda->vadj)
mda->dispon = 1;
if (!mda->vadj)
mda->memaddr = mda->memaddr_backup = (mda->crtc[MDA_CRTC_START_ADDR_LOW] | (mda->crtc[MDA_CRTC_START_ADDR_HIGH] << 8)) & 0x3fff;
if ((mda->crtc[MDA_CRTC_CURSOR_START] & 0x60) == 0x20)
2022-08-31 19:19:29 -04:00
mda->cursoron = 0;
else
2022-08-31 19:19:29 -04:00
mda->cursoron = mda->blink & 16;
}
if (mda->vc == mda->crtc[MDA_CRTC_VSYNC]) {
2022-08-31 19:19:29 -04:00
mda->dispon = 0;
mda->displine = 0;
mda->vsynctime = 16;
if (mda->crtc[MDA_CRTC_VSYNC]) {
uint32_t x = mda->crtc[MDA_CRTC_HDISP] * 9;
2022-08-31 19:19:29 -04:00
mda->lastline++;
if ((x != xsize) || ((mda->lastline - mda->firstline) != ysize) || video_force_resize_get()) {
xsize = x;
ysize = mda->lastline - mda->firstline;
if (xsize < 64)
xsize = 656;
if (ysize < 32)
ysize = 200;
set_screen_size(xsize, ysize);
if (video_force_resize_get())
video_force_resize_set(0);
}
2022-10-30 17:02:33 +01:00
video_blit_memtoscreen(0, mda->firstline, xsize, ysize);
2022-08-31 19:19:29 -04:00
frames++;
video_res_x = mda->crtc[MDA_CRTC_HDISP];
video_res_y = mda->crtc[MDA_CRTC_VDISP];
2022-08-31 19:19:29 -04:00
video_bpp = 0;
}
2022-08-31 19:19:29 -04:00
mda->firstline = 1000;
mda->lastline = 0;
mda->blink++;
}
} else {
mda->scanline++;
mda->scanline &= 31;
mda->memaddr = mda->memaddr_backup;
2022-08-31 19:19:29 -04:00
}
2025-06-16 23:41:01 +01:00
if (mda->scanline == (mda->crtc[MDA_CRTC_CURSOR_START] & 31)
|| ((mda->crtc[MDA_CRTC_INTERLACE] & 3) == 3
&& mda->scanline == ((mda->crtc[MDA_CRTC_CURSOR_START] & 31) >> 1))) {
mda->cursorvisible = 1;
}
2022-08-31 19:19:29 -04:00
}
VIDEO_MONITOR_EPILOGUE();
}
2022-08-31 19:19:29 -04:00
void
mda_init(mda_t *mda)
{
2025-06-16 23:41:01 +01:00
for (uint16_t attr = 0; attr < 256; attr++) {
2025-06-16 22:08:07 +01:00
mda_attr_to_color_table[attr][0][0] = mda_attr_to_color_table[attr][1][0] = mda_attr_to_color_table[attr][1][1] = 16;
if (attr & 8)
mda_attr_to_color_table[attr][0][1] = 15 + 16;
2022-08-31 19:19:29 -04:00
else
2025-06-16 22:08:07 +01:00
mda_attr_to_color_table[attr][0][1] = 7 + 16;
2022-08-31 19:19:29 -04:00
}
mda_attr_to_color_table[0x70][0][1] = 16;
2025-06-16 21:52:18 +01:00
mda_attr_to_color_table[0x70][0][0] = mda_attr_to_color_table[0x70][1][0] = mda_attr_to_color_table[0x70][1][1] = CGAPAL_CGA_START + 15;
2025-06-16 23:41:01 +01:00
mda_attr_to_color_table[0xF0][0][1] = 16;
2025-06-16 21:52:18 +01:00
mda_attr_to_color_table[0xF0][0][0] = mda_attr_to_color_table[0xF0][1][0] = mda_attr_to_color_table[0xF0][1][1] = CGAPAL_CGA_START + 15;
2025-06-16 23:41:01 +01:00
mda_attr_to_color_table[0x78][0][1] = CGAPAL_CGA_START + 7;
2025-06-16 21:52:18 +01:00
mda_attr_to_color_table[0x78][0][0] = mda_attr_to_color_table[0x78][1][0] = mda_attr_to_color_table[0x78][1][1] = CGAPAL_CGA_START + 15;
2025-06-16 23:41:01 +01:00
mda_attr_to_color_table[0xF8][0][1] = CGAPAL_CGA_START + 7;
2025-06-16 21:52:18 +01:00
mda_attr_to_color_table[0xF8][0][0] = mda_attr_to_color_table[0xF8][1][0] = mda_attr_to_color_table[0xF8][1][1] = CGAPAL_CGA_START + 15;
mda_attr_to_color_table[0x00][0][1] = mda_attr_to_color_table[0x00][1][1] = 16;
mda_attr_to_color_table[0x08][0][1] = mda_attr_to_color_table[0x08][1][1] = 16;
mda_attr_to_color_table[0x80][0][1] = mda_attr_to_color_table[0x80][1][1] = 16;
mda_attr_to_color_table[0x88][0][1] = mda_attr_to_color_table[0x88][1][1] = 16;
2022-08-31 19:19:29 -04:00
overscan_x = overscan_y = 0;
mda->monitor_index = monitor_index_global;
mda->monitor_type = device_get_config_int("rgb_type");
2025-06-16 23:41:01 +01:00
cga_palette = mda->monitor_type << 1;
2022-08-31 19:19:29 -04:00
if (cga_palette > 6) {
cga_palette = 0;
}
cgapal_rebuild();
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
2022-08-31 19:19:29 -04:00
timer_add(&mda->timer, mda_poll, mda, 1);
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
}
2022-08-31 19:19:29 -04:00
void *
2023-06-09 23:46:54 -04:00
mda_standalone_init(UNUSED(const device_t *info))
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
{
2022-08-31 19:19:29 -04:00
mda_t *mda = malloc(sizeof(mda_t));
memset(mda, 0, sizeof(mda_t));
video_inform(VIDEO_FLAG_TYPE_MDA, &timing_mda);
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
2022-08-31 19:19:29 -04:00
mda->vram = malloc(0x1000);
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
2025-06-16 23:41:01 +01:00
switch (device_get_config_int("font")) {
case 0:
loadfont(FONT_IBM_MDA_437_PATH, 0);
break;
case 1:
loadfont(FONT_IBM_MDA_437_NORDIC_PATH, 0);
break;
case 2:
loadfont(FONT_KAM_PATH, 0);
break;
case 3:
loadfont(FONT_KAMCL16_PATH, 0);
break;
}
mem_mapping_add(&mda->mapping, 0xb0000, 0x08000,
mda_read, NULL, NULL,
mda_write, NULL, NULL,
NULL, MEM_MAPPING_EXTERNAL,
mda);
io_sethandler(0x03b0, 0x0010,
mda_in, NULL, NULL,
mda_out, NULL, NULL,
mda);
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
2022-08-31 19:19:29 -04:00
mda_init(mda);
lpt3_setup(LPT_MDA_ADDR);
2022-08-31 19:19:29 -04:00
return mda;
}
2022-08-31 19:19:29 -04:00
void
mda_setcol(int chr, int blink, int fg, uint8_t cga_ink)
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
{
2025-06-16 21:52:18 +01:00
mda_attr_to_color_table[chr][blink][fg] = CGAPAL_CGA_START + cga_ink;
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
}
2022-08-31 19:19:29 -04:00
void
2023-06-09 23:46:54 -04:00
mda_close(void *priv)
{
2023-06-09 23:46:54 -04:00
mda_t *mda = (mda_t *) priv;
2022-08-31 19:19:29 -04:00
free(mda->vram);
free(mda);
}
2022-08-31 19:19:29 -04:00
void
2023-06-09 23:46:54 -04:00
mda_speed_changed(void *priv)
{
2023-06-09 23:46:54 -04:00
mda_t *mda = (mda_t *) priv;
2022-02-20 02:26:27 -05:00
2022-08-31 19:19:29 -04:00
mda_recalctimings(mda);
}
2022-02-26 23:31:28 -05:00
static const device_config_t mda_config[] = {
2025-06-16 23:41:01 +01:00
// clang-format off
2022-02-26 23:31:28 -05:00
{
2025-02-03 20:00:58 -05:00
.name = "rgb_type",
.description = "Display type",
.type = CONFIG_SELECTION,
.default_string = NULL,
.default_int = 0,
.file_filter = NULL,
.spinner = { 0 },
.selection =
{
{ .description = "Default", .value = MDA_MONITOR_TYPE_DEFAULT },
{ .description = "Green", .value = MDA_MONITOR_TYPE_GREEN },
{ .description = "Amber", .value = MDA_MONITOR_TYPE_AMBER },
{ .description = "Gray", .value = MDA_MONITOR_TYPE_GRAY },
{ .description = "Generic RGBI color monitor", .value = MDA_MONITOR_TYPE_RGBI },
{ .description = "" }
2025-02-03 20:00:58 -05:00
},
.bios = { { 0 } }
2022-02-26 23:31:28 -05:00
},
{
.name = "font",
.description = "Font",
.type = CONFIG_SELECTION,
.default_string = NULL,
.default_int = 0,
.file_filter = NULL,
.spinner = { 0 },
.selection =
{
{ .description = "US (CP 437)", .value = 0 },
{ .description = "IBM Nordic (CP 437-Nordic)", .value = 1 },
{ .description = "Czech Kamenicky (CP 895) #1", .value = 2 },
{ .description = "Czech Kamenicky (CP 895) #2", .value = 3 },
{ .description = "" }
},
.bios = { { 0 } }
},
2025-01-07 01:12:42 -05:00
{ .name = "", .description = "", .type = CONFIG_END }
2025-06-16 23:41:01 +01:00
// clang-format on
};
2022-02-26 23:31:28 -05:00
const device_t mda_device = {
.name = "IBM MDA",
2022-03-13 21:43:45 -04:00
.internal_name = "mda",
2022-08-31 19:19:29 -04:00
.flags = DEVICE_ISA,
.local = 0,
.init = mda_standalone_init,
.close = mda_close,
.reset = NULL,
2025-01-07 01:12:42 -05:00
.available = NULL,
2022-03-13 21:43:45 -04:00
.speed_changed = mda_speed_changed,
2022-08-31 19:19:29 -04:00
.force_redraw = NULL,
.config = mda_config
};