Do not allow mouse capturing if no mouse configured, patch from VARCem;

Reimplemented saving of all the non-volatile things of the Toshiba T1000 and T1200;
Applied the latest T1200 patch from John Elliott;
Applied the latest ATI Korean VGA patch from greatpsycho.
This commit is contained in:
OBattler
2018-03-19 04:19:19 +01:00
parent 089041a5f3
commit 473fd383d2
10 changed files with 234 additions and 101 deletions

View File

@@ -8,13 +8,15 @@
*
* ATI 28800 emulation (VGA Charger and Korean VGA)
*
* Version: @(#)vid_ati28800.c 1.0.13 2018/03/18
* Version: @(#)vid_ati28800.c 1.0.14 2018/03/19
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* greatpsycho,
*
* Copyright 2008-2018 Sarah Walker.
* Copyright 2016-2018 Miran Grca.
* Copyright 2018 greatpsycho.
*/
#include <stdio.h>
#include <stdint.h>
@@ -60,18 +62,17 @@ typedef struct ati28800_t
int index;
uint32_t memory;
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;
int ksc5601_mode_enabled;
} 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;
int ksc5601_mode_enabled;
static void ati28800_out(uint16_t addr, uint8_t val, void *p)
{
ati28800_t *ati28800 = (ati28800_t *)p;
@@ -154,43 +155,53 @@ void ati28800k_out(uint16_t addr, uint8_t val, void *p)
case 0x1CF:
if(ati28800->index == 0xBF && ((ati28800->regs[0xBF] ^ val) & 0x20))
{
ksc5601_mode_enabled = val & 0x20;
ati28800->ksc5601_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)
ati28800->port_03dd_val = val;
if(val == 1) ati28800->get_korean_font_enabled = 0;
if(ati28800->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;
in_get_korean_font_kind_set = 0;
ati28800->get_korean_font_kind = (val << 8) | (ati28800->get_korean_font_kind & 0xFF);
ati28800->get_korean_font_enabled = 1;
ati28800->get_korean_font_index = 0;
ati28800->in_get_korean_font_kind_set = 0;
}
break;
case 0x3DE:
in_get_korean_font_kind_set = 0;
switch(port_03dd_val)
ati28800->in_get_korean_font_kind_set = 0;
if(ati28800->get_korean_font_enabled && (ati28800->regs[0xBF] & 0x20))
{
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;
if((ati28800->get_korean_font_base & 0x7F) > 0x20 && (ati28800->get_korean_font_base & 0x7F) < 0x7F)
fontdatksc5601_user[(ati28800->get_korean_font_kind & 4) * 24 + (ati28800->get_korean_font_base & 0x7F) - 0x20].chr[ati28800->get_korean_font_index] = val;
ati28800->get_korean_font_index++;
ati28800->get_korean_font_index &= 0x1F;
}
break;
default:
ati28800_out(oldaddr, val, p);
else
{
switch(ati28800->port_03dd_val)
{
case 0x10:
ati28800->get_korean_font_base = ((val & 0x7F) << 7) | (ati28800->get_korean_font_base & 0x7F);
break;
case 8:
ati28800->get_korean_font_base = (ati28800->get_korean_font_base & 0x3F80) | (val & 0x7F);
break;
case 1:
ati28800->get_korean_font_kind = (ati28800->get_korean_font_kind & 0xFF00) | val;
if(val & 2)
ati28800->in_get_korean_font_kind_set = 1;
break;
}
break;
}
default:
ati28800_out(oldaddr, val, p);
break;
}
}
@@ -213,15 +224,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 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))
@@ -301,20 +312,24 @@ uint8_t ati28800k_in(uint16_t addr, void *p)
switch (addr)
{
case 0x3DE:
if(get_korean_font_enabled && (ati28800->regs[0xBF] & 0x20))
if (ati28800->get_korean_font_enabled && (ati28800->regs[0xBF] & 0x20))
{
switch(get_korean_font_kind >> 8)
switch(ati28800->get_korean_font_kind >> 8)
{
case 4: /* ROM font */
temp = fontdatksc5601[get_korean_font_base].chr[get_korean_font_index++];
temp = fontdatksc5601[ati28800->get_korean_font_base].chr[ati28800->get_korean_font_index++];
break;
case 2: /* User defined font - TODO : Should be implemented later */
temp = 0;
case 2: /* User defined font */
if((ati28800->get_korean_font_base & 0x7F) > 0x20 && (ati28800->get_korean_font_base & 0x7F) < 0x7F)
temp = fontdatksc5601_user[(ati28800->get_korean_font_kind & 4) * 24 + (ati28800->get_korean_font_base & 0x7F) - 0x20].chr[ati28800->get_korean_font_index];
else
temp = 0xFF;
ati28800->get_korean_font_index++;
break;
default:
break;
}
get_korean_font_index &= 0x1F;
ati28800->get_korean_font_index &= 0x1F;
}
break;
default:
@@ -378,9 +393,11 @@ static void ati28800_recalctimings(svga_t *svga)
void ati28800k_recalctimings(svga_t *svga)
{
ati28800_t *ati28800 = (ati28800_t *) svga->p;
ati28800_recalctimings(svga);
if (svga->render == svga_render_text_80 && ksc5601_mode_enabled)
if (svga->render == svga_render_text_80 && ati28800->ksc5601_mode_enabled)
{
svga->render = svga_render_text_80_ksc5601;
}
@@ -392,15 +409,15 @@ ati28800k_init(const device_t *info)
ati28800_t *ati28800 = malloc(sizeof(ati28800_t));
memset(ati28800, 0, sizeof(ati28800_t));
ati28800->memory = device_get_config_int("memory");
ati28800->memory = device_get_config_int("memory");
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;
ksc5601_mode_enabled = 0;
ati28800->port_03dd_val = 0;
ati28800->get_korean_font_base = 0;
ati28800->get_korean_font_index = 0;
ati28800->get_korean_font_enabled = 0;
ati28800->get_korean_font_kind = 0;
ati28800->in_get_korean_font_kind_set = 0;
ati28800->ksc5601_mode_enabled = 0;
rom_init(&ati28800->bios_rom, BIOS_ATIKOR_PATH, 0xc0000, 0x8000, 0x7fff, 0, MEM_MAPPING_EXTERNAL);
loadfont(FONT_ATIKOR_PATH, 6);
@@ -428,7 +445,7 @@ ati28800_init(const device_t *info)
ati = malloc(sizeof(ati28800_t));
memset(ati, 0x00, sizeof(ati28800_t));
ati->memory = device_get_config_int("memory");
ati->memory = device_get_config_int("memory");
switch(info->local) {
case GFX_VGAWONDERXL:
@@ -543,7 +560,7 @@ void ati28800k_add_status_info(char *s, int max_len, void *p)
svga_add_status_info(s, max_len, &ati28800->svga);
sprintf(temps, "Korean SVGA mode enabled : %s\n\n", ksc5601_mode_enabled ? "Yes" : "No");
sprintf(temps, "Korean SVGA mode enabled : %s\n\n", ati28800->ksc5601_mode_enabled ? "Yes" : "No");
strncat(s, temps, max_len);
}

View File

@@ -8,7 +8,7 @@
*
* SVGA renderers.
*
* Version: @(#)vid_svga_render.c 1.0.9 2018/03/15
* Version: @(#)vid_svga_render.c 1.0.10 2018/03/19
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -311,7 +311,10 @@ void svga_render_text_80_ksc5601(svga_t *svga)
if(x + xinc < svga->hdisp && (chr & nextchr & 0x80))
{
dat = fontdatksc5601[((chr & 0x7F) << 7) | (nextchr & 0x7F)].chr[svga->sc];
if((chr == 0xc9 || chr == 0xfe) && (nextchr > 0xa0 && nextchr < 0xff))
dat = fontdatksc5601_user[(chr == 0xfe ? 96 : 0) + (nextchr & 0x7F) - 0x20].chr[svga->sc];
else
dat = fontdatksc5601[((chr & 0x7F) << 7) | (nextchr & 0x7F)].chr[svga->sc];
}
else
{
@@ -358,7 +361,10 @@ void svga_render_text_80_ksc5601(svga_t *svga)
}
}
dat = fontdatksc5601[((chr & 0x7F) << 7) | (nextchr & 0x7F)].chr[svga->sc + 16];
if((chr == 0xc9 || chr == 0xfe) && (nextchr > 0xa0 && nextchr < 0xff))
dat = fontdatksc5601_user[(chr == 0xfe ? 96 : 0) + (nextchr & 0x7F) - 0x20].chr[svga->sc + 16];
else
dat = fontdatksc5601[((chr & 0x7F) << 7) | (nextchr & 0x7F)].chr[svga->sc + 16];
if (svga->seqregs[1] & 1)
{
for (xx = 0; xx < 8; xx++)

View File

@@ -40,7 +40,7 @@
* W = 3 bus clocks
* L = 4 bus clocks
*
* Version: @(#)video.c 1.0.20 2018/03/18
* Version: @(#)video.c 1.0.21 2018/03/19
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -79,7 +79,8 @@ 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 */
dbcs_font_t *fontdatksc5601;; /* Korean KSC-5601 font */
dbcs_font_t *fontdatksc5601; /* Korean KSC-5601 font */
dbcs_font_t *fontdatksc5601_user; /* Korean KSC-5601 user defined font */
uint32_t pal_lookup[256];
int xsize = 1,
ysize = 1;
@@ -661,6 +662,11 @@ video_close(void)
free(fontdatksc5601);
fontdatksc5601 = NULL;
}
if (fontdatksc5601_user) {
free(fontdatksc5601_user);
fontdatksc5601_user = NULL;
}
}
@@ -773,12 +779,13 @@ loadfont(wchar_t *s, int format)
if (!fontdatksc5601)
fontdatksc5601 = malloc(16384 * sizeof(dbcs_font_t));
for (c=0;c<16384;c++)
if (!fontdatksc5601_user)
fontdatksc5601_user = malloc(192 * sizeof(dbcs_font_t));
for (c = 0; c < 16384; c++)
{
for (d=0;d<32;d++)
{
for (d = 0; d < 32; d++)
fontdatksc5601[c].chr[d]=getc(f);
}
}
break;
}

View File

@@ -8,7 +8,7 @@
*
* Definitions for the video controller module.
*
* Version: @(#)video.h 1.0.24 2018/03/18
* Version: @(#)video.h 1.0.24 2018/03/19
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -176,6 +176,7 @@ extern int fullchange;
extern uint8_t fontdat[2048][8];
extern uint8_t fontdatm[2048][16];
extern dbcs_font_t *fontdatksc5601;
extern dbcs_font_t *fontdatksc5601_user;
extern uint32_t *video_6to8,
*video_15to32,
*video_16to32;