mirror of
https://github.com/holub/mame
synced 2025-04-27 18:53:05 +03:00
spc1500: screen update modified for game (galaxy)
Palet table added for simple screen update (from a comment of the naver cafe manager 'Loderunner') . Video start addr of MC6845 regs affected on screen update (galaxy). PCG character takes proper palet color (galaxy). Joystick port active has been fixed to low from high.
This commit is contained in:
parent
6c18ce2c95
commit
5a22684fd4
@ -284,6 +284,7 @@ private:
|
|||||||
UINT8 *m_p_ram;
|
UINT8 *m_p_ram;
|
||||||
UINT8 m_ipl;
|
UINT8 m_ipl;
|
||||||
UINT8 m_palet[3];
|
UINT8 m_palet[3];
|
||||||
|
UINT8 m_paltbl[8];
|
||||||
UINT16 m_page;
|
UINT16 m_page;
|
||||||
UINT16 m_pcg_addr;
|
UINT16 m_pcg_addr;
|
||||||
UINT8 m_pcg_char, m_pcg_attr;
|
UINT8 m_pcg_char, m_pcg_attr;
|
||||||
@ -367,6 +368,8 @@ WRITE8_MEMBER( spc1500_state::portc_w)
|
|||||||
m_centronics->write_strobe(BIT(data, 7));
|
m_centronics->write_strobe(BIT(data, 7));
|
||||||
m_double_mode = (!m_p5bit && BIT(data, 5)); // double access I/O mode
|
m_double_mode = (!m_p5bit && BIT(data, 5)); // double access I/O mode
|
||||||
m_p5bit = BIT(data, 5);
|
m_p5bit = BIT(data, 5);
|
||||||
|
m_vdg->set_clock(VDP_CLOCK/(BIT(data, 2) ? 48 : 24));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
READ8_MEMBER( spc1500_state::portb_r)
|
READ8_MEMBER( spc1500_state::portb_r)
|
||||||
@ -453,7 +456,8 @@ WRITE8_MEMBER( spc1500_state::priority_w)
|
|||||||
WRITE8_MEMBER( spc1500_state::palet_w)
|
WRITE8_MEMBER( spc1500_state::palet_w)
|
||||||
{
|
{
|
||||||
m_palet[(offset>>8)&0x0f] = data;
|
m_palet[(offset>>8)&0x0f] = data;
|
||||||
// printf("palet:0x%02x, 0x%02x, 0x%02x\n", m_palet[0], m_palet[1], m_palet[2]);
|
for(int i=1, j=0; i < 0x100; i<<=1, j++)
|
||||||
|
m_paltbl[j] = (m_palet[0]&i?1:0)|(m_palet[1]&i?2:0)|(m_palet[2]&i?4:0);
|
||||||
}
|
}
|
||||||
|
|
||||||
PALETTE_INIT_MEMBER(spc1500_state,spc)
|
PALETTE_INIT_MEMBER(spc1500_state,spc)
|
||||||
@ -495,23 +499,22 @@ MC6845_UPDATE_ROW(spc1500_state::crtc_update_row)
|
|||||||
char hs = (m_crtc_vreg[0x9] < 15 ? 3 : 4);
|
char hs = (m_crtc_vreg[0x9] < 15 ? 3 : 4);
|
||||||
int n = y & (m_crtc_vreg[0x9]);
|
int n = y & (m_crtc_vreg[0x9]);
|
||||||
bool ln400 = (hs == 4 && m_crtc_vreg[0x4] > 20);
|
bool ln400 = (hs == 4 && m_crtc_vreg[0x4] > 20);
|
||||||
|
UINT8 *vram = &m_p_videoram[0] + (m_crtc_vreg[12] << 8) + m_crtc_vreg[13];
|
||||||
for (i = 0; i < x_count; i++)
|
for (i = 0; i < x_count; i++)
|
||||||
{
|
{
|
||||||
UINT8 *pp = &m_p_videoram[0x2000+((y>>hs)*x_count+(((y)&7)<<11))+i+(((hs==4)&&(y&8))?0x400:0)];
|
UINT8 *pp = &vram[0x2000+((y>>hs)*x_count+(((y)&7)<<11))+i+(((hs==4)&&(y&8))?0x400:0)];
|
||||||
UINT8 *pv = &m_p_videoram[(y>>hs)*x_count + i];
|
UINT8 *pv = &vram[(y>>hs)*x_count + i];
|
||||||
UINT8 ascii = *(pv+0x1000);
|
UINT8 ascii = *(pv+0x1000);
|
||||||
UINT8 attr = *pv;
|
UINT8 attr = *pv;
|
||||||
inv = (attr & 0x8 ? true : false);
|
inv = (attr & 0x8 ? true : false);
|
||||||
UINT8 rgb = (attr & 0x7);
|
UINT8 color = attr & 0x7;
|
||||||
UINT8 pal = 1<<rgb;
|
|
||||||
UINT8 pixelb = *(pp+0);
|
UINT8 pixelb = *(pp+0);
|
||||||
UINT8 pixelr = *(pp+0x4000);
|
UINT8 pixelr = *(pp+0x4000);
|
||||||
UINT8 pixelg = *(pp+0x8000);
|
UINT8 pixelg = *(pp+0x8000);
|
||||||
UINT8 pen = (((m_palet[0]&pal)>0)<<2)|(((m_palet[1]&pal)>0)<<1)|(((m_palet[2]&pal)>0));
|
bool nopalet = ((m_palet[0] | m_palet[1] | m_palet[2])==0 || ln400);
|
||||||
if ((m_palet[0] | m_palet[1] | m_palet[2])==0 || ln400)
|
UINT8 pen = (nopalet ? color : m_paltbl[color]);
|
||||||
pen = rgb;
|
|
||||||
UINT32 color = m_palette->pen(pen);
|
|
||||||
UINT8 pixelpen = 0;
|
UINT8 pixelpen = 0;
|
||||||
|
UINT8 pixel = 0;
|
||||||
if (hs == 4 && ascii & 0x80)
|
if (hs == 4 && ascii & 0x80)
|
||||||
{
|
{
|
||||||
UINT16 wpixelb = (pixelb << 8) + (*(pp+1));
|
UINT16 wpixelb = (pixelb << 8) + (*(pp+1));
|
||||||
@ -529,10 +532,11 @@ MC6845_UPDATE_ROW(spc1500_state::crtc_update_row)
|
|||||||
hfnt = hfnt & ((*pf << 8) | (*(pf+16)));
|
hfnt = hfnt & ((*pf << 8) | (*(pf+16)));
|
||||||
hfnt = (inv ? 0xffff - hfnt : hfnt);
|
hfnt = (inv ? 0xffff - hfnt : hfnt);
|
||||||
//printf("0x%04x\n" , hfnt);
|
//printf("0x%04x\n" , hfnt);
|
||||||
for (j = 0; j < 16; j++)
|
for (j = 0x8000; j > 0; j>>=1)
|
||||||
{
|
{
|
||||||
pixelpen = (((wpixelg&(0x8000 >> j))>0 ? 4:0 )|((wpixelr&(0x8000 >> j))>0 ? 2:0)|((wpixelb&(0x8000 >> j))>0 ? 1:0));
|
pixel = ((wpixelg&j ? 4:0 )|(wpixelr&j? 2:0)|(wpixelb&j ? 1:0));
|
||||||
*p++ = (((hfnt & (0x8000 >> j)) || (m_priority & (1<<pixelpen))) ? m_palette->pen(pixelpen) : color);
|
pixelpen = (nopalet ? pixel : m_paltbl[pixel]);
|
||||||
|
*p++ = m_palette->pen(((hfnt & j) || (m_priority & (1<<pixel))) ? pixelpen : pen);
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@ -542,11 +546,13 @@ MC6845_UPDATE_ROW(spc1500_state::crtc_update_row)
|
|||||||
UINT8 b = *pa;
|
UINT8 b = *pa;
|
||||||
UINT8 r = *(pa+0x800);
|
UINT8 r = *(pa+0x800);
|
||||||
UINT8 g = *(pa+0x1000);
|
UINT8 g = *(pa+0x1000);
|
||||||
for (j = 0; j < 8; j++)
|
for (j = 0x80; j > 0; j>>=1)
|
||||||
{
|
{
|
||||||
pen = ((g & (0x80 >> j))>0?4:0)|((r & (0x80>>j))>0?2:0)|((b & (0x80>>j))>0?1:0);
|
pixel = ((g & j)?4:0)|((r & j)?2:0)|((b & j)?1:0);
|
||||||
pixelpen = (((pixelg&(0x80 >> j))>0 ? 4 : 0)|((pixelr&(0x80 >> j))>0 ? 2:0)|(((pixelb&(0x80 >> j) ? 1:0 ))));
|
pen = (pixel == 7 ? color : pixel);
|
||||||
*p++ = ((pen == 0 || (m_priority & (1<<pixelpen))) ? m_palette->pen(pixelpen) : m_palette->pen(pen));
|
pixel = (pixelg&j ? 4 : 0)|(pixelr&j ? 2:0)|(pixelb&j ? 1:0 );
|
||||||
|
pixelpen = (nopalet ? pixel : m_paltbl[pixel]);
|
||||||
|
*p++ = m_palette->pen((m_priority & (1<<pixel)) ? pixelpen : pen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -556,16 +562,16 @@ MC6845_UPDATE_ROW(spc1500_state::crtc_update_row)
|
|||||||
if (ascii == 0 && (attr & 0x08) && inv)
|
if (ascii == 0 && (attr & 0x08) && inv)
|
||||||
{
|
{
|
||||||
fnt = 0xff;
|
fnt = 0xff;
|
||||||
color = m_palette->pen(7);
|
|
||||||
}
|
}
|
||||||
fnt = (inv ? 0xff - fnt : fnt);
|
fnt = (inv ? 0xff - fnt : fnt);
|
||||||
for (j = 0; j < 8; j++)
|
for (j = 0x80; j > 0; j>>=1)
|
||||||
{
|
{
|
||||||
pixelpen = (((pixelg&(0x80 >> j))>0 ? 4 : 0)|((pixelr&(0x80 >> j))>0 ? 2:0)|(((pixelb&(0x80 >> j) ? 1:0 ))));
|
pixel = ((pixelg&j) ? 4 : 0)|(pixelr&j ? 2:0)|(pixelb&j ? 1:0 );
|
||||||
|
pixelpen = (nopalet ? pixel : m_paltbl[pixel]);
|
||||||
if (ascii == 0 && attr == 0 && !inv)
|
if (ascii == 0 && attr == 0 && !inv)
|
||||||
*p++ = m_palette->pen(pixelpen);
|
*p++ = m_palette->pen(pixelpen);
|
||||||
else
|
else
|
||||||
*p++ = (((fnt & (0x80 >> j)) || (m_priority & (1<<pixelpen))) ? m_palette->pen(pixelpen) : color);
|
*p++ = m_palette->pen(((fnt & j) || (m_priority & (1<<pixel))) ? pixelpen : pen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -782,12 +788,14 @@ static INPUT_PORTS_START( spc1500 )
|
|||||||
PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9 (") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(')
|
PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9 (") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(')
|
||||||
|
|
||||||
PORT_START("JOY")
|
PORT_START("JOY")
|
||||||
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
|
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
|
||||||
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
|
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
|
||||||
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
|
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
|
||||||
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
|
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
|
||||||
PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1)
|
PORT_BIT(0x10, IP_ACTIVE_HIGH,IPT_UNUSED) // DIP SW2 for Korean/English
|
||||||
PORT_BIT(0x50, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1)
|
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
|
||||||
|
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
|
||||||
|
PORT_BIT(0x80, IP_ACTIVE_HIGH,IPT_UNUSED) // DIP SW3 for 200/400 line
|
||||||
INPUT_PORTS_END
|
INPUT_PORTS_END
|
||||||
|
|
||||||
static ADDRESS_MAP_START(spc1500_mem, AS_PROGRAM, 8, spc1500_state )
|
static ADDRESS_MAP_START(spc1500_mem, AS_PROGRAM, 8, spc1500_state )
|
||||||
@ -820,6 +828,7 @@ void spc1500_state::machine_reset()
|
|||||||
m_motor = false;
|
m_motor = false;
|
||||||
m_time = machine().scheduler().time();
|
m_time = machine().scheduler().time();
|
||||||
m_double_mode = false;
|
m_double_mode = false;
|
||||||
|
memset(&m_paltbl[0], 1, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
READ8_MEMBER(spc1500_state::mc6845_videoram_r)
|
READ8_MEMBER(spc1500_state::mc6845_videoram_r)
|
||||||
@ -831,6 +840,7 @@ READ8_MEMBER( spc1500_state::psga_r )
|
|||||||
{
|
{
|
||||||
UINT8 data = 0;
|
UINT8 data = 0;
|
||||||
data |= (BIT(m_dipsw->read(),1)<<4) | (BIT(m_dipsw->read(),2)<<7);
|
data |= (BIT(m_dipsw->read(),1)<<4) | (BIT(m_dipsw->read(),2)<<7);
|
||||||
|
data |= (m_io_joy->read() & 0x6f);
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -839,7 +849,6 @@ READ8_MEMBER( spc1500_state::porta_r )
|
|||||||
UINT8 data = 0x3f;
|
UINT8 data = 0x3f;
|
||||||
data |= (m_cass->input() > 0.0038) ? 0x80 : 0;
|
data |= (m_cass->input() > 0.0038) ? 0x80 : 0;
|
||||||
data |= ((m_cass->get_state() & CASSETTE_MASK_UISTATE) != CASSETTE_STOPPED) && ((m_cass->get_state() & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_ENABLED) ? 0x00 : 0x40;
|
data |= ((m_cass->get_state() & CASSETTE_MASK_UISTATE) != CASSETTE_STOPPED) && ((m_cass->get_state() & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_ENABLED) ? 0x00 : 0x40;
|
||||||
data |= (m_io_joy->read() & 0x6f);
|
|
||||||
data &= ~((m_centronics_busy == 0)<< 5);
|
data &= ~((m_centronics_busy == 0)<< 5);
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user