ZX81+35 Clone
ZX81+35 Clone
Last edited by GCHarder on Fri Jul 29, 2016 11:49 pm, edited 1 time in total.
Re: ZX81 Clone
is there a way to contact the author
his hsync counter is resetting on the vsync, which of course is wrong
it should only reset with an int-ack and then the hsync is generated 16 clock cycles later
his hsync counter is resetting on the vsync, which of course is wrong

it should only reset with an int-ack and then the hsync is generated 16 clock cycles later
what's that Smell.... smells like fresh flux and solder fumes...
- chernandezba
- Posts: 217
- Joined: Tue Mar 11, 2014 4:30 pm
Re: ZX81 Clone
Andy, do you mean the Maskable interrupt generated when bit 6 of R register changes from 1 to 0?Andy Rea wrote:is there a way to contact the author
his hsync counter is resetting on the vsync, which of course is wrong![]()
it should only reset with an int-ack and then the hsync is generated 16 clock cycles later
Thanks
Cesar
- RetroTechie
- Posts: 379
- Joined: Tue Nov 01, 2011 12:16 am
- Location: Hengelo, NL
- Contact:
Re: ZX81 Clone
Andy is right. Horizontal syncs in a ZX81 are generated at a constant 207-cycle interval (63.7 usec / scanline), and this only gets reset by an interrupt acknowledge (Z80 /IORQ and /M1 both active). Unlike vertical syncs which are software-generated (the same way as in a ZX80, in fact) and don't affect hsync generator in any way.
Doing it any other way may work, but probably will result in timing differences (depending on software used). Read: may look okay at first glance, but not 100% ZX81 behaviour upon closer inspection.
Spotted this project a while ago. Looks like it's getting along nicely...
Doing it any other way may work, but probably will result in timing differences (depending on software used). Read: may look okay at first glance, but not 100% ZX81 behaviour upon closer inspection.
That would be because Z80's /INT line is hard-wired to the A6 line in a ZX81. Other than how this affects software: unrelated to the above.chernandezba wrote:Andy, do you mean the Maskable interrupt generated when bit 6 of R register changes from 1 to 0?
Spotted this project a while ago. Looks like it's getting along nicely...

Re: ZX81 Clone
Hi AndyAndy Rea wrote:is there a way to contact the author
I contacted them (tried my Dutch after all these years again).
Waiting for an answer now.
kind regards Paul
In theory, there is no difference between theory and practice. But, in practice, there is.
- chernandezba
- Posts: 217
- Joined: Tue Mar 11, 2014 4:30 pm
Re: ZX81 Clone
Well I have a doubt related with this; this behavior is not well emulated in my ZEsarUX so the display is not 100% correct in some games... So:
-when bit 6 of r register changes from 1 to 0, a maskable interrupt is generated. Then, as Andy says, a hsync is generated after 16 cycles of the int ack. So, if we are in a loop changing r register to a constant value, for example 0, the interrupt will never be fired and never will be generated a hsync? So the hsync is not fired at a constant interval?
-the other question is related to nmi... When it is fired? At the end of every scanline, at fixed 207 cycle interval?
Or it depends on the hsync? In the last case, it will depend on when the maskable interrupt is fired and the two types of interrupt would be fired almost at the same time...
Thanks,
Cesar
-when bit 6 of r register changes from 1 to 0, a maskable interrupt is generated. Then, as Andy says, a hsync is generated after 16 cycles of the int ack. So, if we are in a loop changing r register to a constant value, for example 0, the interrupt will never be fired and never will be generated a hsync? So the hsync is not fired at a constant interval?
-the other question is related to nmi... When it is fired? At the end of every scanline, at fixed 207 cycle interval?
Or it depends on the hsync? In the last case, it will depend on when the maskable interrupt is fired and the two types of interrupt would be fired almost at the same time...
Thanks,
Cesar
Re: ZX81 Clone
The hsync counter is free running and reset all 207 cycles. It is additionally reset with a INT ACK. But if not INT ACK is present the hsync still appears every 207 clock cycles. This can not be turned off. This INT ACK reset is used for synchronization of display output only. The hsync pulse is delayed 16 clock cycles to the tv output and kept 16 clock cylces long as far as I know. It differs a bit to ZX80 logic.
The NMI is touched with every hsync pulse (synchronous). You can switch off the NMI but not the hsync.
The NMI is touched with every hsync pulse (synchronous). You can switch off the NMI but not the hsync.
- 1024MAK
- Posts: 5529
- Joined: Mon Sep 26, 2011 10:56 am
- Location: Looking forward to summer in Somerset, UK...
- Contact:
Re: ZX81 Clone
The hsync counter is a hardware divider/counter. It works completely independently of the CPU. It is always on and always counting. As Pokemon and others have said, when it overflows, it automatically resets and restarts. It is also possible to reset and restart it as described above.
Mark
Mark
ZX81 Variations
ZX81 Chip Pin-outs
ZX81 Video Transistor Amp
Standby alert 
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Spring approaching...
ZX81 Chip Pin-outs
ZX81 Video Transistor Amp


There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb

Spring approaching...
Re: ZX81 Clone
The CPU samples the interrupt
signal (INT) with the rising edge of the final clock at the end of any instruction. The
signal is not accepted if the internal CPU software controlled interrupt enable flip-flop is
not set or if the BUSREQ signal is active. When the signal is accepted, a special M1 cycle
is generated. During this special M1 cycle, the IORQ signal becomes active (instead of the
normal MREQ) to indicate that the interrupting device can place an 8-bit vector on the
data bus. Two wait states are automatically added to this cycle. These states are added so
that a ripple priority interrupt scheme can be easily implemented. The two wait states
allow sufficient time for the ripple signals to stabilize and identify which I/O device must
insert the response vector.
so the int-ack is the signal M1 = low and IORQ = low at the same time,
hope this helps
signal (INT) with the rising edge of the final clock at the end of any instruction. The
signal is not accepted if the internal CPU software controlled interrupt enable flip-flop is
not set or if the BUSREQ signal is active. When the signal is accepted, a special M1 cycle
is generated. During this special M1 cycle, the IORQ signal becomes active (instead of the
normal MREQ) to indicate that the interrupting device can place an 8-bit vector on the
data bus. Two wait states are automatically added to this cycle. These states are added so
that a ripple priority interrupt scheme can be easily implemented. The two wait states
allow sufficient time for the ripple signals to stabilize and identify which I/O device must
insert the response vector.
so the int-ack is the signal M1 = low and IORQ = low at the same time,
hope this helps
what's that Smell.... smells like fresh flux and solder fumes...
- chernandezba
- Posts: 217
- Joined: Tue Mar 11, 2014 4:30 pm
Re: ZX81 Clone
Thanks to everyone.
I didn't know that an INT ack resets the hsync counter. I will modify my emulator to follow this behaviour so maybe display will be emulated better.
Cheers
Cesar
I didn't know that an INT ack resets the hsync counter. I will modify my emulator to follow this behaviour so maybe display will be emulated better.
Cheers
Cesar