Im trying to get some nice colored lines on some old Z80 system synced to the PAL screen, but having some sort of a problem. First I just need to know if my facts are right.

I know that on Commodore 64 it takes 19656 cycles to complete a PAL videoframe: (63 cycles a scanline of a total 312 scanlines, gives: 63*312 = 19656 cycles). The 6502 processor is 0.985 MHz for PAL.

But What IF, my computer have a 4 Mhz Zilog Z80A CPU inside. Would an instruction that take 4 cycles run 4 times faster than an instruction running on an 1 Mhz processor?

Can I then say that I can use 256 processor cycles to complete one scanline? Instead of 64? If one scanline use 64 cycles to complete, on a Z80 system it would use 256 cycles? Or are processor cycles fixed at microseconds such that its the same amount on a PAL screen?

LDA $0000 on 6502 take 4 cycles. NOP on Zilog Z80 take 4 cycles.

but four NOPs on Z80 use the same time as one LDA $0000 on 6502?

And this is wrong or? So basically when the beam is at the leftmost position I can use 256/4 = 64 NOPS before the beam has retraced to the leftmost position again (using Zilog Z80 4MHz)? (On the C64 that would take approx 32 NOPS) Or am I missing something?

  • 1
    You can't compare Z80 clock cycles with 6502 clock cycles, because their internal "machineries" work differently. A 4 MHz Z80 is roughly comparable with a 1 MHz 6502, depending on code executed. -- It would help if you tell us about the system you are using, and to reword your post by editing to ask something that can be answered concisely. Apr 5, 2020 at 17:36
  • is there any contention present? if yes your CPU can be stopped for few T-states meanning you can not count on exact timing unless some specific conditions are met ...
    – Spektre
    Apr 8, 2020 at 13:46
  • @thebusybee What would be the point of telling what exact system I am using, you probably wouldn't have heard of it. There is not much documentation available for it. The question is specifically towards Z80A processor Apr 8, 2020 at 15:19

1 Answer 1


Z80 and 6502 are complete different CPUs in terms of clock and cycle structure. There is no sense in comparing them at this level. To solve your problem you need to focus only on your Z80 system, its instructions and their timing in relation to the video frame you want to create/manipulate.

With 4 MHz each clock cycle is 250 ns. Using this on 50 Hz 625 lines PAL, a

  • (half) Frame duration is 20 ms or 80,000 clock cycles, the
  • Active duration is 18.4 ms or 73,600 clock cycles, a
  • Line duration is 64 µs or 256 clock cycles
  • Active Line duration is 52 µs or 208 clock cycles

So waiting a whole line would be 64 NOP, or any combination of instructions adding up to 256 clock cycles.

Of course all of this depends in addition on the timing structure of your system (not all are monoton) and interference from other sources (like DMA).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .