Skip to content

Commit

Permalink
Further revisions to MFX emulation
Browse files Browse the repository at this point in the history
  • Loading branch information
Memotech-Bill committed Nov 23, 2023
1 parent fb2305c commit e968006
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 20 deletions.
6 changes: 6 additions & 0 deletions src/memu/memu.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ void usage(const char *psErr, ...)
#endif
#ifdef HAVE_MFX
fprintf(stderr, " -mfx emulate MFX video\n");
fprintf(stderr, " -mfx-max emulate MFX video with maximum window size\n");
#endif
fprintf(stderr, " -kbd-remap remaps MTX keyboard (despite shift state)\n");
fprintf(stderr, " -kbd-country n sets the country code switches to n (default 0)\n");
Expand Down Expand Up @@ -2304,6 +2305,11 @@ byte InZ80(word port)
#endif
return mon_in38();
case 0x39:
#ifdef HAVE_MFX
if ( cfg.mfx_emu )
return mfx_in (port);
else
#endif
return mon_in39();
#ifdef HAVE_MFX
case 0x3A:
Expand Down
31 changes: 11 additions & 20 deletions src/memu/vdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,12 +360,12 @@ static void vdp_refresh_graphics2 (VDP *vdp)
/*...svgavdp_refresh_text:0:*/
static void vdp_refresh_text_pat (VDP *vdp,
byte pat,
word patgen,
byte col,
byte *d
)
{
word patgen = ( ((word)(vdp->regs[4]&0x07)) << 11 );
word genptr = patgen + pat*8;
byte col = vdp->regs[7];
byte fg = (col>>4);
byte bg = (col&15);
int x, y;
Expand All @@ -378,35 +378,25 @@ static void vdp_refresh_text_pat (VDP *vdp,
}
}

static void vdp_refresh_text_third (VDP *vdp,
word patnam,
word patgen,
byte *d
)
static void vdp_refresh_text (VDP *vdp)
{
word colptr = ((word)(vdp->regs[3] & 0xF0)) << 6;
byte col = vdp->regs[7];
word patnam = ( ((word)(vdp->regs[2]&0x0f)) << 10 );
byte *d = vdp->pix + VDP_WIDTH*VBORDER + HBORDER240;
int x, y;
for ( y = 0; y < 8; y++ )
for ( y = 0; y < 24; y++ )
{
for ( x = 0; x < 40; x++ )
{
if (vdp->regs[1] & 0x08) col = vdp->ram[colptr++];
byte pat = ((byte *)vdp->ram)[patnam++];
vdp_refresh_text_pat (vdp, pat, patgen, d);
vdp_refresh_text_pat (vdp, pat, col, d);
d += 6;
}
d += ( -40*6 + VDP_WIDTH*8 );
}
}

static void vdp_refresh_text (VDP *vdp)
{
word patnam = ( ((word)(vdp->regs[2]&0x0f)) << 10 );
word patgen = ( ((word)(vdp->regs[4]&0x07)) << 11 );
byte *d = vdp->pix + VDP_WIDTH*VBORDER + HBORDER240;

vdp_refresh_text_third (vdp, patnam , patgen, d );
vdp_refresh_text_third (vdp, patnam+ 8*40, patgen, d+VDP_WIDTH* 8*8);
vdp_refresh_text_third (vdp, patnam+16*40, patgen, d+VDP_WIDTH*16*8);
}
/*...e*/
/*...svgavdp_refresh:0:*/
#define MODE(m1,m2,m3) ( ((m1)<<2) | ((m2)<<1) | (m3) )
Expand Down Expand Up @@ -440,6 +430,7 @@ void vdp_refresh (VDP *vdp)
vdp_refresh_blank (vdp);
break;
case MODE(1,0,0):
case MODE(1,1,0):
vdp_refresh_text (vdp);
break;
default:
Expand Down

0 comments on commit e968006

Please sign in to comment.