This patch implements user-defined character handling on ATI Korean VGA. Patch from Greatpsycho.

This commit is contained in:
SarahW 2018-03-20 18:04:37 +00:00
commit 2e90e5fd4c
4 changed files with 41 additions and 17 deletions

View file

@ -140,19 +140,31 @@ void ati28800k_out(uint16_t addr, uint8_t val, void *p)
case 0x3DE:
// pclog("ati28800k_out : set port 03DE to %02X at %04X:%04X\n", val, CS, cpu_state.oldpc);
ati28800->in_get_korean_font_kind_set = 0;
switch (ati28800->port_03dd_val)
if(ati28800->get_korean_font_enabled && (ati28800->regs[0xBF] & 0x20))
{
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;
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][ati28800->get_korean_font_index] = val;
ati28800->get_korean_font_index++;
ati28800->get_korean_font_index &= 0x1F;
}
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;
default:
break;
}
}
break;
default:
@ -232,8 +244,12 @@ uint8_t ati28800k_in(uint16_t addr, void *p)
case 4: /* ROM font */
temp = fontdatksc5601[ati28800->get_korean_font_base][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][ati28800->get_korean_font_index];
else
temp = 0xFF;
ati28800->get_korean_font_index++;
break;
default:
break;
@ -411,7 +427,7 @@ void ati28800k_add_status_info(char *s, int max_len, void *p)
ati28800_t *ati28800 = (ati28800_t *)p;
char temps[128];
svga_add_status_info(s, max_len, &ati28800->svga);
ati28800_add_status_info(s, max_len, p);
sprintf(temps, "Korean SVGA mode enabled : %s\n\n", ati28800->ksc5601_mode_enabled ? "Yes" : "No");
strncat(s, temps, max_len);

View file

@ -200,7 +200,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)][svga->sc];
if((chr == 0xc9 || chr == 0xfe) && (nextchr > 0xa0 && nextchr < 0xff))
dat = fontdatksc5601_user[(chr == 0xfe ? 96 : 0) + (nextchr & 0x7F) - 0x20][svga->sc];
else
dat = fontdatksc5601[((chr & 0x7F) << 7) | (nextchr & 0x7F)][svga->sc];
}
else
{
@ -247,7 +250,10 @@ void svga_render_text_80_ksc5601(svga_t *svga)
}
}
dat = fontdatksc5601[((chr & 0x7F) << 7) | (nextchr & 0x7F)][svga->sc + 16];
if((chr == 0xc9 || chr == 0xfe) && (nextchr > 0xa0 && nextchr < 0xff))
dat = fontdatksc5601_user[(chr == 0xfe ? 96 : 0) + (nextchr & 0x7F) - 0x20][svga->sc + 16];
else
dat = fontdatksc5601[((chr & 0x7F) << 7) | (nextchr & 0x7F)][svga->sc + 16];
if (svga->seqregs[1] & 1)
{
for (xx = 0; xx < 8; xx++)

View file

@ -746,6 +746,7 @@ uint8_t fontdatm[2048][16];
uint8_t fontdatw[512][32]; /* Wyse700 font */
uint8_t fontdat8x12[256][16]; /* MDSI Genius font */
uint8_t fontdatksc5601[16384][32]; /* Korean KSC-5601 font */
uint8_t fontdatksc5601_user[192][32]; /* Korean KSC-5601 user defined font */
int xsize=1,ysize=1;

View file

@ -54,6 +54,7 @@ extern int changeframecount;
extern uint8_t fontdat[2048][8];
extern uint8_t fontdatm[2048][16];
extern uint8_t fontdatksc5601[16384][32];
extern uint8_t fontdatksc5601_user[192][32];
extern uint32_t *video_15to32, *video_16to32;