Added ATI Korean VGA, based on PCem patch from greatpsycho.
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
* - c386sx16 BIOS fails checksum
|
||||
* - the loadfont() calls should be done elsewhere
|
||||
*
|
||||
* Version: @(#)rom.c 1.0.29 2018/02/05
|
||||
* Version: @(#)rom.c 1.0.30 2018/03/02
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -261,6 +261,7 @@ rom_load_bios(int rom_id)
|
||||
loadfont(L"roms/video/mda/mda.rom", 0);
|
||||
loadfont(L"roms/video/wyse700/wy700.rom", 3);
|
||||
loadfont(L"roms/video/genius/8x12.bin", 4);
|
||||
loadfont(FONT_ATIKOR_PATH, 6);
|
||||
|
||||
/* If not done yet, allocate a 128KB buffer for the BIOS ROM. */
|
||||
if (rom == NULL)
|
||||
|
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* ATI 28800 emulation (VGA Charger)
|
||||
*
|
||||
* Version: @(#)vid_ati28800.c 1.0.7 2018/02/18
|
||||
* Version: @(#)vid_ati28800.c 1.0.8 2018/03/02
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -36,6 +36,8 @@
|
||||
#include "vid_svga_render.h"
|
||||
|
||||
|
||||
#define BIOS_ATIKOR_PATH L"roms/video/ati28800/atikorvga.bin"
|
||||
|
||||
#define BIOS_VGAXL_EVEN_PATH L"roms/video/ati28800/xleven.bin"
|
||||
#define BIOS_VGAXL_ODD_PATH L"roms/video/ati28800/xlodd.bin"
|
||||
|
||||
@@ -59,6 +61,16 @@ typedef struct ati28800_t
|
||||
} ati28800_t;
|
||||
|
||||
|
||||
uint8_t port_03dd_val;
|
||||
uint16_t get_korean_font_kind;
|
||||
int in_get_korean_font_kind_set;
|
||||
int get_korean_font_enabled;
|
||||
int get_korean_font_index;
|
||||
uint16_t get_korean_font_base;
|
||||
extern int dbcs_mode_enabled;
|
||||
|
||||
|
||||
|
||||
static void ati28800_out(uint16_t addr, uint8_t val, void *p)
|
||||
{
|
||||
ati28800_t *ati28800 = (ati28800_t *)p;
|
||||
@@ -118,6 +130,60 @@ static void ati28800_out(uint16_t addr, uint8_t val, void *p)
|
||||
svga_out(addr, val, svga);
|
||||
}
|
||||
|
||||
void ati28800k_out(uint16_t addr, uint8_t val, void *p)
|
||||
{
|
||||
ati28800_t *ati28800 = (ati28800_t *)p;
|
||||
svga_t *svga = &ati28800->svga;
|
||||
uint16_t oldaddr = addr;
|
||||
|
||||
if (((addr&0xFFF0) == 0x3D0 || (addr&0xFFF0) == 0x3B0) && !(svga->miscout&1))
|
||||
addr ^= 0x60;
|
||||
|
||||
switch (addr)
|
||||
{
|
||||
case 0x1CF:
|
||||
if(ati28800->index == 0xBF && ((ati28800->regs[0xBF] ^ val) & 0x20))
|
||||
{
|
||||
dbcs_mode_enabled = val & 0x20;
|
||||
svga_recalctimings(svga);
|
||||
|
||||
}
|
||||
ati28800_out(oldaddr, val, p);
|
||||
break;
|
||||
case 0x3DD:
|
||||
port_03dd_val = val;
|
||||
if(val == 1) get_korean_font_enabled = 0;
|
||||
if(in_get_korean_font_kind_set)
|
||||
{
|
||||
get_korean_font_kind = (val << 8) | (get_korean_font_kind & 0xFF);
|
||||
get_korean_font_enabled = 1;
|
||||
get_korean_font_index = 0;
|
||||
}
|
||||
break;
|
||||
case 0x3DE:
|
||||
in_get_korean_font_kind_set = 0;
|
||||
switch(port_03dd_val)
|
||||
{
|
||||
case 0x10:
|
||||
get_korean_font_base = ((val & 0x7F) << 7) | (get_korean_font_base & 0x7F);
|
||||
break;
|
||||
case 8:
|
||||
get_korean_font_base = (get_korean_font_base & 0x3F80) | (val & 0x7F);
|
||||
break;
|
||||
case 1:
|
||||
get_korean_font_kind = (get_korean_font_kind & 0xFF00) | val;
|
||||
if(val & 2) in_get_korean_font_kind_set = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ati28800_out(oldaddr, val, p);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static uint8_t ati28800_in(uint16_t addr, void *p)
|
||||
{
|
||||
ati28800_t *ati28800 = (ati28800_t *)p;
|
||||
@@ -168,6 +234,44 @@ static uint8_t ati28800_in(uint16_t addr, void *p)
|
||||
return temp;
|
||||
}
|
||||
|
||||
uint8_t ati28800k_in(uint16_t addr, void *p)
|
||||
{
|
||||
ati28800_t *ati28800 = (ati28800_t *)p;
|
||||
svga_t *svga = &ati28800->svga;
|
||||
uint16_t oldaddr = addr;
|
||||
uint8_t temp = 0xFF;
|
||||
|
||||
// if (addr != 0x3da) pclog("ati28800_in : %04X ", addr);
|
||||
|
||||
if (((addr&0xFFF0) == 0x3D0 || (addr&0xFFF0) == 0x3B0) && !(svga->miscout&1)) addr ^= 0x60;
|
||||
|
||||
switch (addr)
|
||||
{
|
||||
case 0x3DE:
|
||||
if(get_korean_font_enabled && (ati28800->regs[0xBF] & 0x20))
|
||||
{
|
||||
switch(get_korean_font_kind >> 8)
|
||||
{
|
||||
case 4: /* ROM font */
|
||||
temp = fontdatksc5601[get_korean_font_base][get_korean_font_index++];
|
||||
break;
|
||||
case 2: /* User defined font - TODO : Should be implemented later */
|
||||
temp = 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
get_korean_font_index &= 0x1F;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
temp = ati28800_in(oldaddr, p);
|
||||
break;
|
||||
}
|
||||
if (addr != 0x3da) pclog("%02X %04X:%04X\n", temp, CS,cpu_state.pc);
|
||||
return temp;
|
||||
}
|
||||
|
||||
static void ati28800_recalctimings(svga_t *svga)
|
||||
{
|
||||
ati28800_t *ati28800 = (ati28800_t *)svga->p;
|
||||
@@ -181,6 +285,39 @@ static void ati28800_recalctimings(svga_t *svga)
|
||||
}
|
||||
}
|
||||
|
||||
void *
|
||||
ati28800k_init(device_t *info)
|
||||
{
|
||||
ati28800_t *ati28800 = malloc(sizeof(ati28800_t));
|
||||
memset(ati28800, 0, sizeof(ati28800_t));
|
||||
|
||||
|
||||
port_03dd_val = 0;
|
||||
get_korean_font_base = 0;
|
||||
get_korean_font_index = 0;
|
||||
get_korean_font_enabled = 0;
|
||||
get_korean_font_kind = 0;
|
||||
in_get_korean_font_kind_set = 0;
|
||||
dbcs_mode_enabled = 0;
|
||||
|
||||
rom_init(&ati28800->bios_rom, BIOS_ATIKOR_PATH, 0xc0000, 0x8000, 0x7fff, 0, MEM_MAPPING_EXTERNAL);
|
||||
|
||||
svga_init(&ati28800->svga, ati28800, 1 << 19, /*512kb*/
|
||||
ati28800_recalctimings,
|
||||
ati28800k_in, ati28800k_out,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
io_sethandler(0x01ce, 0x0002, ati28800k_in, NULL, NULL, ati28800k_out, NULL, NULL, ati28800);
|
||||
io_sethandler(0x03c0, 0x0020, ati28800k_in, NULL, NULL, ati28800k_out, NULL, NULL, ati28800);
|
||||
|
||||
ati28800->svga.miscout = 1;
|
||||
|
||||
ati_eeprom_load(&ati28800->eeprom, L"atikorvga.nvr", 0);
|
||||
|
||||
return ati28800;
|
||||
}
|
||||
|
||||
static void *
|
||||
ati28800_init(device_t *info)
|
||||
{
|
||||
@@ -250,6 +387,13 @@ ati28800_available(void)
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
ati28800k_available()
|
||||
{
|
||||
return ((rom_present(BIOS_ATIKOR_PATH) && rom_present(FONT_ATIKOR_PATH)));
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
compaq_ati28800_available(void)
|
||||
{
|
||||
@@ -362,6 +506,19 @@ device_t ati28800_device =
|
||||
ati28800_config
|
||||
};
|
||||
|
||||
device_t ati28800k_device =
|
||||
{
|
||||
"ATI Korean VGA",
|
||||
DEVICE_ISA,
|
||||
0,
|
||||
ati28800k_init, ati28800_close, NULL,
|
||||
ati28800k_available,
|
||||
ati28800_speed_changed,
|
||||
ati28800_force_redraw,
|
||||
ati28800_add_status_info,
|
||||
ati28800_config
|
||||
};
|
||||
|
||||
device_t compaq_ati28800_device =
|
||||
{
|
||||
"Compaq ATI-28800",
|
||||
|
@@ -2,6 +2,7 @@
|
||||
see COPYING for more details
|
||||
*/
|
||||
extern device_t ati28800_device;
|
||||
extern device_t ati28800k_device;
|
||||
extern device_t compaq_ati28800_device;
|
||||
#if defined(DEV_BRANCH) && defined(USE_XL24)
|
||||
extern device_t ati28800_wonderxl24_device;
|
||||
|
@@ -11,7 +11,7 @@
|
||||
* This is intended to be used by another SVGA driver,
|
||||
* and not as a card in it's own right.
|
||||
*
|
||||
* Version: @(#)vid_svga.c 1.0.22 2018/03/01
|
||||
* Version: @(#)vid_svga.c 1.0.23 2018/03/02
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -409,7 +409,7 @@ void svga_recalctimings(svga_t *svga)
|
||||
svga->hdisp_time = svga->hdisp;
|
||||
svga->render = svga_render_blank;
|
||||
if (!svga->scrblank && svga->attr_palette_enable) {
|
||||
if (!(svga->gdcreg[6] & 1)) /*Text mode*/ {
|
||||
if (!(svga->gdcreg[6] & 1) && !(svga->attrregs[0x10] & 1)) { /*Text mode*/
|
||||
if (svga->seqregs[1] & 8) /*40 column*/ {
|
||||
svga->render = svga_render_text_40;
|
||||
svga->hdisp *= (svga->seqregs[1] & 1) ? 16 : 18;
|
||||
@@ -666,7 +666,7 @@ void svga_poll(void *p)
|
||||
|
||||
svga->video_res_x = wx;
|
||||
svga->video_res_y = wy + 1;
|
||||
if (!(svga->gdcreg[6] & 1)) { /*Text mode*/
|
||||
if (!(svga->gdcreg[6] & 1) && !(svga->attrregs[0x10] & 1)) { /*Text mode*/
|
||||
svga->video_res_x /= (svga->seqregs[1] & 1) ? 8 : 9;
|
||||
svga->video_res_y /= (svga->crtc[9] & 31) + 1;
|
||||
svga->video_bpp = 0;
|
||||
|
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* SVGA renderers.
|
||||
*
|
||||
* Version: @(#)vid_svga_render.c 1.0.5 2018/02/08
|
||||
* Version: @(#)vid_svga_render.c 1.0.6 2018/03/02
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -92,6 +92,9 @@ uint32_t shade[5][256] =
|
||||
}
|
||||
};
|
||||
|
||||
int dbcs_mode_enabled = 0;
|
||||
|
||||
|
||||
void svga_render_blank(svga_t *svga)
|
||||
{
|
||||
int x, xx;
|
||||
@@ -205,7 +208,7 @@ void svga_render_text_80(svga_t *svga)
|
||||
uint32_t *p = &((uint32_t *)buffer32->line[svga->displine + y_add])[32 + x_add];
|
||||
int x, xx;
|
||||
int drawcursor;
|
||||
uint8_t chr, attr, dat;
|
||||
uint8_t chr, attr, dat, nextchr;
|
||||
uint32_t charaddr;
|
||||
int fg, bg;
|
||||
int xinc = (svga->seqregs[1] & 1) ? 8 : 9;
|
||||
@@ -215,6 +218,85 @@ void svga_render_text_80(svga_t *svga)
|
||||
drawcursor = ((svga->ma == svga->ca) && svga->con && svga->cursoron);
|
||||
chr = svga->vram[(svga->ma << 1) & svga->vram_display_mask];
|
||||
attr = svga->vram[((svga->ma << 1) + 1) & svga->vram_display_mask];
|
||||
|
||||
|
||||
if(dbcs_mode_enabled && x + xinc < svga->hdisp && chr & 0x80)
|
||||
{
|
||||
nextchr = svga->vram[((svga->ma + 4) << 1) & svga->vram_display_mask];
|
||||
if(nextchr & 0x80)
|
||||
{
|
||||
if (drawcursor)
|
||||
{
|
||||
bg = svga->pallook[svga->egapal[attr & 15]];
|
||||
fg = svga->pallook[svga->egapal[attr >> 4]];
|
||||
}
|
||||
else
|
||||
{
|
||||
fg = svga->pallook[svga->egapal[attr & 15]];
|
||||
bg = svga->pallook[svga->egapal[attr >> 4]];
|
||||
if (attr & 0x80 && svga->attrregs[0x10] & 8)
|
||||
{
|
||||
bg = svga->pallook[svga->egapal[(attr >> 4) & 7]];
|
||||
if (svga->blink & 16)
|
||||
fg = bg;
|
||||
}
|
||||
}
|
||||
|
||||
dat = fontdatksc5601[((chr & 0x7F) << 7) | (nextchr & 0x7F)][svga->sc];
|
||||
if (svga->seqregs[1] & 1)
|
||||
{
|
||||
for (xx = 0; xx < 8; xx++)
|
||||
p[xx] = (dat & (0x80 >> xx)) ? fg : bg;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (xx = 0; xx < 8; xx++)
|
||||
p[xx] = (dat & (0x80 >> xx)) ? fg : bg;
|
||||
if ((chr & ~0x1F) != 0xC0 || !(svga->attrregs[0x10] & 4))
|
||||
p[8] = bg;
|
||||
else
|
||||
p[8] = (dat & 1) ? fg : bg;
|
||||
}
|
||||
|
||||
attr = svga->vram[(((svga->ma + 4) << 1) + 1) & svga->vram_display_mask];
|
||||
if (drawcursor)
|
||||
{
|
||||
bg = svga->pallook[svga->egapal[attr & 15]];
|
||||
fg = svga->pallook[svga->egapal[attr >> 4]];
|
||||
}
|
||||
else
|
||||
{
|
||||
fg = svga->pallook[svga->egapal[attr & 15]];
|
||||
bg = svga->pallook[svga->egapal[attr >> 4]];
|
||||
if (attr & 0x80 && svga->attrregs[0x10] & 8)
|
||||
{
|
||||
bg = svga->pallook[svga->egapal[(attr >> 4) & 7]];
|
||||
if (svga->blink & 16)
|
||||
fg = bg;
|
||||
}
|
||||
}
|
||||
|
||||
dat = fontdatksc5601[((chr & 0x7F) << 7) | (nextchr & 0x7F)][svga->sc + 16];
|
||||
if (svga->seqregs[1] & 1)
|
||||
{
|
||||
for (xx = 0; xx < 8; xx++)
|
||||
p[xx+8] = (dat & (0x80 >> xx)) ? fg : bg;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (xx = 0; xx < 8; xx++)
|
||||
p[xx+9] = (dat & (0x80 >> xx)) ? fg : bg;
|
||||
if ((chr & ~0x1F) != 0xC0 || !(svga->attrregs[0x10] & 4))
|
||||
p[17] = bg;
|
||||
else
|
||||
p[17] = (dat & 1) ? fg : bg;
|
||||
}
|
||||
svga->ma += 8;
|
||||
p += xinc * 2;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (attr & 8) charaddr = svga->charsetb + (chr * 128);
|
||||
else charaddr = svga->charseta + (chr * 128);
|
||||
|
||||
@@ -339,16 +421,8 @@ void svga_render_2bpp_highres(svga_t *svga)
|
||||
{
|
||||
uint8_t dat[2];
|
||||
|
||||
if (svga->sc & 1 && !(svga->crtc[0x17] & 1))
|
||||
{
|
||||
dat[0] = svga->vram[(svga->ma << 1) + 0x8000];
|
||||
dat[1] = svga->vram[(svga->ma << 1) + 0x8001];
|
||||
}
|
||||
else
|
||||
{
|
||||
dat[0] = svga->vram[(svga->ma << 1)];
|
||||
dat[1] = svga->vram[(svga->ma << 1) + 1];
|
||||
}
|
||||
dat[0] = svga->vram[(svga->ma << 1) + ((svga->sc & 3) & (~svga->crtc[0x17] & 3)) * 0x8000];
|
||||
dat[1] = svga->vram[(svga->ma << 1) + ((svga->sc & 3) & (~svga->crtc[0x17] & 3)) * 0x8000 + 1];
|
||||
svga->ma += 4;
|
||||
svga->ma &= svga->vram_display_mask;
|
||||
|
||||
@@ -435,10 +509,8 @@ void svga_render_4bpp_highres(svga_t *svga)
|
||||
uint8_t edat[4];
|
||||
uint8_t dat;
|
||||
|
||||
if (svga->sc & 1 && !(svga->crtc[0x17] & 1))
|
||||
*(uint32_t *)(&edat[0]) = *(uint32_t *)(&svga->vram[svga->ma | 0x8000]);
|
||||
else
|
||||
*(uint32_t *)(&edat[0]) = *(uint32_t *)(&svga->vram[svga->ma]);
|
||||
*(uint32_t *)(&edat[0]) = *(uint32_t *)(&svga->vram[svga->ma | ((svga->sc & 3) & (~svga->crtc[0x17] & 3)) * 0x8000]);
|
||||
|
||||
svga->ma += 4;
|
||||
svga->ma &= svga->vram_display_mask;
|
||||
|
||||
|
@@ -40,7 +40,7 @@
|
||||
* W = 3 bus clocks
|
||||
* L = 4 bus clocks
|
||||
*
|
||||
* Version: @(#)video.c 1.0.16 2018/02/24
|
||||
* Version: @(#)video.c 1.0.17 2018/03/02
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -79,6 +79,7 @@ uint8_t fontdat[2048][8]; /* IBM CGA font */
|
||||
uint8_t fontdatm[2048][16]; /* IBM MDA font */
|
||||
uint8_t fontdatw[512][32]; /* Wyse700 font */
|
||||
uint8_t fontdat8x12[256][16]; /* MDSI Genius font */
|
||||
uint8_t fontdatksc5601[16384][32]; /* Korean KSC-5601 font */
|
||||
uint32_t pal_lookup[256];
|
||||
int xsize = 1,
|
||||
ysize = 1;
|
||||
@@ -757,6 +758,16 @@ loadfont(wchar_t *s, int format)
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 6: /* Korean KSC-5601 */
|
||||
for (c=0;c<16384;c++)
|
||||
{
|
||||
for (d=0;d<32;d++)
|
||||
{
|
||||
fontdatksc5601[c][d]=getc(f);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
(void)fclose(f);
|
||||
|
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Definitions for the video controller module.
|
||||
*
|
||||
* Version: @(#)video.h 1.0.21 2018/02/25
|
||||
* Version: @(#)video.h 1.0.22 2018/03/02
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -22,6 +22,9 @@
|
||||
# define EMU_VIDEO_H
|
||||
|
||||
|
||||
#define FONT_ATIKOR_PATH L"roms/video/ati28800/ati_ksc5601.rom"
|
||||
|
||||
|
||||
#define makecol(r, g, b) ((b) | ((g) << 8) | ((r) << 16))
|
||||
#define makecol32(r, g, b) ((b) | ((g) << 8) | ((r) << 16))
|
||||
|
||||
@@ -58,6 +61,7 @@ enum {
|
||||
GFX_TGUI9400CXI, /* Trident TGUI9400CXi VLB */
|
||||
GFX_TGUI9440_VLB, /* Trident TGUI9440AGi VLB */
|
||||
GFX_TGUI9440_PCI, /* Trident TGUI9440AGi PCI */
|
||||
GFX_ATIKOREANVGA, /*ATI Korean VGA (28800-5)*/
|
||||
GFX_VGA88, /* ATI VGA-88 (18800-1) */
|
||||
GFX_VGAEDGE16, /* ATI VGA Edge-16 (18800-1) */
|
||||
GFX_VGACHARGER, /* ATI VGA Charger (28800-5) */
|
||||
@@ -166,6 +170,7 @@ extern int video_fullscreen,
|
||||
extern int fullchange;
|
||||
extern uint8_t fontdat[2048][8];
|
||||
extern uint8_t fontdatm[2048][16];
|
||||
extern uint8_t fontdatksc5601[16384][32];
|
||||
extern uint32_t *video_6to8,
|
||||
*video_15to32,
|
||||
*video_16to32;
|
||||
|
Reference in New Issue
Block a user