Added my name to all the emulator's files that I touched;

Unfinished JEGA emulation based on akm's DOSVAX (AX-emulating fork of DOSBox), not yet hooked into the reset of the emulator.
This commit is contained in:
OBattler
2017-05-30 03:38:38 +02:00
parent 7d53b48f79
commit 84595f1c78
133 changed files with 2706 additions and 314 deletions

View File

@@ -1,4 +1,21 @@
/*ATI Mach64 emulation*/
/*
* 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.
*
* ATi Mach64 graphics card emulation.
*
* Version: @(#)vid_ati_mach64.c 1.0.0 2017/05/30
*
* Author: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* Copyright 2008-2017 Sarah Walker.
* Copyright 2016-2017 Miran Grca.
*/
#include <stdlib.h>
#include "../ibm.h"
#include "../io.h"

View File

@@ -1,2 +1,20 @@
/*
* 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.
*
* ATi Mach64 graphics card emulation.
*
* Version: @(#)vid_ati_mach64.h 1.0.0 2017/05/30
*
* Author: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* Copyright 2008-2017 Sarah Walker.
* Copyright 2016-2017 Miran Grca.
*/
extern device_t mach64gx_device;
extern device_t mach64vt2_device;

View File

@@ -1,6 +1,21 @@
/* Copyright holders: Sarah Walker, Tenshi
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 old and new IBM CGA graphics cards.
*
* Version: @(#)vid_cga.c 1.0.0 2017/05/30
*
* Author: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* Copyright 2008-2017 Sarah Walker.
* Copyright 2016-2017 Miran Grca.
*/
/*CGA emulation*/
#include <stdlib.h>
#include <math.h>

View File

@@ -1,6 +1,21 @@
/* Copyright holders: Sarah Walker, Tenshi
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 old and new IBM CGA graphics cards.
*
* Version: @(#)vid_cga.h 1.0.0 2017/05/30
*
* Author: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* Copyright 2008-2017 Sarah Walker.
* Copyright 2016-2017 Miran Grca.
*/
typedef struct cga_t
{
mem_mapping_t mapping;

View File

@@ -1,5 +1,21 @@
/* Code borrowed from DOSBox and adapted by OBattler.
Original author: reenigne. */
/*
* 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.
*
* IBM CGA composite filter, borrowed from reenigne's DOSBox
* patch and ported to C.
*
* Version: @(#)vid_cga.c 1.0.0 2017/05/30
*
* Author: reenigne,
* Miran Grca, <mgrca8@gmail.com>
* Copyright 2015-2017 reenigne.
* Copyright 2015-2017 Miran Grca.
*/
#include <stdlib.h>
#include <stdint.h>

View File

@@ -1,3 +1,22 @@
/*
* 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.
*
* IBM CGA composite filter, borrowed from reenigne's DOSBox
* patch and ported to C.
*
* Version: @(#)vid_cga.h 1.0.0 2017/05/30
*
* Author: reenigne,
* Miran Grca, <mgrca8@gmail.com>
* Copyright 2015-2017 reenigne.
* Copyright 2015-2017 Miran Grca.
*/
#define Bit8u uint8_t
#define Bit32u uint32_t
#define Bitu unsigned int

View File

@@ -1,4 +1,25 @@
/*EGA emulation*/
/*
* 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 EGA, Chips & Technologies SuperEGA, and
* AX JEGA graphics cards.
*
* Version: @(#)vid_ega.c 1.0.0 2017/05/30
*
* Author: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* akm,
* Copyright 2008-2017 Sarah Walker.
* Copyright 2016-2017 Miran Grca.
* Copyright 2017-2017 akm.
*/
#include <stdint.h>
#include <stdlib.h>
#include "../ibm.h"
#include "../io.h"
@@ -23,11 +44,111 @@ static int old_overscan_color = 0;
int update_overscan = 0;
#define SBCS 0
#define DBCS 1
#define ID_LEN 6
#define NAME_LEN 8
#define SBCS19_LEN 256 * 19
#define DBCS16_LEN 65536 * 32
uint8_t jfont_sbcs_19[SBCS19_LEN];//256 * 19( * 8)
uint8_t jfont_dbcs_16[DBCS16_LEN];//65536 * 16 * 2 (* 8)
typedef struct {
char id[ID_LEN];
char name[NAME_LEN];
unsigned char width;
unsigned char height;
unsigned char type;
} fontx_h;
typedef struct {
uint16_t start;
uint16_t end;
} fontxTbl;
void ega_jega_write_font(ega_t *ega)
{
unsigned int chr = ega->RDFFB;
unsigned int chr_2 = ega->RDFSB;
ega->RSTAT &= ~0x02;
/* Check if the character code is in the Wide character set of Shift-JIS */
if (((chr >= 0x40) && (chr <= 0x7e)) || ((chr >= 0x80) && (chr <= 0xfc)))
{
if (ega->font_index >= 32)
{
ega->font_index = 0;
}
chr <<= 8;
/* Fix vertical character position */
chr |= chr_2;
if (ega->font_index < 16)
{
jfont_dbcs_16[(chr * 32) + (ega->font_index * 2)] = ega->RDFAP; /* 16x16 font */
}
else
{
jfont_dbcs_16[(chr * 32) + ((ega->font_index - 16) * 2) + 1] = ega->RDFAP; /* 16x16 font */
}
}
else
{
if (ega->font_index >= 19)
{
ega->font_index = 0;
}
jfont_sbcs_19[(chr * 19) + ega->font_index] = ega->RDFAP; /* 8x19 font */
}
ega->font_index++;
ega->RSTAT |= 0x02;
}
void ega_jega_read_font(ega_t *ega)
{
unsigned int chr = ega->RDFFB;
unsigned int chr_2 = ega->RDFSB;
ega->RSTAT &= ~0x02;
/* Check if the character code is in the Wide character set of Shift-JIS */
if (((chr >= 0x40) && (chr <= 0x7e)) || ((chr >= 0x80) && (chr <= 0xfc)))
{
if (ega->font_index >= 32)
{
ega->font_index = 0;
}
chr <<= 8;
/* Fix vertical character position */
chr |= chr_2;
if (ega->font_index < 16)
{
ega->RDFAP = jfont_dbcs_16[(chr * 32) + (ega->font_index * 2)]; /* 16x16 font */
}
else
{
ega->RDFAP = jfont_dbcs_16[(chr * 32) + ((ega->font_index - 16) * 2) + 1]; /* 16x16 font */
}
}
else
{
if (ega->font_index >= 19)
{
ega->font_index = 0;
}
ega->RDFAP = jfont_sbcs_19[(chr * 19) + ega->font_index]; /* 8x19 font */
}
ega->font_index++;
ega->RSTAT |= 0x02;
}
void ega_out(uint16_t addr, uint8_t val, void *p)
{
ega_t *ega = (ega_t *)p;
int c;
uint8_t o, old;
uint8_t crtcreg;
if (((addr & 0xfff0) == 0x3d0 || (addr & 0xfff0) == 0x3b0) && !(ega->miscout & 1))
addr ^= 0x60;
@@ -130,21 +251,82 @@ void ega_out(uint16_t addr, uint8_t val, void *p)
break;
case 0x3d0:
case 0x3d4:
ega->crtcreg = val & 31;
ega->crtcreg = val;
return;
case 0x3d1:
case 0x3d5:
if (ega->crtcreg <= 7 && ega->crtc[0x11] & 0x80) return;
old = ega->crtc[ega->crtcreg];
ega->crtc[ega->crtcreg] = val;
if (old != val)
{
if (ega->crtcreg < 0xe || ega->crtcreg > 0x10)
{
fullchange = changeframecount;
ega_recalctimings(ega);
}
}
if ((ega->crtcreg < 0xb9) || !ega->is_jega)
{
crtcreg = ega->crtcreg & 0x1f;
if (crtcreg <= 7 && ega->crtc[0x11] & 0x80) return;
old = ega->crtc[crtcreg];
ega->crtc[crtcreg] = val;
if (old != val)
{
if (crtcreg < 0xe || crtcreg > 0x10)
{
fullchange = changeframecount;
ega_recalctimings(ega);
}
}
}
else
{
switch(ega->crtcreg)
{
case 0xb9: /* Mode register 1 */
ega->RMOD1 = val;
break;
case 0xba: /* Mode register 2 */
ega->RMOD2 = val;
break;
case 0xbb: /* ANK Group sel */
ega->RDAGS = val;
break;
case 0xbc: /* Font access first byte */
if (ega->RDFFB != val)
{
ega->RDFFB = val;
ega->font_index = 0;
}
break;
case 0xbd: /* Font access Second Byte */
if (ega->RDFSB != val)
{
ega->RDFSB = val;
ega->font_index = 0;
}
break;
case 0xbe: /* Font Access Pattern */
ega->RDFAP = val;
ega_jega_write_font(ega);
break;
case 0xdb:
ega->RPSSC = val;
break;
case 0xd9:
ega->RPSSU = val;
break;
case 0xda:
ega->RPSSL = val;
break;
case 0xdc: /* Superimposed mode (only AX-2 system, not implemented) */
ega->RPPAJ = val;
break;
case 0xdd:
ega->RCMOD = val;
break;
case 0xde: /* Cursor Skew control */
ega->RCSKW = val;
break;
case 0xdf: /* Font R/W register */
ega->RSTAT = val;
break;
default:
pclog("JEGA: Write to illegal index %02X\n", ega->crtcreg);
break;
}
}
break;
}
}
@@ -174,6 +356,7 @@ static uint8_t ega_get_input_status_0(ega_t *ega)
uint8_t ega_in(uint16_t addr, void *p)
{
ega_t *ega = (ega_t *)p;
int crtcreg;
if (((addr & 0xfff0) == 0x3d0 || (addr & 0xfff0) == 0x3b0) && !(ega->miscout & 1))
addr ^= 0x60;
@@ -204,7 +387,49 @@ uint8_t ega_in(uint16_t addr, void *p)
return ega->crtcreg;
case 0x3d1:
case 0x3d5:
return ega->crtc[ega->crtcreg];
if ((ega->crtcreg < 0xb9) || !ega->is_jega)
{
crtcreg = ega->crtcreg & 0x1f;
return ega->crtc[crtcreg];
}
else
{
switch(ega->crtcreg)
{
case 0xb9:
return ega->RMOD1;
case 0xba:
return ega->RMOD2;
case 0xbb:
return ega->RDAGS;
case 0xbc: /* BCh RDFFB Font access First Byte */
return ega->RDFFB;
case 0xbd: /* BDh RDFFB Font access Second Byte */
return ega->RDFSB;
case 0xbe: /* BEh RDFAP Font Access Pattern */
ega_jega_read_font(ega);
return ega->RDFAP;
case 0xdb:
return ega->RPSSC;
case 0xd9:
return ega->RPSSU;
case 0xda:
return ega->RPSSL;
case 0xdc:
return ega->RPPAJ;
case 0xdd:
return ega->RCMOD;
case 0xde:
return ega->RCSKW;
case 0xdf:
return ega->ROMSL;
case 0xbf:
return 0x03; /* The font is always readable and writable */
default:
pclog("JEGA: Read from illegal index %02X\n", ega->crtcreg);
return 0x00;
}
}
case 0x3da:
ega->attrff = 0;
ega->stat ^= 0x30; /*Fools IBM EGA video BIOS self-test*/
@@ -936,6 +1161,8 @@ void ega_common_defaults(ega_t *ega)
ega->extvram = 1;
update_overscan = 0;
ega->is_jega = 0;
}
void *ega_standalone_init()
@@ -1048,6 +1275,112 @@ void *sega_standalone_init()
return ega;
}
uint16_t chrtosht(FILE *fp)
{
uint16_t i, j;
i = (uint8_t) getc(fp);
j = (uint8_t) getc(fp) << 8;
return (i | j);
}
unsigned int getfontx2header(FILE *fp, fontx_h *header)
{
fread(header->id, ID_LEN, 1, fp);
if (strncmp(header->id, "FONTX2", ID_LEN) != 0)
{
return 1;
}
fread(header->name, NAME_LEN, 1, fp);
header->width = (uint8_t)getc(fp);
header->height = (uint8_t)getc(fp);
header->type = (uint8_t)getc(fp);
return 0;
}
void readfontxtbl(fontxTbl *table, unsigned int size, FILE *fp)
{
while (size > 0)
{
table->start = chrtosht(fp);
table->end = chrtosht(fp);
++table;
--size;
}
}
static void LoadFontxFile(wchar_t *fname)
{
fontx_h head;
fontxTbl *table;
unsigned int code;
uint8_t size;
unsigned int i;
if (!fname) return;
if(*fname=='\0') return;
FILE * mfile=romfopen(fname,L"rb");
if (!mfile)
{
pclog("MSG: Can't open FONTX2 file: %s\n",fname);
return;
}
if (getfontx2header(mfile, &head) != 0)
{
fclose(mfile);
pclog("MSG: FONTX2 header is incorrect\n");
return;
}
/* switch whether the font is DBCS or not */
if (head.type == DBCS)
{
if (head.width == 16 && head.height == 16)
{
size = getc(mfile);
table = (fontxTbl *)calloc(size, sizeof(fontxTbl));
readfontxtbl(table, size, mfile);
for (i = 0; i < size; i++)
{
for (code = table[i].start; code <= table[i].end; code++)
{
fread(&jfont_dbcs_16[(code * 32)], sizeof(uint8_t), 32, mfile);
}
}
}
else
{
fclose(mfile);
pclog("MSG: FONTX2 DBCS font size is not correct\n");
return;
}
}
else
{
if (head.width == 8 && head.height == 19)
{
fread(jfont_sbcs_19, sizeof(uint8_t), SBCS19_LEN, mfile);
}
else
{
fclose(mfile);
pclog("MSG: FONTX2 SBCS font size is not correct\n");
return;
}
}
fclose(mfile);
}
void *jega_standalone_init()
{
ega_t *ega = (ega_t *) sega_standalone_init();
LoadFontxFile(L"roms/JPNHN19X.FNT");
LoadFontxFile(L"roms/JPNZN16X.FNT");
ega->is_jega = 1;
return ega;
}
static int ega_standalone_available()
{
return rom_present(L"roms/ibm_6277356_ega_card_u44_27128.bin");
@@ -1113,3 +1446,15 @@ device_t sega_device =
NULL,
NULL
};
device_t jega_device =
{
"AX JEGA",
0,
jega_standalone_init,
ega_close,
sega_standalone_available,
ega_speed_changed,
NULL,
NULL
};

