Emulator accuracy = 99.9%

Probably the best thing to do is compare some of the more difficult / 'weird' corner cases with how they work on a real ZX81 (if possible, preferably on a CRT monitor). A few examples:
- That little proggie where you have "ZX81" text + dotted border around it. On a real ZX81 it's a stable image, but bobbing up & down 1 pixel. Tbh I have NO IDEA what that proggie does exactly, and so far haven't seen a ZX81 emulator that shows it the exact same as on a real ZX81. So I wouldn't worry too much about it.
- That clckfreq proggie is a good check whether screen lines & frames take the same # of clock cycles as on a real ZX81. If you've got your logic / emulation correct, you WILL get the exact # of frames taken, and 100% speed as output. If not, there is still something that's not quite right (however small / unimportant).
- A fish+shark simulation named Wa-Tor has a hi-res title screen, with the bottom few character rows a bit 'pulled' to one side. Again, some emulators show this effect somehow, but perfection seems impossible...

That's not correct! Yes you have a free-running counter that generates a horizontal sync pulse every 207 cycles. But a Z80 interrupt acknowledge (Z80 /IORQ and /M1 active at the same time, see Z80 databooks) resets this counter as well. From what I've read, Grant Searle (zx80nut on this forum) discovered that the hardware-generated hsync pulse starts ~16 clocks after an interrupt acknowledge resets this counter. I suspect that ~16 clocks number isn't too important, but that there's another reset condition besides reaching a max count, IS. This is exactly the kind of thing that allows software to fiddle with the sync signal in ways that produce interesting effects on monitors, but keep syncs juuust constant enough that a monitor doesn't lose sync.olofsen wrote:Even the number of tstates per scanline in the screen is variable; I think because the "207 counter" as discussed on this forum is always free running - it is not reset by the INT ACK, (..)
For details on this issue, some good reading starts here.
Btw. is there some way to run alternative ZX81 ROMs and not have them 'patched' in any way by the emulator? (for intercepting tape loads, or similar purposes). In particular I'm thinking about some Forth ROMs that take the place of the original ZX81 ROM, and come with their own display + tape routines. On this emulator, such ROMs produce random results, read: don't work. Another emulator I have here (xz81) has some command line options that disable the tape load patching. Which does allow those ROMs to work.
System used for compile & tests:
Up-to-date Debian "testing"
GCC version 5.2.1
libsdl 1.2.15
Linux kernel 4.1.0-2-amd64