v9938.c: Removed set_resolution() method, simplifying the code a bit. All drivers were defaulting to the 'HIGH' setting anyway. This also puts the drivers back in charge of setting the screen parameters. (nw)

This commit is contained in:
Wilbert Pol 2015-07-17 21:10:47 +02:00
parent 4b9d68194f
commit edc09b4f48
9 changed files with 216 additions and 528 deletions

View File

@ -37,8 +37,13 @@ enum
V9938_MODE_UNKNOWN V9938_MODE_UNKNOWN
}; };
#define MODEL_V9938 (0)
#define MODEL_V9958 (1)
#define EXPMEM_OFFSET 0x20000 #define EXPMEM_OFFSET 0x20000
#define LONG_WIDTH (512 + 32)
static const char *const v9938_modes[] = { static const char *const v9938_modes[] = {
"TEXT 1", "MULTICOLOR", "GRAPHIC 1", "GRAPHIC 2", "GRAPHIC 3", "TEXT 1", "MULTICOLOR", "GRAPHIC 1", "GRAPHIC 2", "GRAPHIC 3",
"GRAPHIC 4", "GRAPHIC 5", "GRAPHIC 6", "GRAPHIC 7", "TEXT 2", "GRAPHIC 4", "GRAPHIC 5", "GRAPHIC 6", "GRAPHIC 7", "TEXT 2",
@ -86,10 +91,6 @@ v99x8_device::v99x8_device(const machine_config &mconfig, device_type type, cons
m_scanline(0), m_scanline(0),
m_blink(0), m_blink(0),
m_blink_count(0), m_blink_count(0),
m_size(0),
m_size_old(0),
m_size_auto(0),
m_size_now(0),
m_mx_delta(0), m_mx_delta(0),
m_my_delta(0), m_my_delta(0),
m_button_state(0), m_button_state(0),
@ -166,19 +167,6 @@ int v99x8_device::interrupt ()
return m_int_state; return m_int_state;
} }
void v99x8_device::set_resolution (int i)
{
if (i == RENDER_AUTO)
{
m_size_auto = 1;
}
else
{
m_size = i;
m_size_auto = 0;
}
}
/* /*
Not really right... won't work with sprites in graphics 7 Not really right... won't work with sprites in graphics 7
and with palette updated mid-screen and with palette updated mid-screen
@ -569,7 +557,6 @@ void v99x8_device::device_start()
m_vdp_engine = NULL; m_vdp_engine = NULL;
m_screen->register_screen_bitmap(m_bitmap); m_screen->register_screen_bitmap(m_bitmap);
m_size_old = -1;
// Video RAM is allocated as an own address space // Video RAM is allocated as an own address space
m_vram_space = &space(AS_DATA); m_vram_space = &space(AS_DATA);
@ -602,10 +589,6 @@ void v99x8_device::device_start()
save_item(NAME(m_scanline)); save_item(NAME(m_scanline));
save_item(NAME(m_blink)); save_item(NAME(m_blink));
save_item(NAME(m_blink_count)); save_item(NAME(m_blink_count));
save_item(NAME(m_size));
save_item(NAME(m_size_old));
save_item(NAME(m_size_auto));
save_item(NAME(m_size_now));
save_item(NAME(m_mx_delta)); save_item(NAME(m_mx_delta));
save_item(NAME(m_my_delta)); save_item(NAME(m_my_delta));
save_item(NAME(m_button_state)); save_item(NAME(m_button_state));
@ -876,67 +859,43 @@ inline bool v99x8_device::v9938_second_field()
return !(((m_cont_reg[9] & 0x04) && !(m_stat_reg[2] & 2)) || m_blink); return !(((m_cont_reg[9] & 0x04) && !(m_stat_reg[2] & 2)) || m_blink);
} }
/*
* This file is included for a number of different situations:
* _Width : can be 512 + 32 or 256 + 16
* V9938_BPP : can be 8 or 16
*/
void v99x8_device::default_border(const pen_t *pens, UINT16 *ln)
template<typename _PixelType, int _Width>
void v99x8_device::default_border(const pen_t *pens, _PixelType *ln)
{ {
_PixelType pen; UINT16 pen;
int i; int i;
pen = pens[m_pal_ind16[(m_cont_reg[7]&0x0f)]]; pen = pens[m_pal_ind16[(m_cont_reg[7]&0x0f)]];
i = _Width; i = LONG_WIDTH;
while (i--) *ln++ = pen; while (i--) *ln++ = pen;
if (m_size_now != RENDER_HIGH) m_size_now = RENDER_LOW;
} }
template<typename _PixelType, int _Width> void v99x8_device::graphic7_border(const pen_t *pens, UINT16 *ln)
void v99x8_device::graphic7_border(const pen_t *pens, _PixelType *ln)
{ {
_PixelType pen; UINT16 pen;
int i; int i;
pen = pens[m_pal_ind256[m_cont_reg[7]]]; pen = pens[m_pal_ind256[m_cont_reg[7]]];
i = _Width; i = LONG_WIDTH;
while (i--) *ln++ = pen; while (i--) *ln++ = pen;
if (m_size_now != RENDER_HIGH) m_size_now = RENDER_LOW;
} }
template<typename _PixelType, int _Width> void v99x8_device::graphic5_border(const pen_t *pens, UINT16 *ln)
void v99x8_device::graphic5_border(const pen_t *pens, _PixelType *ln)
{ {
int i; int i;
_PixelType pen0; UINT16 pen0;
if (_Width > 512) UINT16 pen1;
{
_PixelType pen1;
pen1 = pens[m_pal_ind16[(m_cont_reg[7]&0x03)]]; pen1 = pens[m_pal_ind16[(m_cont_reg[7]&0x03)]];
pen0 = pens[m_pal_ind16[((m_cont_reg[7]>>2)&0x03)]]; pen0 = pens[m_pal_ind16[((m_cont_reg[7]>>2)&0x03)]];
i = (_Width) / 2; i = LONG_WIDTH / 2;
while (i--) { *ln++ = pen0; *ln++ = pen1; } while (i--) { *ln++ = pen0; *ln++ = pen1; }
} }
else
{
pen0 = pens[m_pal_ind16[((m_cont_reg[7]>>2)&0x03)]];
i = _Width;
while (i--) *ln++ = pen0;
}
m_size_now = RENDER_HIGH;
}
template<typename _PixelType, int _Width> void v99x8_device::mode_text1(const pen_t *pens, UINT16 *ln, int line)
void v99x8_device::mode_text1(const pen_t *pens, _PixelType *ln, int line)
{ {
int pattern, x, xx, name, xxx; int pattern, x, xx, name, xxx;
_PixelType fg, bg, pen; UINT16 fg, bg, pen;
int nametbl_addr, patterntbl_addr; int nametbl_addr, patterntbl_addr;
patterntbl_addr = m_cont_reg[4] << 11; patterntbl_addr = m_cont_reg[4] << 11;
@ -949,9 +908,7 @@ void v99x8_device::mode_text1(const pen_t *pens, _PixelType *ln, int line)
pen = pens[m_pal_ind16[(m_cont_reg[7]&0x0f)]]; pen = pens[m_pal_ind16[(m_cont_reg[7]&0x0f)]];
xxx = m_offset_x + 8; xxx = (m_offset_x + 8) * 2;
if (_Width > 512)
xxx *= 2;
while (xxx--) *ln++ = pen; while (xxx--) *ln++ = pen;
for (x=0;x<40;x++) for (x=0;x<40;x++)
@ -961,7 +918,6 @@ void v99x8_device::mode_text1(const pen_t *pens, _PixelType *ln, int line)
for (xx=0;xx<6;xx++) for (xx=0;xx<6;xx++)
{ {
*ln++ = (pattern & 0x80) ? fg : bg; *ln++ = (pattern & 0x80) ? fg : bg;
if (_Width > 512)
*ln++ = (pattern & 0x80) ? fg : bg; *ln++ = (pattern & 0x80) ? fg : bg;
pattern <<= 1; pattern <<= 1;
} }
@ -969,18 +925,14 @@ void v99x8_device::mode_text1(const pen_t *pens, _PixelType *ln, int line)
name = (name + 1) & 0x3ff; name = (name + 1) & 0x3ff;
} }
xxx = (16 - m_offset_x) + 8; xxx = ((16 - m_offset_x) + 8) * 2;
if (_Width > 512)
xxx *= 2;
while (xxx--) *ln++ = pen; while (xxx--) *ln++ = pen;
if (m_size_now != RENDER_HIGH) m_size_now = RENDER_LOW;
} }
template<typename _PixelType, int _Width> void v99x8_device::mode_text2(const pen_t *pens, UINT16 *ln, int line)
void v99x8_device::mode_text2(const pen_t *pens, _PixelType *ln, int line)
{ {
int pattern, x, charcode, name, xxx, patternmask, colourmask; int pattern, x, charcode, name, xxx, patternmask, colourmask;
_PixelType fg, bg, fg0, bg0, pen; UINT16 fg, bg, fg0, bg0, pen;
int nametbl_addr, patterntbl_addr, colourtbl_addr; int nametbl_addr, patterntbl_addr, colourtbl_addr;
patterntbl_addr = m_cont_reg[4] << 11; patterntbl_addr = m_cont_reg[4] << 11;
@ -1000,10 +952,8 @@ void v99x8_device::mode_text2(const pen_t *pens, _PixelType *ln, int line)
name = (line/8)*80; name = (line/8)*80;
xxx = m_offset_x + 8; xxx = (m_offset_x + 8) * 2;
pen = pens[m_pal_ind16[(m_cont_reg[7]&0x0f)]]; pen = pens[m_pal_ind16[(m_cont_reg[7]&0x0f)]];
if (_Width > 512)
xxx *= 2;
while (xxx--) *ln++ = pen; while (xxx--) *ln++ = pen;
for (x=0;x<80;x++) for (x=0;x<80;x++)
@ -1017,21 +967,12 @@ void v99x8_device::mode_text2(const pen_t *pens, _PixelType *ln, int line)
pattern = m_vram_space->read_byte(patterntbl_addr + ((charcode * 8) + pattern = m_vram_space->read_byte(patterntbl_addr + ((charcode * 8) +
((line + m_cont_reg[23]) & 7))); ((line + m_cont_reg[23]) & 7)));
if (_Width > 512)
{
*ln++ = (pattern & 0x80) ? fg0 : bg0; *ln++ = (pattern & 0x80) ? fg0 : bg0;
*ln++ = (pattern & 0x40) ? fg0 : bg0; *ln++ = (pattern & 0x40) ? fg0 : bg0;
*ln++ = (pattern & 0x20) ? fg0 : bg0; *ln++ = (pattern & 0x20) ? fg0 : bg0;
*ln++ = (pattern & 0x10) ? fg0 : bg0; *ln++ = (pattern & 0x10) ? fg0 : bg0;
*ln++ = (pattern & 0x08) ? fg0 : bg0; *ln++ = (pattern & 0x08) ? fg0 : bg0;
*ln++ = (pattern & 0x04) ? fg0 : bg0; *ln++ = (pattern & 0x04) ? fg0 : bg0;
}
else
{
*ln++ = (pattern & 0x80) ? fg0 : bg0;
*ln++ = (pattern & 0x20) ? fg0 : bg0;
*ln++ = (pattern & 0x08) ? fg0 : bg0;
}
name++; name++;
continue; continue;
@ -1041,38 +982,25 @@ void v99x8_device::mode_text2(const pen_t *pens, _PixelType *ln, int line)
pattern = m_vram_space->read_byte(patterntbl_addr + ((charcode * 8) + pattern = m_vram_space->read_byte(patterntbl_addr + ((charcode * 8) +
((line + m_cont_reg[23]) & 7))); ((line + m_cont_reg[23]) & 7)));
if (_Width > 512)
{
*ln++ = (pattern & 0x80) ? fg : bg; *ln++ = (pattern & 0x80) ? fg : bg;
*ln++ = (pattern & 0x40) ? fg : bg; *ln++ = (pattern & 0x40) ? fg : bg;
*ln++ = (pattern & 0x20) ? fg : bg; *ln++ = (pattern & 0x20) ? fg : bg;
*ln++ = (pattern & 0x10) ? fg : bg; *ln++ = (pattern & 0x10) ? fg : bg;
*ln++ = (pattern & 0x08) ? fg : bg; *ln++ = (pattern & 0x08) ? fg : bg;
*ln++ = (pattern & 0x04) ? fg : bg; *ln++ = (pattern & 0x04) ? fg : bg;
}
else
{
*ln++ = (pattern & 0x80) ? fg : bg;
*ln++ = (pattern & 0x20) ? fg : bg;
*ln++ = (pattern & 0x08) ? fg : bg;
}
name++; name++;
} }
xxx = 16 - m_offset_x + 8; xxx = (16 - m_offset_x + 8) * 2;
if (_Width > 512)
xxx *= 2;
while (xxx--) *ln++ = pen; while (xxx--) *ln++ = pen;
m_size_now = RENDER_HIGH;
} }
template<typename _PixelType, int _Width> void v99x8_device::mode_multi(const pen_t *pens, UINT16 *ln, int line)
void v99x8_device::mode_multi(const pen_t *pens, _PixelType *ln, int line)
{ {
int nametbl_addr, patterntbl_addr, colour; int nametbl_addr, patterntbl_addr, colour;
int name, line2, x, xx; int name, line2, x, xx;
_PixelType pen, pen_bg; UINT16 pen, pen_bg;
nametbl_addr = (m_cont_reg[2] << 10); nametbl_addr = (m_cont_reg[2] << 10);
patterntbl_addr = (m_cont_reg[4] << 11); patterntbl_addr = (m_cont_reg[4] << 11);
@ -1081,9 +1009,6 @@ void v99x8_device::mode_multi(const pen_t *pens, _PixelType *ln, int line)
name = (line2/8)*32; name = (line2/8)*32;
pen_bg = pens[m_pal_ind16[(m_cont_reg[7]&0x0f)]]; pen_bg = pens[m_pal_ind16[(m_cont_reg[7]&0x0f)]];
if (_Width < 512)
xx = m_offset_x;
else
xx = m_offset_x * 2; xx = m_offset_x * 2;
while (xx--) *ln++ = pen_bg; while (xx--) *ln++ = pen_bg;
@ -1096,40 +1021,30 @@ void v99x8_device::mode_multi(const pen_t *pens, _PixelType *ln, int line)
*ln++ = pen; *ln++ = pen;
*ln++ = pen; *ln++ = pen;
*ln++ = pen; *ln++ = pen;
if (_Width > 512)
{
*ln++ = pen; *ln++ = pen;
*ln++ = pen; *ln++ = pen;
*ln++ = pen; *ln++ = pen;
*ln++ = pen; *ln++ = pen;
}
pen = pens[m_pal_ind16[colour&15]]; pen = pens[m_pal_ind16[colour&15]];
/* eight pixels */ /* eight pixels */
*ln++ = pen; *ln++ = pen;
*ln++ = pen; *ln++ = pen;
*ln++ = pen; *ln++ = pen;
*ln++ = pen; *ln++ = pen;
if (_Width > 512)
{
*ln++ = pen; *ln++ = pen;
*ln++ = pen; *ln++ = pen;
*ln++ = pen; *ln++ = pen;
*ln++ = pen; *ln++ = pen;
}
name++; name++;
} }
xx = 16 - m_offset_x; xx = (16 - m_offset_x) * 2;
if (_Width > 512)
xx *= 2;
while (xx--) *ln++ = pen_bg; while (xx--) *ln++ = pen_bg;
if (m_size_now != RENDER_HIGH) m_size_now = RENDER_LOW;
} }
template<typename _PixelType, int _Width> void v99x8_device::mode_graphic1(const pen_t *pens, UINT16 *ln, int line)
void v99x8_device::mode_graphic1(const pen_t *pens, _PixelType *ln, int line)
{ {
_PixelType fg, bg, pen; UINT16 fg, bg, pen;
int nametbl_addr, patterntbl_addr, colourtbl_addr; int nametbl_addr, patterntbl_addr, colourtbl_addr;
int pattern, x, xx, line2, name, charcode, colour, xxx; int pattern, x, xx, line2, name, charcode, colour, xxx;
@ -1142,9 +1057,6 @@ void v99x8_device::mode_graphic1(const pen_t *pens, _PixelType *ln, int line)
name = (line2/8)*32; name = (line2/8)*32;
pen = pens[m_pal_ind16[(m_cont_reg[7]&0x0f)]]; pen = pens[m_pal_ind16[(m_cont_reg[7]&0x0f)]];
if (_Width < 512)
xxx = m_offset_x;
else
xxx = m_offset_x * 2; xxx = m_offset_x * 2;
while (xxx--) *ln++ = pen; while (xxx--) *ln++ = pen;
@ -1159,24 +1071,19 @@ void v99x8_device::mode_graphic1(const pen_t *pens, _PixelType *ln, int line)
for (xx=0;xx<8;xx++) for (xx=0;xx<8;xx++)
{ {
*ln++ = (pattern & 0x80) ? fg : bg; *ln++ = (pattern & 0x80) ? fg : bg;
if (_Width > 512)
*ln++ = (pattern & 0x80) ? fg : bg; *ln++ = (pattern & 0x80) ? fg : bg;
pattern <<= 1; pattern <<= 1;
} }
name++; name++;
} }
xx = 16 - m_offset_x; xx = (16 - m_offset_x) * 2;
if (_Width > 512)
xx *= 2;
while (xx--) *ln++ = pen; while (xx--) *ln++ = pen;
if (m_size_now != RENDER_HIGH) m_size_now = RENDER_LOW;
} }
template<typename _PixelType, int _Width> void v99x8_device::mode_graphic23(const pen_t *pens, UINT16 *ln, int line)
void v99x8_device::mode_graphic23(const pen_t *pens, _PixelType *ln, int line)
{ {
_PixelType fg, bg, pen; UINT16 fg, bg, pen;
int nametbl_addr, patterntbl_addr, colourtbl_addr; int nametbl_addr, patterntbl_addr, colourtbl_addr;
int pattern, x, xx, line2, name, charcode, int pattern, x, xx, line2, name, charcode,
colour, colourmask, patternmask, xxx; colour, colourmask, patternmask, xxx;
@ -1192,9 +1099,6 @@ void v99x8_device::mode_graphic23(const pen_t *pens, _PixelType *ln, int line)
name = (line2/8)*32; name = (line2/8)*32;
pen = pens[m_pal_ind16[(m_cont_reg[7]&0x0f)]]; pen = pens[m_pal_ind16[(m_cont_reg[7]&0x0f)]];
if (_Width < 512)
xxx = m_offset_x;
else
xxx = m_offset_x * 2; xxx = m_offset_x * 2;
while (xxx--) *ln++ = pen; while (xxx--) *ln++ = pen;
@ -1208,26 +1112,21 @@ void v99x8_device::mode_graphic23(const pen_t *pens, _PixelType *ln, int line)
for (xx=0;xx<8;xx++) for (xx=0;xx<8;xx++)
{ {
*ln++ = (pattern & 0x80) ? fg : bg; *ln++ = (pattern & 0x80) ? fg : bg;
if (_Width > 512)
*ln++ = (pattern & 0x80) ? fg : bg; *ln++ = (pattern & 0x80) ? fg : bg;
pattern <<= 1; pattern <<= 1;
} }
name++; name++;
} }
xx = 16 - m_offset_x; xx = (16 - m_offset_x) * 2;
if (_Width > 512)
xx *= 2;
while (xx--) *ln++ = pen; while (xx--) *ln++ = pen;
if (m_size_now != RENDER_HIGH) m_size_now = RENDER_LOW;
} }
template<typename _PixelType, int _Width> void v99x8_device::mode_graphic4(const pen_t *pens, UINT16 *ln, int line)
void v99x8_device::mode_graphic4(const pen_t *pens, _PixelType *ln, int line)
{ {
int nametbl_addr, colour; int nametbl_addr, colour;
int line2, linemask, x, xx; int line2, linemask, x, xx;
_PixelType pen, pen_bg; UINT16 pen, pen_bg;
linemask = ((m_cont_reg[2] & 0x1f) << 3) | 7; linemask = ((m_cont_reg[2] & 0x1f) << 3) | 7;
@ -1238,9 +1137,6 @@ void v99x8_device::mode_graphic4(const pen_t *pens, _PixelType *ln, int line)
nametbl_addr += 0x8000; nametbl_addr += 0x8000;
pen_bg = pens[m_pal_ind16[(m_cont_reg[7]&0x0f)]]; pen_bg = pens[m_pal_ind16[(m_cont_reg[7]&0x0f)]];
if (_Width < 512)
xx = m_offset_x;
else
xx = m_offset_x * 2; xx = m_offset_x * 2;
while (xx--) *ln++ = pen_bg; while (xx--) *ln++ = pen_bg;
@ -1249,28 +1145,22 @@ void v99x8_device::mode_graphic4(const pen_t *pens, _PixelType *ln, int line)
colour = m_vram_space->read_byte(nametbl_addr++); colour = m_vram_space->read_byte(nametbl_addr++);
pen = pens[m_pal_ind16[colour>>4]]; pen = pens[m_pal_ind16[colour>>4]];
*ln++ = pen; *ln++ = pen;
if (_Width > 512)
*ln++ = pen; *ln++ = pen;
pen = pens[m_pal_ind16[colour&15]]; pen = pens[m_pal_ind16[colour&15]];
*ln++ = pen; *ln++ = pen;
if (_Width > 512)
*ln++ = pen; *ln++ = pen;
} }
xx = 16 - m_offset_x; xx = (16 - m_offset_x) * 2;
if (_Width > 512)
xx *= 2;
while (xx--) *ln++ = pen_bg; while (xx--) *ln++ = pen_bg;
if (m_size_now != RENDER_HIGH) m_size_now = RENDER_LOW;
} }
template<typename _PixelType, int _Width> void v99x8_device::mode_graphic5(const pen_t *pens, UINT16 *ln, int line)
void v99x8_device::mode_graphic5(const pen_t *pens, _PixelType *ln, int line)
{ {
int nametbl_addr, colour; int nametbl_addr, colour;
int line2, linemask, x, xx; int line2, linemask, x, xx;
_PixelType pen_bg0[4]; UINT16 pen_bg0[4];
_PixelType pen_bg1[4]; UINT16 pen_bg1[4];
linemask = ((m_cont_reg[2] & 0x1f) << 3) | 7; linemask = ((m_cont_reg[2] & 0x1f) << 3) | 7;
@ -1280,8 +1170,6 @@ void v99x8_device::mode_graphic5(const pen_t *pens, _PixelType *ln, int line)
if ( (m_cont_reg[2] & 0x20) && v9938_second_field() ) if ( (m_cont_reg[2] & 0x20) && v9938_second_field() )
nametbl_addr += 0x8000; nametbl_addr += 0x8000;
if (_Width > 512)
{
pen_bg1[0] = pens[m_pal_ind16[(m_cont_reg[7]&0x03)]]; pen_bg1[0] = pens[m_pal_ind16[(m_cont_reg[7]&0x03)]];
pen_bg0[0] = pens[m_pal_ind16[((m_cont_reg[7]>>2)&0x03)]]; pen_bg0[0] = pens[m_pal_ind16[((m_cont_reg[7]>>2)&0x03)]];
@ -1311,39 +1199,13 @@ void v99x8_device::mode_graphic5(const pen_t *pens, _PixelType *ln, int line)
xx = 16 - m_offset_x; xx = 16 - m_offset_x;
while (xx--) { *ln++ = pen_bg0[0]; *ln++ = pen_bg1[0]; } while (xx--) { *ln++ = pen_bg0[0]; *ln++ = pen_bg1[0]; }
} }
else
{
pen_bg0[0] = pens[m_pal_ind16[((m_cont_reg[7]>>2)&0x03)]];
x = (m_cont_reg[8] & 0x20) ? 0 : 1; void v99x8_device::mode_graphic6(const pen_t *pens, UINT16 *ln, int line)
for (;x<4;x++)
pen_bg0[x] = pens[m_pal_ind16[x]];
xx = m_offset_x;
while (xx--) *ln++ = pen_bg0[0];
for (x=0;x<128;x++)
{
colour = m_vram_space->read_byte(nametbl_addr++);
*ln++ = pen_bg0[colour>>6];
*ln++ = pen_bg0[(colour>>2)&3];
}
pen_bg0[0] = pens[m_pal_ind16[((m_cont_reg[7]>>2)&0x03)]];
xx = 16 - m_offset_x;
while (xx--) *ln++ = pen_bg0[0];
}
m_size_now = RENDER_HIGH;
}
template<typename _PixelType, int _Width>
void v99x8_device::mode_graphic6(const pen_t *pens, _PixelType *ln, int line)
{ {
UINT8 colour; UINT8 colour;
int line2, linemask, x, xx, nametbl_addr; int line2, linemask, x, xx, nametbl_addr;
_PixelType pen_bg, fg0; UINT16 pen_bg, fg0;
_PixelType fg1; UINT16 fg1;
linemask = ((m_cont_reg[2] & 0x1f) << 3) | 7; linemask = ((m_cont_reg[2] & 0x1f) << 3) | 7;
@ -1354,9 +1216,6 @@ void v99x8_device::mode_graphic6(const pen_t *pens, _PixelType *ln, int line)
nametbl_addr += 0x10000; nametbl_addr += 0x10000;
pen_bg = pens[m_pal_ind16[(m_cont_reg[7]&0x0f)]]; pen_bg = pens[m_pal_ind16[(m_cont_reg[7]&0x0f)]];
if (_Width < 512)
xx = m_offset_x;
else
xx = m_offset_x * 2; xx = m_offset_x * 2;
while (xx--) *ln++ = pen_bg; while (xx--) *ln++ = pen_bg;
@ -1367,21 +1226,11 @@ void v99x8_device::mode_graphic6(const pen_t *pens, _PixelType *ln, int line)
nametbl_addr++; nametbl_addr++;
colour = m_vram_space->read_byte(((nametbl_addr&1) << 16) | (nametbl_addr>>1)); colour = m_vram_space->read_byte(((nametbl_addr&1) << 16) | (nametbl_addr>>1));
fg0 = pens[m_pal_ind16[colour>>4]]; fg0 = pens[m_pal_ind16[colour>>4]];
if (_Width < 512)
{
*ln++ = fg0; *ln++ = fg0;
*ln++ = fg0; *ln++ = fg0;
*ln++ = fg0; *ln++ = fg0;
*ln++ = fg0; *ln++ = fg0;
}
else
{
fg1 = pens[m_pal_ind16[colour&15]]; fg1 = pens[m_pal_ind16[colour&15]];
*ln++ = fg0; *ln++ = fg1; *ln++ = fg0; *ln++ = fg1; *ln++ = fg0; *ln++ = fg1; *ln++ = fg0; *ln++ = fg1;
*ln++ = fg0; *ln++ = fg1; *ln++ = fg0; *ln++ = fg1; *ln++ = fg0; *ln++ = fg1; *ln++ = fg0; *ln++ = fg1;
*ln++ = fg0; *ln++ = fg1; *ln++ = fg0; *ln++ = fg1; *ln++ = fg0; *ln++ = fg1; *ln++ = fg0; *ln++ = fg1;
*ln++ = fg0; *ln++ = fg1; *ln++ = fg0; *ln++ = fg1; *ln++ = fg0; *ln++ = fg1; *ln++ = fg0; *ln++ = fg1;
}
nametbl_addr += 7; nametbl_addr += 7;
} }
} }
@ -1391,25 +1240,20 @@ void v99x8_device::mode_graphic6(const pen_t *pens, _PixelType *ln, int line)
{ {
colour = m_vram_space->read_byte(((nametbl_addr&1) << 16) | (nametbl_addr>>1)); colour = m_vram_space->read_byte(((nametbl_addr&1) << 16) | (nametbl_addr>>1));
*ln++ = pens[m_pal_ind16[colour>>4]]; *ln++ = pens[m_pal_ind16[colour>>4]];
if (_Width > 512)
*ln++ = pens[m_pal_ind16[colour&15]]; *ln++ = pens[m_pal_ind16[colour&15]];
nametbl_addr++; nametbl_addr++;
} }
} }
xx = 16 - m_offset_x; xx = (16 - m_offset_x) * 2;
if (_Width > 512)
xx *= 2;
while (xx--) *ln++ = pen_bg; while (xx--) *ln++ = pen_bg;
m_size_now = RENDER_HIGH;
} }
template<typename _PixelType, int _Width> void v99x8_device::mode_graphic7(const pen_t *pens, UINT16 *ln, int line)
void v99x8_device::mode_graphic7(const pen_t *pens, _PixelType *ln, int line)
{ {
UINT8 colour; UINT8 colour;
int line2, linemask, x, xx, nametbl_addr; int line2, linemask, x, xx, nametbl_addr;
_PixelType pen, pen_bg; UINT16 pen, pen_bg;
linemask = ((m_cont_reg[2] & 0x1f) << 3) | 7; linemask = ((m_cont_reg[2] & 0x1f) << 3) | 7;
@ -1420,9 +1264,6 @@ void v99x8_device::mode_graphic7(const pen_t *pens, _PixelType *ln, int line)
nametbl_addr += 0x10000; nametbl_addr += 0x10000;
pen_bg = pens[m_pal_ind256[m_cont_reg[7]]]; pen_bg = pens[m_pal_ind256[m_cont_reg[7]]];
if (_Width < 512)
xx = m_offset_x;
else
xx = m_offset_x * 2; xx = m_offset_x * 2;
while (xx--) *ln++ = pen_bg; while (xx--) *ln++ = pen_bg;
@ -1445,22 +1286,15 @@ void v99x8_device::mode_graphic7(const pen_t *pens, _PixelType *ln, int line)
(colour[2] & 7) << 5 | (colour[3] & 7) << 8; (colour[2] & 7) << 5 | (colour[3] & 7) << 8;
*ln++ = s_pal_indYJK[ind | ((colour[0] >> 3) & 31)]; *ln++ = s_pal_indYJK[ind | ((colour[0] >> 3) & 31)];
if (_Width > 512)
*ln++ = s_pal_indYJK[ind | ((colour[0] >> 3) & 31)]; *ln++ = s_pal_indYJK[ind | ((colour[0] >> 3) & 31)];
*ln++ = s_pal_indYJK[ind | ((colour[1] >> 3) & 31)]; *ln++ = s_pal_indYJK[ind | ((colour[1] >> 3) & 31)];
if (_Width > 512)
*ln++ = s_pal_indYJK[ind | ((colour[1] >> 3) & 31)]; *ln++ = s_pal_indYJK[ind | ((colour[1] >> 3) & 31)];
*ln++ = s_pal_indYJK[ind | ((colour[2] >> 3) & 31)]; *ln++ = s_pal_indYJK[ind | ((colour[2] >> 3) & 31)];
if (_Width > 512)
*ln++ = s_pal_indYJK[ind | ((colour[2] >> 3) & 31)]; *ln++ = s_pal_indYJK[ind | ((colour[2] >> 3) & 31)];
*ln++ = s_pal_indYJK[ind | ((colour[3] >> 3) & 31)]; *ln++ = s_pal_indYJK[ind | ((colour[3] >> 3) & 31)];
if (_Width > 512)
*ln++ = s_pal_indYJK[ind | ((colour[3] >> 3) & 31)]; *ln++ = s_pal_indYJK[ind | ((colour[3] >> 3) & 31)];
nametbl_addr++; nametbl_addr++;
@ -1485,22 +1319,15 @@ void v99x8_device::mode_graphic7(const pen_t *pens, _PixelType *ln, int line)
(colour[2] & 7) << 5 | (colour[3] & 7) << 8; (colour[2] & 7) << 5 | (colour[3] & 7) << 8;
*ln++ = colour[0] & 8 ? m_pal_ind16[colour[0] >> 4] : s_pal_indYJK[ind | ((colour[0] >> 3) & 30)]; *ln++ = colour[0] & 8 ? m_pal_ind16[colour[0] >> 4] : s_pal_indYJK[ind | ((colour[0] >> 3) & 30)];
if (_Width > 512)
*ln++ = colour[0] & 8 ? m_pal_ind16[colour[0] >> 4] : s_pal_indYJK[ind | ((colour[0] >> 3) & 30)]; *ln++ = colour[0] & 8 ? m_pal_ind16[colour[0] >> 4] : s_pal_indYJK[ind | ((colour[0] >> 3) & 30)];
*ln++ = colour[1] & 8 ? m_pal_ind16[colour[1] >> 4] : s_pal_indYJK[ind | ((colour[1] >> 3) & 30)]; *ln++ = colour[1] & 8 ? m_pal_ind16[colour[1] >> 4] : s_pal_indYJK[ind | ((colour[1] >> 3) & 30)];
if (_Width > 512)
*ln++ = colour[1] & 8 ? m_pal_ind16[colour[1] >> 4] : s_pal_indYJK[ind | ((colour[1] >> 3) & 30)]; *ln++ = colour[1] & 8 ? m_pal_ind16[colour[1] >> 4] : s_pal_indYJK[ind | ((colour[1] >> 3) & 30)];
*ln++ = colour[2] & 8 ? m_pal_ind16[colour[2] >> 4] : s_pal_indYJK[ind | ((colour[2] >> 3) & 30)]; *ln++ = colour[2] & 8 ? m_pal_ind16[colour[2] >> 4] : s_pal_indYJK[ind | ((colour[2] >> 3) & 30)];
if (_Width > 512)
*ln++ = colour[2] & 8 ? m_pal_ind16[colour[2] >> 4] : s_pal_indYJK[ind | ((colour[2] >> 3) & 30)]; *ln++ = colour[2] & 8 ? m_pal_ind16[colour[2] >> 4] : s_pal_indYJK[ind | ((colour[2] >> 3) & 30)];
*ln++ = colour[3] & 8 ? m_pal_ind16[colour[3] >> 4] : s_pal_indYJK[ind | ((colour[3] >> 3) & 30)]; *ln++ = colour[3] & 8 ? m_pal_ind16[colour[3] >> 4] : s_pal_indYJK[ind | ((colour[3] >> 3) & 30)];
if (_Width > 512)
*ln++ = colour[3] & 8 ? m_pal_ind16[colour[3] >> 4] : s_pal_indYJK[ind | ((colour[3] >> 3) & 30)]; *ln++ = colour[3] & 8 ? m_pal_ind16[colour[3] >> 4] : s_pal_indYJK[ind | ((colour[3] >> 3) & 30)];
nametbl_addr++; nametbl_addr++;
@ -1517,13 +1344,10 @@ void v99x8_device::mode_graphic7(const pen_t *pens, _PixelType *ln, int line)
*ln++ = pen; *ln++ = pen; *ln++ = pen; *ln++ = pen;
*ln++ = pen; *ln++ = pen; *ln++ = pen; *ln++ = pen;
*ln++ = pen; *ln++ = pen; *ln++ = pen; *ln++ = pen;
if (_Width > 512)
{
*ln++ = pen; *ln++ = pen; *ln++ = pen; *ln++ = pen;
*ln++ = pen; *ln++ = pen; *ln++ = pen; *ln++ = pen;
*ln++ = pen; *ln++ = pen; *ln++ = pen; *ln++ = pen;
*ln++ = pen; *ln++ = pen; *ln++ = pen; *ln++ = pen;
}
nametbl_addr++; nametbl_addr++;
} }
} }
@ -1534,41 +1358,23 @@ void v99x8_device::mode_graphic7(const pen_t *pens, _PixelType *ln, int line)
colour = m_vram_space->read_byte(((nametbl_addr&1) << 16) | (nametbl_addr>>1)); colour = m_vram_space->read_byte(((nametbl_addr&1) << 16) | (nametbl_addr>>1));
pen = pens[m_pal_ind256[colour]]; pen = pens[m_pal_ind256[colour]];
*ln++ = pen; *ln++ = pen;
if (_Width > 512)
*ln++ = pen; *ln++ = pen;
nametbl_addr++; nametbl_addr++;
} }
} }
xx = 16 - m_offset_x; xx = (16 - m_offset_x) * 2;
if (_Width > 512)
xx *= 2;
while (xx--) *ln++ = pen_bg; while (xx--) *ln++ = pen_bg;
if (m_size_now != RENDER_HIGH) m_size_now = RENDER_LOW;
} }
template<typename _PixelType, int _Width> void v99x8_device::mode_unknown(const pen_t *pens, UINT16 *ln, int line)
void v99x8_device::mode_unknown(const pen_t *pens, _PixelType *ln, int line)
{ {
_PixelType fg, bg; UINT16 fg, bg;
int x; int x;
fg = pens[m_pal_ind16[m_cont_reg[7] >> 4]]; fg = pens[m_pal_ind16[m_cont_reg[7] >> 4]];
bg = pens[m_pal_ind16[m_cont_reg[7] & 15]]; bg = pens[m_pal_ind16[m_cont_reg[7] & 15]];
if (_Width < 512)
{
x = m_offset_x;
while (x--) *ln++ = bg;
x = 256;
while (x--) *ln++ = fg;
x = 16 - m_offset_x;
while (x--) *ln++ = bg;
}
else
{
x = m_offset_x * 2; x = m_offset_x * 2;
while (x--) *ln++ = bg; while (x--) *ln++ = bg;
@ -1578,90 +1384,65 @@ void v99x8_device::mode_unknown(const pen_t *pens, _PixelType *ln, int line)
x = (16 - m_offset_x) * 2; x = (16 - m_offset_x) * 2;
while (x--) *ln++ = bg; while (x--) *ln++ = bg;
} }
if (m_size_now != RENDER_HIGH) m_size_now = RENDER_LOW;
}
template<typename _PixelType, int _Width> void v99x8_device::default_draw_sprite(const pen_t *pens, UINT16 *ln, UINT8 *col)
void v99x8_device::default_draw_sprite(const pen_t *pens, _PixelType *ln, UINT8 *col)
{ {
int i; int i;
if (_Width > 512)
ln += m_offset_x * 2; ln += m_offset_x * 2;
else
ln += m_offset_x;
for (i=0;i<256;i++) for (i=0;i<256;i++)
{ {
if (col[i] & 0x80) if (col[i] & 0x80)
{ {
*ln++ = pens[m_pal_ind16[col[i]&0x0f]]; *ln++ = pens[m_pal_ind16[col[i]&0x0f]];
if (_Width > 512)
*ln++ = pens[m_pal_ind16[col[i]&0x0f]]; *ln++ = pens[m_pal_ind16[col[i]&0x0f]];
} }
else else
{ {
if (_Width > 512)
ln += 2; ln += 2;
else
ln++;
} }
} }
} }
template<typename _PixelType, int _Width>
void v99x8_device::graphic5_draw_sprite(const pen_t *pens, _PixelType *ln, UINT8 *col) void v99x8_device::graphic5_draw_sprite(const pen_t *pens, UINT16 *ln, UINT8 *col)
{ {
int i; int i;
if (_Width > 512)
ln += m_offset_x * 2; ln += m_offset_x * 2;
else
ln += m_offset_x;
for (i=0;i<256;i++) for (i=0;i<256;i++)
{ {
if (col[i] & 0x80) if (col[i] & 0x80)
{ {
*ln++ = pens[m_pal_ind16[(col[i]>>2)&0x03]]; *ln++ = pens[m_pal_ind16[(col[i]>>2)&0x03]];
if (_Width > 512)
*ln++ = pens[m_pal_ind16[col[i]&0x03]]; *ln++ = pens[m_pal_ind16[col[i]&0x03]];
} }
else else
{ {
if (_Width > 512)
ln += 2; ln += 2;
else
ln++;
} }
} }
} }
template<typename _PixelType, int _Width> void v99x8_device::graphic7_draw_sprite(const pen_t *pens, UINT16 *ln, UINT8 *col)
void v99x8_device::graphic7_draw_sprite(const pen_t *pens, _PixelType *ln, UINT8 *col)
{ {
static const UINT16 g7_ind16[16] = { static const UINT16 g7_ind16[16] = {
0, 2, 192, 194, 48, 50, 240, 242, 0, 2, 192, 194, 48, 50, 240, 242,
482, 7, 448, 455, 56, 63, 504, 511 }; 482, 7, 448, 455, 56, 63, 504, 511 };
int i; int i;
if (_Width > 512)
ln += m_offset_x * 2; ln += m_offset_x * 2;
else
ln += m_offset_x;
for (i=0;i<256;i++) for (i=0;i<256;i++)
{ {
if (col[i] & 0x80) if (col[i] & 0x80)
{ {
*ln++ = pens[g7_ind16[col[i]&0x0f]]; *ln++ = pens[g7_ind16[col[i]&0x0f]];
if (_Width > 512)
*ln++ = pens[g7_ind16[col[i]&0x0f]]; *ln++ = pens[g7_ind16[col[i]&0x0f]];
} }
else else
{ {
if (_Width > 512)
ln += 2; ln += 2;
else
ln++;
} }
} }
} }
@ -1917,98 +1698,74 @@ void v99x8_device::sprite_mode2 (int line, UINT8 *col)
m_stat_reg[0] = (m_stat_reg[0] & 0xa0) | p; m_stat_reg[0] = (m_stat_reg[0] & 0xa0) | p;
} }
#define SHORT_WIDTH (256 + 16)
#define LONG_WIDTH (512 + 32)
const v99x8_device::v99x8_mode v99x8_device::s_modes[] = { const v99x8_device::v99x8_mode v99x8_device::s_modes[] = {
{ 0x02, { 0x02,
&v99x8_device::mode_text1<UINT16, LONG_WIDTH>, &v99x8_device::mode_text1,
&v99x8_device::mode_text1<UINT16, SHORT_WIDTH>, &v99x8_device::default_border,
&v99x8_device::default_border<UINT16, LONG_WIDTH>,
&v99x8_device::default_border<UINT16, SHORT_WIDTH>,
NULL, NULL,
NULL, NULL
NULL }, },
{ 0x01, { 0x01,
&v99x8_device::mode_multi<UINT16, LONG_WIDTH>, &v99x8_device::mode_multi,
&v99x8_device::mode_multi<UINT16, SHORT_WIDTH>, &v99x8_device::default_border,
&v99x8_device::default_border<UINT16, LONG_WIDTH>,
&v99x8_device::default_border<UINT16, SHORT_WIDTH>,
&v99x8_device::sprite_mode1, &v99x8_device::sprite_mode1,
&v99x8_device::default_draw_sprite<UINT16, LONG_WIDTH>, &v99x8_device::default_draw_sprite
&v99x8_device::default_draw_sprite<UINT16, SHORT_WIDTH> }, },
{ 0x00, { 0x00,
&v99x8_device::mode_graphic1<UINT16, LONG_WIDTH>, &v99x8_device::mode_graphic1,
&v99x8_device::mode_graphic1<UINT16, SHORT_WIDTH>, &v99x8_device::default_border,
&v99x8_device::default_border<UINT16, LONG_WIDTH>,
&v99x8_device::default_border<UINT16, SHORT_WIDTH>,
&v99x8_device::sprite_mode1, &v99x8_device::sprite_mode1,
&v99x8_device::default_draw_sprite<UINT16, LONG_WIDTH>, &v99x8_device::default_draw_sprite
&v99x8_device::default_draw_sprite<UINT16, SHORT_WIDTH> }, },
{ 0x04, { 0x04,
&v99x8_device::mode_graphic23<UINT16, LONG_WIDTH>, &v99x8_device::mode_graphic23,
&v99x8_device::mode_graphic23<UINT16, SHORT_WIDTH>, &v99x8_device::default_border,
&v99x8_device::default_border<UINT16, LONG_WIDTH>,
&v99x8_device::default_border<UINT16, SHORT_WIDTH>,
&v99x8_device::sprite_mode1, &v99x8_device::sprite_mode1,
&v99x8_device::default_draw_sprite<UINT16, LONG_WIDTH>, &v99x8_device::default_draw_sprite
&v99x8_device::default_draw_sprite<UINT16, SHORT_WIDTH> }, },
{ 0x08, { 0x08,
&v99x8_device::mode_graphic23<UINT16, LONG_WIDTH>, &v99x8_device::mode_graphic23,
&v99x8_device::mode_graphic23<UINT16, SHORT_WIDTH>, &v99x8_device::default_border,
&v99x8_device::default_border<UINT16, LONG_WIDTH>,
&v99x8_device::default_border<UINT16, SHORT_WIDTH>,
&v99x8_device::sprite_mode2, &v99x8_device::sprite_mode2,
&v99x8_device::default_draw_sprite<UINT16, LONG_WIDTH>, &v99x8_device::default_draw_sprite
&v99x8_device::default_draw_sprite<UINT16, SHORT_WIDTH> }, },
{ 0x0c, { 0x0c,
&v99x8_device::mode_graphic4<UINT16, LONG_WIDTH>, &v99x8_device::mode_graphic4,
&v99x8_device::mode_graphic4<UINT16, SHORT_WIDTH>, &v99x8_device::default_border,
&v99x8_device::default_border<UINT16, LONG_WIDTH>,
&v99x8_device::default_border<UINT16, SHORT_WIDTH>,
&v99x8_device::sprite_mode2, &v99x8_device::sprite_mode2,
&v99x8_device::default_draw_sprite<UINT16, LONG_WIDTH>, &v99x8_device::default_draw_sprite
&v99x8_device::default_draw_sprite<UINT16, SHORT_WIDTH> }, },
{ 0x10, { 0x10,
&v99x8_device::mode_graphic5<UINT16, LONG_WIDTH>, &v99x8_device::mode_graphic5,
&v99x8_device::mode_graphic5<UINT16, SHORT_WIDTH>, &v99x8_device::graphic5_border,
&v99x8_device::graphic5_border<UINT16, LONG_WIDTH>,
&v99x8_device::graphic5_border<UINT16, SHORT_WIDTH>,
&v99x8_device::sprite_mode2, &v99x8_device::sprite_mode2,
&v99x8_device::graphic5_draw_sprite<UINT16, LONG_WIDTH>, &v99x8_device::graphic5_draw_sprite
&v99x8_device::graphic5_draw_sprite<UINT16, SHORT_WIDTH> }, },
{ 0x14, { 0x14,
&v99x8_device::mode_graphic6<UINT16, LONG_WIDTH>, &v99x8_device::mode_graphic6,
&v99x8_device::mode_graphic6<UINT16, SHORT_WIDTH>, &v99x8_device::default_border,
&v99x8_device::default_border<UINT16, LONG_WIDTH>,
&v99x8_device::default_border<UINT16, SHORT_WIDTH>,
&v99x8_device::sprite_mode2, &v99x8_device::sprite_mode2,
&v99x8_device::default_draw_sprite<UINT16, LONG_WIDTH>, &v99x8_device::default_draw_sprite
&v99x8_device::default_draw_sprite<UINT16, SHORT_WIDTH> }, },
{ 0x1c, { 0x1c,
&v99x8_device::mode_graphic7<UINT16, LONG_WIDTH>, &v99x8_device::mode_graphic7,
&v99x8_device::mode_graphic7<UINT16, SHORT_WIDTH>, &v99x8_device::graphic7_border,
&v99x8_device::graphic7_border<UINT16, LONG_WIDTH>,
&v99x8_device::graphic7_border<UINT16, SHORT_WIDTH>,
&v99x8_device::sprite_mode2, &v99x8_device::sprite_mode2,
&v99x8_device::graphic7_draw_sprite<UINT16, LONG_WIDTH>, &v99x8_device::graphic7_draw_sprite
&v99x8_device::graphic7_draw_sprite<UINT16, SHORT_WIDTH> }, },
{ 0x0a, { 0x0a,
&v99x8_device::mode_text2<UINT16, LONG_WIDTH>, &v99x8_device::mode_text2,
&v99x8_device::mode_text2<UINT16, SHORT_WIDTH>, &v99x8_device::default_border,
&v99x8_device::default_border<UINT16, LONG_WIDTH>,
&v99x8_device::default_border<UINT16, SHORT_WIDTH>,
NULL, NULL,
NULL, NULL
NULL }, },
{ 0xff, { 0xff,
&v99x8_device::mode_unknown<UINT16, LONG_WIDTH>, &v99x8_device::mode_unknown,
&v99x8_device::mode_unknown<UINT16, SHORT_WIDTH>, &v99x8_device::default_border,
&v99x8_device::default_border<UINT16, LONG_WIDTH>,
&v99x8_device::default_border<UINT16, SHORT_WIDTH>,
NULL, NULL,
NULL, NULL
NULL }, }
}; };
void v99x8_device::set_mode() void v99x8_device::set_mode()
@ -2026,41 +1783,28 @@ void v99x8_device::set_mode()
void v99x8_device::refresh_16(int line) void v99x8_device::refresh_16(int line)
{ {
const pen_t *pens = m_palette->pens(); const pen_t *pens = m_palette->pens();
int i, double_lines; bool double_lines = false;
UINT8 col[256]; UINT8 col[256];
UINT16 *ln, *ln2 = NULL; UINT16 *ln, *ln2 = NULL;
double_lines = 0;
if (m_size == RENDER_HIGH)
{
if (m_cont_reg[9] & 0x08) if (m_cont_reg[9] & 0x08)
{ {
m_size_now = RENDER_HIGH;
ln = &m_bitmap.pix16(line*2+((m_stat_reg[2]>>1)&1)); ln = &m_bitmap.pix16(line*2+((m_stat_reg[2]>>1)&1));
} }
else else
{ {
ln = &m_bitmap.pix16(line*2); ln = &m_bitmap.pix16(line*2);
ln2 = &m_bitmap.pix16(line*2+1); ln2 = &m_bitmap.pix16(line*2+1);
double_lines = 1; double_lines = true;
} }
}
else
ln = &m_bitmap.pix16(line);
if ( !(m_cont_reg[1] & 0x40) || (m_stat_reg[2] & 0x40) ) if ( !(m_cont_reg[1] & 0x40) || (m_stat_reg[2] & 0x40) )
{ {
if (m_size == RENDER_HIGH)
(this->*s_modes[m_mode].border_16) (pens, ln); (this->*s_modes[m_mode].border_16) (pens, ln);
else
(this->*s_modes[m_mode].border_16s) (pens, ln);
} }
else else
{ {
i = (line - m_offset_y) & 255; int i = (line - m_offset_y) & 255;
if (m_size == RENDER_HIGH)
{
(this->*s_modes[m_mode].visible_16) (pens, ln, i); (this->*s_modes[m_mode].visible_16) (pens, ln, i);
if (s_modes[m_mode].sprites) if (s_modes[m_mode].sprites)
{ {
@ -2068,16 +1812,6 @@ void v99x8_device::refresh_16(int line)
(this->*s_modes[m_mode].draw_sprite_16) (pens, ln, col); (this->*s_modes[m_mode].draw_sprite_16) (pens, ln, col);
} }
} }
else
{
(this->*s_modes[m_mode].visible_16s) (pens, ln, i);
if (s_modes[m_mode].sprites)
{
(this->*s_modes[m_mode].sprites) (i, col);
(this->*s_modes[m_mode].draw_sprite_16s) (pens, ln, col);
}
}
}
if (double_lines) if (double_lines)
memcpy (ln2, ln, (512 + 32) * 2); memcpy (ln2, ln, (512 + 32) * 2);
@ -2241,22 +1975,6 @@ void v99x8_device::interrupt_start_vblank()
m_blink_count = (m_cont_reg[13] & 0x0f) * 10; m_blink_count = (m_cont_reg[13] & 0x0f) * 10;
} }
} }
// check screen rendering size
if (m_size_auto && (m_size_now >= 0) && (m_size != m_size_now) )
m_size = m_size_now;
if (m_size != m_size_old)
{
if (m_size == RENDER_HIGH)
m_screen->set_visible_area (0, 512 + 32 - 1, 0, 424 + 56 - 1);
else
m_screen->set_visible_area (0, 256 + 16 - 1, 0, 212 + 28 - 1);
m_size_old = m_size;
}
m_size_now = -1;
} }
/*************************************************************************** /***************************************************************************

View File

@ -29,16 +29,6 @@
#define MCFG_V99X8_INTERRUPT_CALLBACK(_irq) \ #define MCFG_V99X8_INTERRUPT_CALLBACK(_irq) \
downcast<v99x8_device *>(device)->set_interrupt_callback(DEVCB_##_irq); downcast<v99x8_device *>(device)->set_interrupt_callback(DEVCB_##_irq);
// init functions
#define MODEL_V9938 (0)
#define MODEL_V9958 (1)
// resolutions
#define RENDER_HIGH (0)
#define RENDER_LOW (1)
#define RENDER_AUTO (2)
//************************************************************************** //**************************************************************************
// GLOBAL VARIABLES // GLOBAL VARIABLES
@ -50,7 +40,6 @@ extern const device_type V9958;
//************************************************************************** //**************************************************************************
// TYPE DEFINITIONS // TYPE DEFINITIONS
//************************************************************************** //**************************************************************************
@ -70,7 +59,6 @@ public:
m_int_callback.set_callback(irq); m_int_callback.set_callback(irq);
} }
int interrupt (); int interrupt ();
void set_resolution (int);
int get_transpen(); int get_transpen();
bitmap_ind16 &get_bitmap() { return m_bitmap; } bitmap_ind16 &get_bitmap() { return m_bitmap; }
void update_mouse_state(int mx_delta, int my_delta, int button_state); void update_mouse_state(int mx_delta, int my_delta, int button_state);
@ -113,24 +101,24 @@ private:
void check_int(); void check_int();
void register_write(int reg, int data); void register_write(int reg, int data);
template<typename _PixelType, int _Width> void default_border(const pen_t *pens, _PixelType *ln); void default_border(const pen_t *pens, UINT16 *ln);
template<typename _PixelType, int _Width> void graphic7_border(const pen_t *pens, _PixelType *ln); void graphic7_border(const pen_t *pens, UINT16 *ln);
template<typename _PixelType, int _Width> void graphic5_border(const pen_t *pens, _PixelType *ln); void graphic5_border(const pen_t *pens, UINT16 *ln);
template<typename _PixelType, int _Width> void mode_text1(const pen_t *pens, _PixelType *ln, int line); void mode_text1(const pen_t *pens, UINT16 *ln, int line);
template<typename _PixelType, int _Width> void mode_text2(const pen_t *pens, _PixelType *ln, int line); void mode_text2(const pen_t *pens, UINT16 *ln, int line);
template<typename _PixelType, int _Width> void mode_multi(const pen_t *pens, _PixelType *ln, int line); void mode_multi(const pen_t *pens, UINT16 *ln, int line);
template<typename _PixelType, int _Width> void mode_graphic1(const pen_t *pens, _PixelType *ln, int line); void mode_graphic1(const pen_t *pens, UINT16 *ln, int line);
template<typename _PixelType, int _Width> void mode_graphic23(const pen_t *pens, _PixelType *ln, int line); void mode_graphic23(const pen_t *pens, UINT16 *ln, int line);
template<typename _PixelType, int _Width> void mode_graphic4(const pen_t *pens, _PixelType *ln, int line); void mode_graphic4(const pen_t *pens, UINT16 *ln, int line);
template<typename _PixelType, int _Width> void mode_graphic5(const pen_t *pens, _PixelType *ln, int line); void mode_graphic5(const pen_t *pens, UINT16 *ln, int line);
template<typename _PixelType, int _Width> void mode_graphic6(const pen_t *pens, _PixelType *ln, int line); void mode_graphic6(const pen_t *pens, UINT16 *ln, int line);
template<typename _PixelType, int _Width> void mode_graphic7(const pen_t *pens, _PixelType *ln, int line); void mode_graphic7(const pen_t *pens, UINT16 *ln, int line);
// template<typename _PixelType, int _Width> void mode_yae(const pen_t *pens, _PixelType *ln, int line); // template<typename _PixelType, int _Width> void mode_yae(const pen_t *pens, _PixelType *ln, int line);
// template<typename _PixelType, int _Width> void mode_yjk(const pen_t *pens, _PixelType *ln, int line); // template<typename _PixelType, int _Width> void mode_yjk(const pen_t *pens, _PixelType *ln, int line);
template<typename _PixelType, int _Width> void mode_unknown(const pen_t *pens, _PixelType *ln, int line); void mode_unknown(const pen_t *pens, UINT16 *ln, int line);
template<typename _PixelType, int _Width> void default_draw_sprite(const pen_t *pens, _PixelType *ln, UINT8 *col); void default_draw_sprite(const pen_t *pens, UINT16 *ln, UINT8 *col);
template<typename _PixelType, int _Width> void graphic5_draw_sprite(const pen_t *pens, _PixelType *ln, UINT8 *col); void graphic5_draw_sprite(const pen_t *pens, UINT16 *ln, UINT8 *col);
template<typename _PixelType, int _Width> void graphic7_draw_sprite(const pen_t *pens, _PixelType *ln, UINT8 *col); void graphic7_draw_sprite(const pen_t *pens, UINT16 *ln, UINT8 *col);
void sprite_mode1(int line, UINT8 *col); void sprite_mode1(int line, UINT8 *col);
void sprite_mode2(int line, UINT8 *col); void sprite_mode2(int line, UINT8 *col);
@ -197,8 +185,6 @@ private:
int m_scanline; int m_scanline;
// blinking // blinking
int m_blink, m_blink_count; int m_blink, m_blink_count;
// size
int m_size, m_size_old, m_size_auto, m_size_now;
// mouse // mouse
UINT8 m_mx_delta, m_my_delta; UINT8 m_mx_delta, m_my_delta;
// mouse & lightpen // mouse & lightpen
@ -228,12 +214,9 @@ private:
{ {
UINT8 m; UINT8 m;
void (v99x8_device::*visible_16)(const pen_t *, UINT16*, int); void (v99x8_device::*visible_16)(const pen_t *, UINT16*, int);
void (v99x8_device::*visible_16s)(const pen_t *, UINT16*, int);
void (v99x8_device::*border_16)(const pen_t *, UINT16*); void (v99x8_device::*border_16)(const pen_t *, UINT16*);
void (v99x8_device::*border_16s)(const pen_t *, UINT16*);
void (v99x8_device::*sprites)(int, UINT8*); void (v99x8_device::*sprites)(int, UINT8*);
void (v99x8_device::*draw_sprite_16)(const pen_t *, UINT16*, UINT8*); void (v99x8_device::*draw_sprite_16)(const pen_t *, UINT16*, UINT8*);
void (v99x8_device::*draw_sprite_16s)(const pen_t *, UINT16*, UINT8*);
} ; } ;
static const v99x8_mode s_modes[]; static const v99x8_mode s_modes[];
required_device<palette_device> m_palette; required_device<palette_device> m_palette;

View File

@ -443,7 +443,6 @@ TIMER_DEVICE_CALLBACK_MEMBER(csplayh5_state::csplayh5_irq)
if((scanline % 2) == 0) if((scanline % 2) == 0)
{ {
m_v9958->set_resolution(RENDER_HIGH);
m_v9958->interrupt(); m_v9958->interrupt();
} }
} }

View File

@ -266,7 +266,6 @@ WRITE_LINE_MEMBER(kurukuru_state::kurukuru_vdp_interrupt)
TIMER_DEVICE_CALLBACK_MEMBER(kurukuru_state::kurukuru_vdp_scanline) TIMER_DEVICE_CALLBACK_MEMBER(kurukuru_state::kurukuru_vdp_scanline)
{ {
m_v9938->set_resolution(0);
m_v9938->interrupt(); m_v9938->interrupt();
} }

View File

@ -301,10 +301,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(meritm_state::meritm_interrupt)
if((scanline % 2) == 0) if((scanline % 2) == 0)
{ {
m_v9938_0->set_resolution(RENDER_HIGH);
m_v9938_0->interrupt(); m_v9938_0->interrupt();
m_v9938_1->set_resolution(RENDER_HIGH);
m_v9938_1->interrupt(); m_v9938_1->interrupt();
} }
} }

View File

@ -444,7 +444,6 @@ TIMER_DEVICE_CALLBACK_MEMBER(sangho_state::sangho_interrupt)
if((scanline % 2) == 0) if((scanline % 2) == 0)
{ {
m_v9958->set_resolution(RENDER_HIGH);
m_v9958->interrupt(); m_v9958->interrupt();
} }
} }

View File

@ -215,7 +215,6 @@ void tonton_state::machine_reset()
TIMER_DEVICE_CALLBACK_MEMBER(tonton_state::tonton_interrupt) TIMER_DEVICE_CALLBACK_MEMBER(tonton_state::tonton_interrupt)
{ {
m_v9938->set_resolution(0);
m_v9938->interrupt(); m_v9938->interrupt();
} }

View File

@ -635,10 +635,6 @@ static INPUT_PORTS_START( msx_dips )
PORT_DIPNAME( 0x40, 0, "Swap game port 1 and 2") PORT_DIPNAME( 0x40, 0, "Swap game port 1 and 2")
PORT_DIPSETTING( 0, DEF_STR( No ) ) PORT_DIPSETTING( 0, DEF_STR( No ) )
PORT_DIPSETTING( 0x40, DEF_STR( Yes ) ) PORT_DIPSETTING( 0x40, DEF_STR( Yes ) )
PORT_DIPNAME ( 0x03, 0, "Render resolution")
PORT_DIPSETTING( 0, DEF_STR( High ))
PORT_DIPSETTING( 1, DEF_STR( Low ))
PORT_DIPSETTING( 2, "Auto" )
PORT_START("MOUSE0") PORT_START("MOUSE0")
PORT_BIT( 0xff00, 0x00, IPT_TRACKBALL_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) PORT_BIT( 0xff00, 0x00, IPT_TRACKBALL_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1)

View File

@ -214,13 +214,11 @@ void msx_state::post_load()
TIMER_DEVICE_CALLBACK_MEMBER(msx_state::msx2_interrupt) TIMER_DEVICE_CALLBACK_MEMBER(msx_state::msx2_interrupt)
{ {
m_v9938->set_resolution(m_io_dsw->read() & 0x03);
m_v9938->interrupt(); m_v9938->interrupt();
} }
TIMER_DEVICE_CALLBACK_MEMBER(msx_state::msx2p_interrupt) TIMER_DEVICE_CALLBACK_MEMBER(msx_state::msx2p_interrupt)
{ {
m_v9958->set_resolution(m_io_dsw->read() & 0x03);
m_v9958->interrupt(); m_v9958->interrupt();
} }