View File

@@ -1,6 +1,26 @@
/* Copyright holders: Sarah Walker, Tenshi
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 EGA, Chips & Technologies SuperEGA, and
* AX JEGA graphics cards.
*
* Version: @(#)vid_ega.h 1.0.0 2017/05/30
*
* Author: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* akm,
* Copyright 2008-2017 Sarah Walker.
* Copyright 2016-2017 Miran Grca.
* Copyright 2017-2017 akm.
*/
#include <stdint.h>
typedef struct ega_t
{
mem_mapping_t mapping;
@@ -68,6 +88,12 @@ typedef struct ega_t
int vrammask;
int video_res_x, video_res_y, video_bpp;
uint8_t RMOD1, RMOD2, RDAGS, RDFFB, RDFSB, RDFAP, RPESL, RPULP, RPSSC, RPSSU, RPSSL;
uint8_t RPPAJ;
uint8_t RCMOD, RCCLH, RCCLL, RCCSL, RCCEL, RCSKW, ROMSL, RSTAT;
int is_jega, font_index;
int chr_left, chr_wide;
} ega_t;
extern int update_overscan;

View File

@@ -1,4 +1,22 @@
/*S3 emulation*/
/*
* 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 S3 Trio32, S3 Trio64, and S3 Vision864
* graphics cards.
*
* Version: @(#)vid_s3.c 1.0.0 2017/05/30
*
* Author: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* Copyright 2008-2017 Sarah Walker.
* Copyright 2016-2017 Miran Grca.
*/
#include <stdlib.h>
#include "../ibm.h"
#include "../io.h"

