diff --git a/src/video/vid_ati28800.c b/src/video/vid_ati28800.c
index 729e7ea6e..cc6be6487 100644
--- a/src/video/vid_ati28800.c
+++ b/src/video/vid_ati28800.c
@@ -6,9 +6,9 @@
*
* This file is part of the 86Box distribution.
*
- * ATI 28800 emulation (VGA Charger)
+ * ATI 28800 emulation (VGA Charger and Korean VGA)
*
- * Version: @(#)vid_ati28800.c 1.0.8 2018/03/02
+ * Version: @(#)vid_ati28800.c 1.0.9 2018/03/05
*
* Authors: Sarah Walker,
* Miran Grca,
@@ -58,6 +58,8 @@ typedef struct ati28800_t
uint8_t regs[256];
int index;
+
+ uint32_t memory;
} ati28800_t;
@@ -68,7 +70,6 @@ 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)
@@ -88,6 +89,7 @@ static void ati28800_out(uint16_t addr, uint8_t val, void *p)
ati28800->index = val;
break;
case 0x1cf:
+ old=ati28800->regs[ati28800->index];
ati28800->regs[ati28800->index] = val;
switch (ati28800->index)
{
@@ -104,6 +106,9 @@ static void ati28800_out(uint16_t addr, uint8_t val, void *p)
case 0xb3:
ati_eeprom_write(&ati28800->eeprom, val & 8, val & 2, val & 1);
break;
+ case 0xb6:
+ if((old ^ val) & 0x10) svga_recalctimings(svga);
+ break;
}
break;
@@ -158,6 +163,7 @@ void ati28800k_out(uint16_t addr, uint8_t val, void *p)
get_korean_font_kind = (val << 8) | (get_korean_font_kind & 0xFF);
get_korean_font_enabled = 1;
get_korean_font_index = 0;
+ in_get_korean_font_kind_set = 0;
}
break;
case 0x3DE:
@@ -202,6 +208,15 @@ static uint8_t ati28800_in(uint16_t addr, void *p)
case 0x1cf:
switch (ati28800->index)
{
+ case 0xb0:
+ if (ati28800->memory == 256)
+ return 0x08;
+ else if (ati28800->memory == 512)
+ return 0x10;
+ else
+ return 0x18;
+ break;
+
case 0xb7:
temp = ati28800->regs[ati28800->index] & ~8;
if (ati_eeprom_read(&ati28800->eeprom))
@@ -275,11 +290,18 @@ uint8_t ati28800k_in(uint16_t addr, void *p)
static void ati28800_recalctimings(svga_t *svga)
{
ati28800_t *ati28800 = (ati28800_t *)svga->p;
- pclog("ati28800_recalctimings\n");
+
+ if (ati28800->regs[0xb6] & 0x10)
+ {
+ svga->hdisp <<= 1;
+ svga->htotal <<= 1;
+ svga->rowoffset <<= 1;
+ }
+
if (!svga->scrblank && (ati28800->regs[0xb0] & 0x20)) /*Extended 256 colour modes*/
{
- pclog("8bpp_highres\n");
svga->render = svga_render_8bpp_highres;
+ svga->bpp = 8;
svga->rowoffset <<= 1;
svga->ma <<= 1;
}
@@ -291,7 +313,8 @@ ati28800k_init(device_t *info)
ati28800_t *ati28800 = malloc(sizeof(ati28800_t));
memset(ati28800, 0, sizeof(ati28800_t));
-
+ ati28800->memory = device_get_config_int("memory");
+
port_03dd_val = 0;
get_korean_font_base = 0;
get_korean_font_index = 0;
@@ -301,8 +324,9 @@ ati28800k_init(device_t *info)
dbcs_mode_enabled = 0;
rom_init(&ati28800->bios_rom, BIOS_ATIKOR_PATH, 0xc0000, 0x8000, 0x7fff, 0, MEM_MAPPING_EXTERNAL);
+ loadfont(FONT_ATIKOR_PATH, 6);
- svga_init(&ati28800->svga, ati28800, 1 << 19, /*512kb*/
+ svga_init(&ati28800->svga, ati28800, ati28800->memory << 10, /*Memory size, default 512KB*/
ati28800_recalctimings,
ati28800k_in, ati28800k_out,
NULL,
@@ -321,17 +345,12 @@ ati28800k_init(device_t *info)
static void *
ati28800_init(device_t *info)
{
- uint32_t memory = 512;
ati28800_t *ati;
-
-#if 0
- if (info->type == GFX_VGAWONDERXL)
-#endif
- memory = device_get_config_int("memory");
-memory <<= 10;
ati = malloc(sizeof(ati28800_t));
memset(ati, 0x00, sizeof(ati28800_t));
+ ati->memory = device_get_config_int("memory");
+
switch(info->local) {
case GFX_VGAWONDERXL:
rom_init_interleaved(&ati->bios_rom,
@@ -359,7 +378,7 @@ memory <<= 10;
break;
}
- svga_init(&ati->svga, ati, memory, /*512kb*/
+ svga_init(&ati->svga, ati, ati->memory << 10, /*default: 512kb*/
ati28800_recalctimings,
ati28800_in, ati28800_out,
NULL,
@@ -457,6 +476,9 @@ static device_config_t ati28800_config[] =
{
"512 kB", 512
},
+ {
+ "1024 kB", 1024
+ },
{
""
}
diff --git a/src/video/vid_svga.c b/src/video/vid_svga.c
index d17a3aae0..0f75e9480 100644
--- a/src/video/vid_svga.c
+++ b/src/video/vid_svga.c
@@ -390,6 +390,15 @@ void svga_recalctimings(svga_t *svga)
if (svga->crtc[9] & 0x20) svga->vblankstart |= 0x200;
svga->vblankstart++;
+ if(svga->crtc[0x17] & 4)
+ {
+ svga->vtotal <<= 1;
+ svga->dispend <<= 1;
+ svga->vsyncstart <<= 1;
+ svga->split <<= 1;
+ svga->vblankstart <<= 1;
+ }
+
svga->hdisp = svga->crtc[1];
svga->hdisp++;
@@ -515,7 +524,7 @@ void svga_poll(void *p)
}
if (svga->displine == svga->hwcursor_latch.y+1 && svga->hwcursor_latch.ena && svga->interlace) {
- svga->hwcursor_on = 64 - svga->hwcursor_latch.yoff;
+ svga->hwcursor_on = 64 - (svga->hwcursor_latch.yoff + 1);
svga->hwcursor_oddeven = 1;
}
@@ -673,7 +682,9 @@ void svga_poll(void *p)
} else {
if (svga->crtc[9] & 0x80)
svga->video_res_y /= 2;
- if (!(svga->crtc[0x17] & 1))
+ if (!(svga->crtc[0x17] & 2))
+ svga->video_res_y *= 4;
+ else if (!(svga->crtc[0x17] & 1))
svga->video_res_y *= 2;
svga->video_res_y /= (svga->crtc[9] & 31) + 1;
if (svga->lowres)
@@ -1440,9 +1451,9 @@ void svga_writeb_linear(uint32_t addr, uint8_t val, void *p)
return;
}
- egawrites += 2;
+ egawrites++;
- if (svga_output) pclog("Write LFBw %08X %04X\n", addr, val);
+ if (svga_output) pclog("Write LFBb %08X %04X\n", addr, val);
addr &= svga->decode_mask;
if (addr >= svga->vram_max)
return;