mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2024-11-05 02:15:07 +01:00
fixed interrupts
fixed Hcounter
This commit is contained in:
parent
ddcdc3c4ee
commit
9f58e7bf8b
@ -167,18 +167,3 @@ int z80_irq_callback (int param)
|
||||
z80_set_irq_line (0, CLEAR_LINE);
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
int vdp_int_ack_callback (int int_level)
|
||||
{
|
||||
switch (int_level)
|
||||
{
|
||||
case 4:
|
||||
hint_pending = 0;
|
||||
vint_pending = 0;
|
||||
break;
|
||||
case 6:
|
||||
vint_pending = 0;
|
||||
break;
|
||||
}
|
||||
return M68K_INT_ACK_AUTOVECTOR;
|
||||
}
|
||||
|
15
source/hvc.h
15
source/hvc.h
@ -181,7 +181,7 @@ uint16 vc_pal_240[313] = {
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
uint8 cycle2hc32[488] = {
|
||||
0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x05,
|
||||
0x05, 0x05, 0x06, 0x06, 0x07, 0x07, 0x07, 0x08, 0x08, 0x08, 0x09, 0x09, 0x09, 0x0A, 0x0A, 0x0A,
|
||||
@ -216,9 +216,9 @@ uint8 cycle2hc32[488] = {
|
||||
0xF7, 0xF8, 0xF8, 0xF8, 0xF9, 0xF9, 0xF9, 0xFA, 0xFA, 0xFA, 0xFB, 0xFB, 0xFB, 0xFC, 0xFC, 0xFD,
|
||||
0xFD, 0xFD, 0xFE, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF
|
||||
};
|
||||
*/
|
||||
|
||||
uint8 cycle2hc32[489] = {
|
||||
|
||||
/*uint8 cycle2hc32[489] = {
|
||||
0xe8, 0xe8, 0xe8, 0xe9, 0xe9, 0xe9, 0xea, 0xea, 0xea, 0xeb, 0xeb, 0xeb, 0xec, 0xec, 0xec, 0xed,
|
||||
0xed, 0xed, 0xee, 0xee, 0xee, 0xef, 0xef, 0xf0, 0xf0, 0xf0, 0xf1, 0xf1, 0xf1, 0xf2, 0xf2, 0xf2,
|
||||
0xf3, 0xf3, 0xf3, 0xf4, 0xf4, 0xf4, 0xf5, 0xf5, 0xf5, 0xf6, 0xf6, 0xf6, 0xf7, 0xf7, 0xf8, 0xf8,
|
||||
@ -252,7 +252,7 @@ uint8 cycle2hc32[489] = {
|
||||
0x8f, 0x8f, 0x8f, 0x90, 0x90, 0x90, 0x91, 0x91, 0x92
|
||||
};
|
||||
|
||||
|
||||
*/
|
||||
/*
|
||||
uint8 cycle2hc32[489] = {
|
||||
0xe9, 0xe9, 0xe9, 0xea, 0xea, 0xea, 0xeb, 0xeb, 0xeb, 0xec, 0xec, 0xec, 0xed, 0xed, 0xed, 0xee,
|
||||
@ -289,7 +289,7 @@ uint8 cycle2hc32[489] = {
|
||||
};*/
|
||||
|
||||
|
||||
/*
|
||||
|
||||
uint8 cycle2hc40[488] = {
|
||||
0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x03, 0x03, 0x03, 0x04, 0x04, 0x05, 0x05, 0x06, 0x06,
|
||||
0x06, 0x07, 0x07, 0x08, 0x08, 0x09, 0x09, 0x09, 0x0A, 0x0A, 0x0B, 0x0B, 0x0C, 0x0C, 0x0C, 0x0D,
|
||||
@ -323,8 +323,9 @@ uint8 cycle2hc40[488] = {
|
||||
0xEE, 0xEF, 0xEF, 0xF0, 0xF0, 0xF1, 0xF1, 0xF1, 0xF2, 0xF2, 0xF3, 0xF3, 0xF4, 0xF4, 0xF4, 0xF5,
|
||||
0xF5, 0xF6, 0xF6, 0xF7, 0xF7, 0xF7, 0xF8, 0xF8, 0xF9, 0xF9, 0xFA, 0xFA, 0xFB, 0xFB, 0xFB, 0xFC,
|
||||
0xFC, 0xFD, 0xFD, 0xFE, 0xFE, 0xFE, 0xFF, 0xFF
|
||||
};*/
|
||||
};
|
||||
|
||||
/*
|
||||
uint8 cycle2hc40[489] = {
|
||||
0xe4, 0xe4, 0xe4, 0xe5, 0xe5, 0xe6, 0xe6, 0xe7, 0xe7, 0xe7, 0xe8, 0xe8, 0xe9, 0xe9, 0xea, 0xea,
|
||||
0xea, 0xeb, 0xeb, 0xec, 0xec, 0xed, 0xed, 0xed, 0xee, 0xee, 0xef, 0xef, 0xf0, 0xf0, 0xf0, 0xf1,
|
||||
@ -358,7 +359,7 @@ uint8 cycle2hc40[489] = {
|
||||
0xab, 0xac, 0xac, 0xac, 0xad, 0xad, 0xae, 0xae, 0xaf, 0xaf, 0xaf, 0xb0, 0xb0, 0xb1, 0xb1, 0xb2,
|
||||
0xb2, 0xb2, 0xb3, 0xb3, 0xb4, 0xb4, 0xb5, 0xb5, 0xb6
|
||||
};
|
||||
|
||||
*/
|
||||
/*
|
||||
uint8 cycle2hc40[489] = {
|
||||
0xe4, 0xe4, 0xe4, 0xe5, 0xe5, 0xe6, 0xe6, 0xe6, 0xe7, 0xe7, 0xe8, 0xe8, 0xe9, 0xe9, 0xe9, 0xea,
|
||||
|
@ -40,11 +40,18 @@ uint8 alttiming = 0;
|
||||
|
||||
void m68k_run (int cyc)
|
||||
{
|
||||
int cyc_do = cyc - count_m68k; /* cycles remaining to run for the line */
|
||||
/* cycles remaining to run for the line */
|
||||
int cyc_do = cyc - count_m68k;
|
||||
|
||||
/* 68k is not frozen */
|
||||
if (cyc_do > 0)
|
||||
{
|
||||
m68k_execute(cyc_do);
|
||||
/* interrupt handling */
|
||||
if (vint_pending && (reg[1] & 0x20)) m68k_set_irq(6);
|
||||
else if (hint_pending && (reg[0] & 0x10)) m68k_set_irq(4);
|
||||
if (cyc_do > 0) m68k_execute(cyc_do);
|
||||
count_m68k += cyc_do;
|
||||
vint_pending = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,7 +71,7 @@ void m68k_freeze(int cycles)
|
||||
/* end of 68k execution */
|
||||
m68ki_remaining_cycles = 0;
|
||||
|
||||
/* extra cycles are burned at next execution */
|
||||
/* extra cycles to be burned at next execution */
|
||||
count_m68k += extra_cycles;
|
||||
}
|
||||
else m68ki_remaining_cycles -= cycles; /* we burn some 68k cycles */
|
||||
@ -242,12 +249,13 @@ int system_frame (int do_skip)
|
||||
{
|
||||
h_counter = reg[10];
|
||||
hint_pending = 1;
|
||||
if(reg[0] & 0x10) m68k_set_irq(4);
|
||||
if (alttiming) m68k_run(aim_m68k - 456); /* fix Legend of Galahad */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Render a line of the display if needed */
|
||||
if (do_skip == 0 && !alttiming)
|
||||
if (do_skip == 0)
|
||||
{
|
||||
if (v_counter < frame_end) render_line(v_counter);
|
||||
if (v_counter < (frame_end-1)) parse_satb(0x81 + v_counter);
|
||||
@ -258,12 +266,6 @@ int system_frame (int do_skip)
|
||||
m68k_run(aim_m68k - 404);
|
||||
status &= 0xFFFB; // HBlank = 0
|
||||
|
||||
if (do_skip == 0 && alttiming) /* hack for Legend of Galahad and Road Rash serie (one-line glitch)*/
|
||||
{
|
||||
if (v_counter < frame_end) render_line(v_counter);
|
||||
if (v_counter < (frame_end-1)) parse_satb(0x81 + v_counter);
|
||||
}
|
||||
|
||||
if (v_counter == frame_end)
|
||||
{
|
||||
/* V Retrace */
|
||||
@ -273,9 +275,8 @@ int system_frame (int do_skip)
|
||||
else count_z80 = aim_z80 - 168;
|
||||
|
||||
/* V Int */
|
||||
status |= 0x0080;
|
||||
vint_pending = 1;
|
||||
if (reg[1] & 0x20) m68k_set_irq(6);
|
||||
status |= 0x0080;
|
||||
|
||||
/* Z Int */
|
||||
if (zreset == 1 && zbusreq == 0)
|
||||
|
19
source/vdp.c
19
source/vdp.c
@ -470,21 +470,10 @@ void vdp_reg_w (uint8 r, uint8 d)
|
||||
switch (r)
|
||||
{
|
||||
case 0x00: /* CTRL #1 */
|
||||
if (vint_pending && (reg[1] & 0x20)) m68k_set_irq (6);
|
||||
else if (hint_pending && (d & 0x10)) m68k_set_irq (4);
|
||||
else m68k_set_irq (0);
|
||||
if (!(d & 0x02)) hc_latch = -1;
|
||||
|
||||
break;
|
||||
|
||||
case 0x01: /* CTRL #2 */
|
||||
if (vint_pending && (d & 0x20))
|
||||
{
|
||||
if (irqtiming) m68k_run(count_m68k + 24); /* hack for Sesame's Street */
|
||||
m68k_set_irq (6);
|
||||
}
|
||||
else if (hint_pending && (reg[0] & 0x10)) m68k_set_irq (4); /* fix Lemmings status bar */
|
||||
else m68k_set_irq (0);
|
||||
|
||||
/* Change the frame timing */
|
||||
frame_end = (d & 8) ? 0xF0 : 0xE0;
|
||||
@ -598,3 +587,11 @@ uint16 vdp_hvc_r (void)
|
||||
|
||||
void vdp_test_w (uint16 value)
|
||||
{}
|
||||
|
||||
int vdp_int_ack_callback (int int_level)
|
||||
{
|
||||
if (vint_pending) vint_pending = 0;
|
||||
else hint_pending = 0;
|
||||
if (!hint_pending && !vint_pending) m68k_set_irq(0);
|
||||
return M68K_INT_ACK_AUTOVECTOR;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user