View File

@@ -1,6 +1,22 @@
/* 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 S3 Trio32, S3 Trio64, and S3 Vision864
* graphics cards.
*
* Version: @(#)vid_s3.h 1.0.0 2017/05/30
*
* Author: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* Copyright 2008-2017 Sarah Walker.
* Copyright 2016-2017 Miran Grca.
*/
device_t s3_bahamas64_device;
device_t s3_9fx_device;
device_t s3_phoenix_trio32_device;

View File

@@ -1,7 +1,21 @@
/* Copyright holders: Sarah Walker, Tenshi
see COPYING for more details
*/
/*Generic SVGA handling*/
/*
* 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.
*
* Generic SVGA handling.
*
* Version: @(#)vid_svga.c 1.0.0 2017/05/30
*
* Author: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* Copyright 2008-2017 Sarah Walker.
* Copyright 2016-2017 Miran Grca.
*/
/*This is intended to be used by another SVGA driver, and not as a card in it's own right*/
#include <stdio.h>
#include <stdlib.h>

View File

@@ -1,6 +1,21 @@
/* Copyright holders: Sarah Walker, Tenshi
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.
*
* Generic SVGA handling.
*
* Version: @(#)vid_svga.h 1.0.0 2017/05/30
*
* Author: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* Copyright 2008-2017 Sarah Walker.
* Copyright 2016-2017 Miran Grca.
*/
typedef struct svga_t
{
mem_mapping_t mapping;

View File

@@ -1,6 +1,21 @@
/* 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.
*
* SVGA renderers.
*
* Version: @(#)vid_svga_render.c 1.0.0 2017/05/30
*
* Author: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* Copyright 2008-2017 Sarah Walker.
* Copyright 2016-2017 Miran Grca.
*/
#include <stdio.h>
#include "../ibm.h"
#include "../mem.h"

View File

@@ -1,6 +1,21 @@
/* 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.
*
* SVGA renderers.
*
* Version: @(#)vid_svga_render.h 1.0.0 2017/05/30
*
* Author: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* Copyright 2008-2017 Sarah Walker.
* Copyright 2016-2017 Miran Grca.
*/
extern int firstline_draw, lastline_draw;
extern int displine;
extern int sc;