mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 07:17:45 -04:00
32x: improve irq handling + few bugfixes
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@866 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
04092e329b
commit
1f1ff763e6
10 changed files with 43 additions and 38 deletions
|
@ -19,7 +19,7 @@ static int REGPARM(2) sh2_irq_cb(SH2 *sh2, int level)
|
|||
}
|
||||
}
|
||||
|
||||
void p32x_update_irls(void)
|
||||
void p32x_update_irls(int nested_call)
|
||||
{
|
||||
int irqs, mlvl = 0, slvl = 0;
|
||||
|
||||
|
@ -36,8 +36,8 @@ void p32x_update_irls(void)
|
|||
slvl *= 2;
|
||||
|
||||
elprintf(EL_32X, "update_irls: m %d, s %d", mlvl, slvl);
|
||||
sh2_irl_irq(&msh2, mlvl);
|
||||
sh2_irl_irq(&ssh2, slvl);
|
||||
sh2_irl_irq(&msh2, mlvl, nested_call);
|
||||
sh2_irl_irq(&ssh2, slvl, nested_call);
|
||||
mlvl = mlvl ? 1 : 0;
|
||||
slvl = slvl ? 1 : 0;
|
||||
p32x_poll_event(mlvl | (slvl << 1), 0);
|
||||
|
@ -141,7 +141,7 @@ void PicoReset32x(void)
|
|||
{
|
||||
if (PicoAHW & PAHW_32X) {
|
||||
Pico32x.sh2irqs |= P32XI_VRES;
|
||||
p32x_update_irls();
|
||||
p32x_update_irls(0);
|
||||
p32x_poll_event(3, 0);
|
||||
}
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ static void p32x_start_blank(void)
|
|||
}
|
||||
|
||||
Pico32x.sh2irqs |= P32XI_VINT;
|
||||
p32x_update_irls();
|
||||
p32x_update_irls(0);
|
||||
p32x_poll_event(3, 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -224,12 +224,12 @@ static void p32x_reg_write8(u32 a, u32 d)
|
|||
case 3: // irq ctl
|
||||
if ((d & 1) && !(Pico32x.sh2irqi[0] & P32XI_CMD)) {
|
||||
Pico32x.sh2irqi[0] |= P32XI_CMD;
|
||||
p32x_update_irls();
|
||||
p32x_update_irls(0);
|
||||
SekEndRun(16);
|
||||
}
|
||||
if ((d & 2) && !(Pico32x.sh2irqi[1] & P32XI_CMD)) {
|
||||
Pico32x.sh2irqi[1] |= P32XI_CMD;
|
||||
p32x_update_irls();
|
||||
p32x_update_irls(0);
|
||||
SekEndRun(16);
|
||||
}
|
||||
return;
|
||||
|
@ -431,7 +431,7 @@ static void p32x_sh2reg_write8(u32 a, u32 d, int cpuid)
|
|||
Pico32x.sh2irq_mask[cpuid] = d & 0x8f;
|
||||
Pico32x.sh2_regs[0] &= ~0x80;
|
||||
Pico32x.sh2_regs[0] |= d & 0x80;
|
||||
p32x_update_irls();
|
||||
p32x_update_irls(1);
|
||||
return;
|
||||
case 5: // H count
|
||||
Pico32x.sh2_regs[4 / 2] = d & 0xff;
|
||||
|
@ -486,7 +486,7 @@ static void p32x_sh2reg_write16(u32 a, u32 d, int cpuid)
|
|||
return;
|
||||
|
||||
irls:
|
||||
p32x_update_irls();
|
||||
p32x_update_irls(1);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
@ -950,7 +950,7 @@ static u32 sh2_read8_cs0(u32 a, int id)
|
|||
if (id == 1 && a < sizeof(Pico32xMem->sh2_rom_s))
|
||||
return Pico32xMem->sh2_rom_s[a ^ 1];
|
||||
|
||||
if ((a & 0x3ff00) == 0x4200) {
|
||||
if ((a & 0x3fe00) == 0x4200) {
|
||||
d = Pico32xMem->pal[(a & 0x1ff) / 2];
|
||||
goto out_16to8;
|
||||
}
|
||||
|
@ -1004,7 +1004,7 @@ static u32 sh2_read16_cs0(u32 a, int id)
|
|||
if (id == 1 && a < sizeof(Pico32xMem->sh2_rom_s))
|
||||
return *(u16 *)(Pico32xMem->sh2_rom_s + a);
|
||||
|
||||
if ((a & 0x3ff00) == 0x4200) {
|
||||
if ((a & 0x3fe00) == 0x4200) {
|
||||
d = Pico32xMem->pal[(a & 0x1ff) / 2];
|
||||
goto out;
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ void p32x_timers_recalc(void)
|
|||
}
|
||||
|
||||
// PWM irq for every tm samples
|
||||
void p32x_timers_do(int new_line)
|
||||
void p32x_timers_do(int line_call)
|
||||
{
|
||||
int tm, cnt, i;
|
||||
|
||||
|
@ -55,17 +55,17 @@ void p32x_timers_do(int new_line)
|
|||
{
|
||||
tm = (Pico32x.regs[0x30 / 2] & 0x0f00) >> 8;
|
||||
if (tm != 0) {
|
||||
if (new_line)
|
||||
if (line_call)
|
||||
Pico32x.pwm_irq_sample_cnt += pwm_line_samples;
|
||||
if (Pico32x.pwm_irq_sample_cnt >= (tm << 16)) {
|
||||
Pico32x.pwm_irq_sample_cnt -= tm << 16;
|
||||
Pico32x.sh2irqs |= P32XI_PWM;
|
||||
p32x_update_irls();
|
||||
p32x_update_irls(!line_call);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!new_line)
|
||||
if (!line_call)
|
||||
return;
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue