Clock Signal: back again for the Mac and UNIX-ishes

Emulator and emulator development specific topics
Post Reply
Thommy
Posts: 45
Joined: Wed Sep 28, 2011 6:37 pm

Clock Signal: back again for the Mac and UNIX-ishes

Post by Thommy » Mon Mar 05, 2018 9:54 pm

Hi all. I wrote a ZX80/81 emulator back in 2011, of which I am sure any recollection has long ago fallen by the wayside. If you recall it at all, it might be as the emulator that burnt your CPU by simulating and propagating every single bus transition, or it might be because it was a good OS X-centric option.

I failed to keep this forum abreast of what happened next, so: what amounts to a version 2.0 is available. It's a rewrite and, nowadays, a multimachine emulator. Compared to the previous:
  • it retains the original's half-cycle timing precision and full bus communication fidelity;
  • but, it rearranges itself to talk at a higher level: partial machine cycles, not individual signal transitions;
  • it therefore communicates exactly the same quality of information and samples all the correct inputs exactly as well as it ever did, but substantially reduces your CPU's load;
  • it spends some of that saving on a full hardware-level emulation of a CRT. Composite input, flywheel syncs, the lot. Though since neither the ZX80 nor the ZX81 generate a colour burst, the signal isn't filtered all that strongly and there are no false colour artefacts. But it is low-pass filtered a little, because that's what happens in real life.
It builds for two targets: (i) macOS; and (ii) anything UNIXy with SDL 2.x and OpenGL 3.2+.

The full CRT emulation has a potentially-interesting outcome: a new frame is generated every time your computer wants one. Each frame is different, just like it would be if you pointed a high-refresh-rate video camera at a CRT.

This means:
  • no emulator-classic judder as the fiction of pushing a whole frame at a time causes a 50Hz to your display mapping that, if it's 60Hz, just shows every fifth frame twice; and
  • if you're a gaming type who obsesses about latency to the extent of having bought a 120Hz or a 144Hz monitor, this emulator will accordingly benefit. Get a full 120 or 144 distinct frames a second. Have a video latency of only 1/120th or 1/144th of a second.
The macOS version is an idiomatic macOS document-centric application although possibly a little old-school in not having a forced welcome dialogue. So when you launch it, you'll not be presented with anything really. Use File->Open... to open a tape image and a corresponding ZX80 or ZX81 will launch with the media inserted and load it. Though it's not quite smart enough to RUN yet. So work to do. You know what you're doing, I trust you.

Run as many ZX80s and ZX81s as you like at the same time. Put them on various screens. Put them into tabs. Have fun.

The SDL version is primarily intended for launching from the command-line. I expect people to associate it with the appropriate file type — O, P or TZX [EDIT: and CSW] — then just double click to launch the ZX80 or ZX81 software. Like there's no emulator at all. You want to run a piece of classic software so you launch it exactly like any other piece of software. No additional level of indirection as you launch an emulator and navigate.

There are a bunch of other machines supported, all 6502 or Z80s at the minute, and it's in its third year of active development so feedback is likely to be acted upon.

It would also be greatly appreciated.

EDIT: having failed to record any videos lately, here's an animated GIF of the emulated ZX80 that I happen to have posted elsewhere:
Image
That hopefully demonstrates what I'm talking about re: CRT emulation. You'll notice that other things come for free, such as having the proper pixel aspect ratio. And don't worry! Since it is a real emulation of the real electronics, the ZX81 doesn't bounce around. It's not some subjective post hoc effect, it's just the emulated CRT trying to regain synchronisation after the emulated ZX80 introduces an abrupt phase change.

User avatar
sirmorris
Posts: 2821
Joined: Thu May 08, 2008 5:45 pm
Location: oxon, uk

Re: Clock Signal: back again for the Mac and UNIX-ishes

Post by sirmorris » Mon Mar 05, 2018 11:07 pm

