mirror of
https://github.com/holub/mame
synced 2025-04-21 07:52:35 +03:00
Merge pull request #560 from meesokim/patch-5
spc1500: screen update modified for game (galaxy)
This commit is contained in:
commit
e42fafc3d7
@ -284,6 +284,7 @@ private:
|
||||
UINT8 *m_p_ram;
|
||||
UINT8 m_ipl;
|
||||
UINT8 m_palet[3];
|
||||
UINT8 m_paltbl[8];
|
||||
UINT16 m_page;
|
||||
UINT16 m_pcg_addr;
|
||||
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_double_mode = (!m_p5bit && BIT(data, 5)); // double access I/O mode
|
||||
m_p5bit = BIT(data, 5);
|
||||
m_vdg->set_clock(VDP_CLOCK/(BIT(data, 2) ? 48 : 24));
|
||||
|
||||
}
|
||||
|
||||
READ8_MEMBER( spc1500_state::portb_r)
|
||||
@ -453,7 +456,8 @@ WRITE8_MEMBER( spc1500_state::priority_w)
|
||||
WRITE8_MEMBER( spc1500_state::palet_w)
|
||||
{
|
||||
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)
|
||||
@ -495,23 +499,22 @@ MC6845_UPDATE_ROW(spc1500_state::crtc_update_row)
|
||||
char hs = (m_crtc_vreg[0x9] < 15 ? 3 : 4);
|
||||
int n = y & (m_crtc_vreg[0x9]);
|
||||
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++)
|
||||
{
|
||||
UINT8 *pp = &m_p_videoram[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 *pp = &vram[0x2000+((y>>hs)*x_count+(((y)&7)<<11))+i+(((hs==4)&&(y&8))?0x400:0)];
|
||||
UINT8 *pv = &vram[(y>>hs)*x_count + i];
|
||||
UINT8 ascii = *(pv+0x1000);
|
||||
UINT8 attr = *pv;
|
||||
inv = (attr & 0x8 ? true : false);
|
||||
UINT8 rgb = (attr & 0x7);
|
||||
UINT8 pal = 1<<rgb;
|
||||
UINT8 color = attr & 0x7;
|
||||
UINT8 pixelb = *(pp+0);
|
||||
UINT8 pixelr = *(pp+0x4000);
|
||||
UINT8 pixelg = *(pp+0x8000);
|
||||
UINT8 pen = (((m_palet[0]&pal)>0)<<2)|(((m_palet[1]&pal)>0)<<1)|(((m_palet[2]&pal)>0));
|
||||
if ((m_palet[0] | m_palet[1] | m_palet[2])==0 || ln400)
|
||||
pen = rgb;
|
||||
UINT32 color = m_palette->pen(pen);
|
||||
bool nopalet = ((m_palet[0] | m_palet[1] | m_palet[2])==0 || ln400);
|
||||
UINT8 pen = (nopalet ? color : m_paltbl[color]);
|
||||
UINT8 pixelpen = 0;
|
||||
UINT8 pixel = 0;
|
||||
if (hs == 4 && ascii & 0x80)
|
||||
{
|
||||
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 = (inv ? 0xffff - hfnt : 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));
|
||||
*p++ = (((hfnt & (0x8000 >> j)) || (m_priority & (1<<pixelpen))) ? m_palette->pen(pixelpen) : color);
|
||||
pixel = ((wpixelg&j ? 4:0 )|(wpixelr&j? 2:0)|(wpixelb&j ? 1:0));
|
||||
pixelpen = (nopalet ? pixel : m_paltbl[pixel]);
|
||||
*p++ = m_palette->pen(((hfnt & j) || (m_priority & (1<<pixel))) ? pixelpen : pen);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
@ -542,11 +546,13 @@ MC6845_UPDATE_ROW(spc1500_state::crtc_update_row)
|
||||
UINT8 b = *pa;
|
||||
UINT8 r = *(pa+0x800);
|
||||
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);
|
||||
pixelpen = (((pixelg&(0x80 >> j))>0 ? 4 : 0)|((pixelr&(0x80 >> j))>0 ? 2:0)|(((pixelb&(0x80 >> j) ? 1:0 ))));
|
||||
*p++ = ((pen == 0 || (m_priority & (1<<pixelpen))) ? m_palette->pen(pixelpen) : m_palette->pen(pen));
|
||||
pixel = ((g & j)?4:0)|((r & j)?2:0)|((b & j)?1:0);
|
||||
pen = (pixel == 7 ? color : pixel);
|
||||
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
|
||||
@ -556,16 +562,16 @@ MC6845_UPDATE_ROW(spc1500_state::crtc_update_row)
|
||||
if (ascii == 0 && (attr & 0x08) && inv)
|
||||
{
|
||||
fnt = 0xff;
|
||||
color = m_palette->pen(7);
|
||||
}
|
||||
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)
|
||||
*p++ = m_palette->pen(pixelpen);
|
||||
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_START("JOY")
|
||||
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
|
||||
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
|
||||
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
|
||||
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
|
||||
PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1)
|
||||
PORT_BIT(0x50, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1)
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
|
||||
PORT_BIT(0x10, IP_ACTIVE_HIGH,IPT_UNUSED) // DIP SW2 for Korean/English
|
||||
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
|
||||
|
||||
static ADDRESS_MAP_START(spc1500_mem, AS_PROGRAM, 8, spc1500_state )
|
||||
@ -820,6 +828,7 @@ void spc1500_state::machine_reset()
|
||||
m_motor = false;
|
||||
m_time = machine().scheduler().time();
|
||||
m_double_mode = false;
|
||||
memset(&m_paltbl[0], 1, 8);
|
||||
}
|
||||
|
||||
READ8_MEMBER(spc1500_state::mc6845_videoram_r)
|
||||
@ -831,6 +840,7 @@ READ8_MEMBER( spc1500_state::psga_r )
|
||||
{
|
||||
UINT8 data = 0;
|
||||
data |= (BIT(m_dipsw->read(),1)<<4) | (BIT(m_dipsw->read(),2)<<7);
|
||||
data |= (m_io_joy->read() & 0x6f);
|
||||
return data;
|
||||
}
|
||||
|
||||
@ -839,7 +849,6 @@ READ8_MEMBER( spc1500_state::porta_r )
|
||||
UINT8 data = 0x3f;
|
||||
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_io_joy->read() & 0x6f);
|
||||
data &= ~((m_centronics_busy == 0)<< 5);
|
||||
return data;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user