summaryrefslogtreecommitdiff
path: root/src/zx81.c
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2006-09-16 22:52:18 +0000
committerIan C <ianc@noddybox.co.uk>2006-09-16 22:52:18 +0000
commit7145eef7df3d346e816117b78d5cbd6e023611e1 (patch)
tree38dec1bcdd99c6e8911a734ba22f933a312efc02 /src/zx81.c
parentffa5b2684201291ed2d0ef5b9443afe9c1369ae8 (diff)
Updates to ULA (still broken)
Diffstat (limited to 'src/zx81.c')
-rw-r--r--src/zx81.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/src/zx81.c b/src/zx81.c
index 092d575..87158cd 100644
--- a/src/zx81.c
+++ b/src/zx81.c
@@ -78,6 +78,7 @@ static Z80Word RAMLEN=0;
*/
static int nmigen=FALSE;
static int hsync=FALSE;
+static int vsync=FALSE;
/* The ULA
*/
@@ -390,9 +391,6 @@ static void ULA_Video_Shifter(Z80 *z80, Z80Byte val)
}
ULA.x=(ULA.x+1)&0x1f;
-
- if (ULA.x==0)
- Z80Interrupt(z80,0xff);
}
@@ -410,6 +408,7 @@ static int CheckTimers(Z80 *z80, Z80Val val)
else if (hsync)
{
Debug("HSYNC\n");
+ Z80Interrupt(z80,0xff);
if (ULA.release)
{
/* ULA.release=FALSE; */
@@ -608,13 +607,11 @@ Z80Byte ZX81ReadPort(Z80 *z80, Z80Word port)
break;
}
- /* Turn off HSYNC if NMI generator is OFF and redraw screen to
- match output ULA has since sent out.
+ /* Turn on VSYNC if not on
*/
- if (!nmigen && hsync)
+ if (!vsync)
{
- Debug("HSYNC OFF\n");
- hsync=FALSE;
+ Debug("VSYNC\n");
GFXEndFrame(TRUE);
GFXClear(white);
@@ -625,6 +622,7 @@ Z80Byte ZX81ReadPort(Z80 *z80, Z80Word port)
ULA.release=FALSE;
GFXStartFrame();
+ vsync=TRUE;
}
else
{
@@ -633,6 +631,14 @@ Z80Byte ZX81ReadPort(Z80 *z80, Z80Word port)
ULA.c=0;
ULA.release=FALSE;
}
+
+ /* If NMI on, turn off the HSYNC generator
+ */
+ if (!nmigen)
+ {
+ Debug("HSYNC OFF\n");
+ hsync=FALSE;
+ }
break;
default:
@@ -645,7 +651,7 @@ Z80Byte ZX81ReadPort(Z80 *z80, Z80Word port)
void ZX81WritePort(Z80 *z80, Z80Word port, Z80Byte val)
{
- Debug("OUT %4.4x\n",port);
+ Debug("OUT %4.4x,%2.2X\n",port,val);
/* Any port write releases the ULA line counter
*/
@@ -659,8 +665,9 @@ void ZX81WritePort(Z80 *z80, Z80Word port, Z80Byte val)
break;
case 0xfe: /* NMI generator ON */
- Debug("NMIGEN ON\n");
+ Debug("NMIGEN ON/VSYNC OFF\n");
nmigen=TRUE;
+ vsync=FALSE;
break;
case 0xff: /* HSYNC generator ON */