Fixed a bug with non-zero base SAD register in upd7220, fixes vertical position in Tokimeki Sports Gal 3

This commit is contained in:
Angelo Salese 2012-12-03 21:54:16 +00:00
parent e094093fc4
commit 0828b94d8f
2 changed files with 29 additions and 11 deletions

View File

@ -544,9 +544,9 @@ static UPD7220_DISPLAY_PIXELS( hgdc_display_pixels )
res_x = x + xi;
res_y = y;
pen = ((state->m_video_ram_2[address + (0x08000) + (state->m_vram_disp*0x20000)] >> (7-xi)) & 1) ? 1 : 0;
pen|= ((state->m_video_ram_2[address + (0x10000) + (state->m_vram_disp*0x20000)] >> (7-xi)) & 1) ? 2 : 0;
pen|= ((state->m_video_ram_2[address + (0x18000) + (state->m_vram_disp*0x20000)] >> (7-xi)) & 1) ? 4 : 0;
pen = ((state->m_video_ram_2[(address & 0x7fff) + (0x08000) + (state->m_vram_disp*0x20000)] >> (7-xi)) & 1) ? 1 : 0;
pen|= ((state->m_video_ram_2[(address & 0x7fff) + (0x10000) + (state->m_vram_disp*0x20000)] >> (7-xi)) & 1) ? 2 : 0;
pen|= ((state->m_video_ram_2[(address & 0x7fff) + (0x18000) + (state->m_vram_disp*0x20000)] >> (7-xi)) & 1) ? 4 : 0;
if(interlace_on)
{
@ -1276,16 +1276,15 @@ WRITE8_MEMBER(pc9801_state::pc9801_tvram_w)
m_video_ram_1[offset] = data; //TODO: check me
}
/* +0x8000 is trusted (bank 0 is actually used by 16 colors mode) */
READ8_MEMBER(pc9801_state::pc9801_gvram_r)
{
return m_video_ram_2[offset+0x8000+m_vram_bank*0x20000];
return m_video_ram_2[offset+0x08000+m_vram_bank*0x20000];
}
WRITE8_MEMBER(pc9801_state::pc9801_gvram_w)
{
m_video_ram_2[offset+0x8000+m_vram_bank*0x20000] = data;
m_video_ram_2[offset+0x08000+m_vram_bank*0x20000] = data;
}
READ8_MEMBER(pc9801_state::pc9801_opn_r)
@ -2381,7 +2380,7 @@ GFXDECODE_END
****************************************/
/*
irq assignment:
irq assignment (PC-9801F):
8259 master:
ir0 PIT
@ -2398,7 +2397,7 @@ ir0 <connection with master 8259?>
ir1
ir2 2dd floppy irq
ir3 2hd floppy irq
ir4
ir4 opn
ir5
ir6
ir7
@ -2911,7 +2910,25 @@ INTERRUPT_GEN_MEMBER(pc9801_state::pc9801_vrtc_irq)
// pic8259_ir2_w(machine().device("pic8259_master"), 0);
}
static void pc9801_sound_irq( device_t *device, int irq )
{
// pc9801_state *state = device->machine().driver_data<pc9801_state>();
pic8259_ir4_w(device->machine().device("pic8259_slave"), irq);
}
static const ym2203_interface pc98_ym2203_intf =
{
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
DEVCB_NULL,//(pc8801_state,opn_porta_r),
DEVCB_NULL,//(pc8801_state,opn_portb_r),
DEVCB_NULL,
DEVCB_NULL
},
DEVCB_LINE(pc9801_sound_irq)
};
static MACHINE_CONFIG_START( pc9801, pc9801_state )
MCFG_CPU_ADD("maincpu", I8086, 5000000) //unknown clock
@ -2965,6 +2982,7 @@ static MACHINE_CONFIG_START( pc9801, pc9801_state )
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_SOUND_ADD("opn", YM2203, 4000000) // unknown clock / divider
MCFG_SOUND_CONFIG(pc98_ym2203_intf)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MCFG_SOUND_ADD(BEEPER_TAG, BEEP, 0)

View File

@ -1591,7 +1591,7 @@ void upd7220_device::draw_graphics_line(bitmap_ind16 &bitmap, UINT32 addr, int y
if((sx << 3) < m_aw * 16 && y < m_al)
m_display_cb(this, bitmap, y, sx << 3, addr);
if (wd) addr += 2; else addr++;
addr+= wd + 1;
}
}
@ -1620,7 +1620,7 @@ void upd7220_device::update_graphics(bitmap_ind16 &bitmap, const rectangle &clip
for (y = 0; y < len; y++)
{
addr = (sad & 0x3ffff) + (y * m_pitch * 2);
addr = ((sad << 1) & 0x3ffff) + (y * m_pitch * 2);
if (m_display_cb)
draw_graphics_line(bitmap, addr, y + bsy, wd);