Welcome back Thommy! I've actually been keeping an eye on your most impressive work for a long while now. I'm often found over at *. and seeing as I like my emulators minimal and potentially seizure-inducing - well there was only one choice really. As a Mac owner I've built from source a few times and tried my best to understand how it works but I value my sanity so I try and limit my examinations to a couple of lines of code per night :lol:
--=== ZXpand+ ... A more moderner all-in-one upgrade solution for ZX81 ===--
* SD/MMC storage * 32K Hires-capable RAM * AY sound chip * Joystick port * Serial *
* BASIC enhancements - plug & play * Reset button * Auto-boot facility *

McKlaud
Posts: 107
Joined: Tue Dec 19, 2017 10:02 pm
Location: St Albans, UK

Re: Clock Signal: back again for the Mac and UNIX-ishes

Post by McKlaud » Mon Mar 05, 2018 11:15 pm

As OS X user I am glad that this emulator exists :) Nice work.
Claudius
----------

Thommy
Posts: 45
Joined: Wed Sep 28, 2011 6:37 pm

Re: Clock Signal: back again for the Mac and UNIX-ishes

Post by Thommy » Mon Mar 05, 2018 11:30 pm

sirmorris wrote:
Mon Mar 05, 2018 11:07 pm
Welcome back Thommy! I've actually been keeping an eye on your most impressive work for a long while now. I'm often found over at *. and seeing as I like my emulators minimal and potentially seizure-inducing - well there was only one choice really. As a Mac owner I've built from source a few times and tried my best to understand how it works but I value my sanity so I try and limit my examinations to a couple of lines of code per night :lol:
In that case I apologise for the relatively fast code churn; the recent addition of dynamic analysis in particular has had quite a seismic effect, not to mention the liberalisation of audio processing before that. Neither of which is ZX80/81-relevant, other than that I really should go back and add ZonX support because it'd be really easy now.

Also I should check out whether any of the SID add-ons every gained traction. I've had my eye off the ball.
McKlaud wrote:
Mon Mar 05, 2018 11:15 pm
As OS X user I am glad that this emulator exists :) Nice work.
Thanks! My obsession with minimalism is a good match for the Mac, I think. No need to set up any file associations manually even on the Mac, and all normal manipulations should work. Double click a tape image if it isn't associated with something else, drag and drop onto the Dock icon, etc.

Oh, and the secret one I always forget: drag and drop a piece of media onto a running machine to insert it into that machine. It doesn't even matter if it's for a different machine as long as it can physically fit. So if you ever wanted to test your ZX81 code for reading Commodore, Oric, MSX or Acorn-format tapes, or any other that you have encoded as CSW or TZX, have fun. There's no inherent coupling between file formats and machines, just an analyser that inspects them for a machine type if it is expected to create a new one.

Thommy
Posts: 45
Joined: Wed Sep 28, 2011 6:37 pm

Re: Clock Signal: back again for the Mac and UNIX-ishes

Post by Thommy » Wed Mar 07, 2018 10:55 pm

Quick minor update: as I thought I would quickly be able to do, I've added ZON X support to the emulated ZX81. Binaries and source code available as usual.

It should be cycle perfect, actually internally generating an audio wave at 1.625Mhz and then resampling it. So I'm optimistic of no aliasing or other approximation errors. But, as ever, we'll see.

I'm going to have a bit of a think about Quicksilva support since that obviously requires more selectivity in when it should be enabled but hopefully I'll work something out.

EDIT:
A Youtube video of the emulator in action. It seems that as soon as I start screen recording there is no game that I cannot lose in two minutes or less.

Also: some ZX80 and ZX81 hardware documentation I wrote while producing the emulator. In case that helps add to the sum total.

User avatar
sirmorris
Posts: 2821
Joined: Thu May 08, 2008 5:45 pm
Location: oxon, uk

Re: Clock Signal: back again for the Mac and UNIX-ishes

Post by sirmorris » Sat Apr 14, 2018 8:28 am

It looks like something I'm doing in BiggOil upsets Clock Signal. Let me know if there's anything you would like from me if you choose to investigate.

C
--=== ZXpand+ ... A more moderner all-in-one upgrade solution for ZX81 ===--
* SD/MMC storage * 32K Hires-capable RAM * AY sound chip * Joystick port * Serial *
* BASIC enhancements - plug & play * Reset button * Auto-boot facility *

Post Reply