Difference between revisions of "Clock Signal"

From Emulation General Wiki
Jump to navigation Jump to search
(Having been told that it was okay to add this page despite being the emulator's author, I thought I would take the opportunity to do so.)
 
(Added license parameter to infobox.)
(35 intermediate revisions by 16 users not shown)
Line 1: Line 1:
{{Infobox
+
{{Infobox emulator
|image = CLK_(emulator)_Icon.png
+
|title        = Clock Signal
|first = 2018-03-04
+
|logo          = CLK_(emulator)_Icon.png
|second = Yes
+
|developer    = [[User:Tommy|Thomas Harte]]
|third = macOS and Linux
+
|version      = {{clkver}}
|fourth = Thomas Harte
+
|active        = Yes
|fifth = [https://github.com/TomHarte/CLK/releases Github binary releases]
+
|platform      = Linux, macOS, BSD
|sixth = [https://github.com/TomHarte/CLK Github]}}
+
|accuracy      = Subcycle
 +
|target        = [[BBC Micro emulators|Acorn Electron]], [[Amstrad CPC emulators|Amstrad CPC]], [[Apple II emulators|Apple II]], [[Atari 2600 emulators|Atari 2600]], [[ColecoVision emulators|ColecoVision]], Commodore VIC-20, [[Macintosh line|early Macintosh]], [[MSX emulators|MSX 1]], Oric 1/Atmos/Pravetz, [[SG-1000 emulators|Sega SG-1000]], [[Master System emulators|Master System]], [[Sinclair ZX81 emulators|Sinclair ZX80/ZX81]]
 +
|prog-lang    = C++; Mac bindings in Objective-C and Swift
 +
|download      = [https://github.com/TomHarte/CLK/releases Official releases] (macOS)
 +
|source        = [https://github.com/TomHarte/CLK GitHub]
 +
|license      = MIT License
 +
}}
  
'''Clock Signal''', also known as '''CLK''', is an MIT-licensed open source emulator of a collection of 8-bit computers and consoles for macOS and for Linux.
+
'''Clock Signal''', also known as '''CLK''', is an MIT-licensed open-source emulator of a collection of 8-bit computers and consoles for Linux, macOS and BSD.
  
 
It is unique in its approach to screen emulation and as a result offers worst-case video latency equal to the refresh rate of the screen on which it is being displayed — 1/60th of a second on a 60Hz monitor, 1/120th of a second on a 120Hz monitor, etc — regardless of the refresh rate of the machine being emulated.
 
It is unique in its approach to screen emulation and as a result offers worst-case video latency equal to the refresh rate of the screen on which it is being displayed — 1/60th of a second on a 60Hz monitor, 1/120th of a second on a 120Hz monitor, etc — regardless of the refresh rate of the machine being emulated.
Line 14: Line 20:
 
It is also noteworthy for the degree to which it deploys automatic analysis in an attempt automatically to launch class software: in addition to ahead-of-time static analysis, it can simply run and monitor multiple different machines or machine configurations in parallel to determine what the proper hardware configuration for a particular title should be, often offering a seamless continuous display to the user.
 
It is also noteworthy for the degree to which it deploys automatic analysis in an attempt automatically to launch class software: in addition to ahead-of-time static analysis, it can simply run and monitor multiple different machines or machine configurations in parallel to determine what the proper hardware configuration for a particular title should be, often offering a seamless continuous display to the user.
  
It generally emulates components internally at single-cycle or half-cycle precision, but seeks to decouple execution wherever possible. E.g. even if video and processor share memory which would naively imply running each component for a single cycle in a round robin fashion, the emulator actually applies something analogous to a write-through cache: the processor writing to the shared region will cause video processing to run just-in-time as though it had been interleaving reads until then.
+
It generally emulates components internally at single-cycle or half-cycle precision but seeks to decouple execution wherever possible. E.g. even if video and processor share memory which would naively imply running each component for a single cycle in a round robin fashion, the emulator actually applies something analogous to a write-through cache: the processor writing to the shared region will cause video processing to run just-in-time as though it had been interleaving reads until then.
  
 
Regardless of this, Clock Signal does not currently offer a perfect emulation of every supported machine. It is an active, developing emulator.
 
Regardless of this, Clock Signal does not currently offer a perfect emulation of every supported machine. It is an active, developing emulator.
  
 
==Display Emulation==
 
==Display Emulation==
Clock Signal's emulated machines produce a 1d video signal, just as real machines do. Its emulated display therefore has to:
+
[[File:CLK ZX80.gif|right|alt=The emulated display of a ZX80, showing accurate emulation of synchronization issues.]]
 +
Clock Signal's emulated machines produce a 1d video signal, just as real machines do. Its emulated display, therefore, has to:
 
* maintain a raster positioning;
 
* maintain a raster positioning;
 
* run sync-triggered phase-locked loops to place horizontal and vertical retraces; and
 
* run sync-triggered phase-locked loops to place horizontal and vertical retraces; and
* decode composite colour if that's what the machine is supplying.
+
* decode composite color if that's what the machine is supplying.
  
 
It uses this information to paint a virtual phosphor display — in practice just an accumulation of recently-painted material with each new painting undergoing exponential decay. Output to the host screen is simply a capture of that surface as and when the host screen requests a new frame.
 
It uses this information to paint a virtual phosphor display — in practice just an accumulation of recently-painted material with each new painting undergoing exponential decay. Output to the host screen is simply a capture of that surface as and when the host screen requests a new frame.
Line 28: Line 35:
 
An unambiguously desirable result is that machines with variable programmatic sync, such as the Atari 2600, ZX80/81 and Amstrad CPC, should produce the proper display results, even down to rolling, bouncing and other sync issues as and when the programmer diverges, even if only transiently, from PAL or NTSC timing specifications.
 
An unambiguously desirable result is that machines with variable programmatic sync, such as the Atari 2600, ZX80/81 and Amstrad CPC, should produce the proper display results, even down to rolling, bouncing and other sync issues as and when the programmer diverges, even if only transiently, from PAL or NTSC timing specifications.
  
A further positive effect is that composite video produces the proper per-platform results simply because the timing is correct: e.g. the Atari 2600 and ColecoVision produce an in-phase signal when outputting NTSC so they show obvious fixed vertical banding between strong colour transitions, but the Oric, Electron and PAL Atari are not in-phase so produce undulating diagonals at colour transitions.
+
A further positive effect is that composite video produces the proper per-platform results simply because the timing is correct: e.g. the Atari 2600 and ColecoVision produce an in-phase signal when outputting NTSC so they show obvious fixed vertical banding between strong color transitions, but the Oric, Electron and PAL Atari are not in-phase so produce undulating diagonals at color transitions.
  
The emulator goes as far as to use the Oric's original colour ROM for Oric composite video generation — it replays the actual PCM-sampled output values generated by the real machine to produce realistic colour.
+
The emulator goes as far as to use the Oric's original color ROM for Oric composite video generation — it replays the actual PCM-sampled output values generated by the real machine to produce realistic color.
  
Composite colour is optional for all machines on which it was originally optional. Machines such as the Oric, Electron and MSX originally shipped with the option of RGB output, so the emulator offers the same.
+
Composite color is optional for all machines on which it was originally optional. Machines such as the Oric, Electron, and MSX originally shipped with the option of RGB output, so the emulator offers the same.
  
 
==Sound Emulation==
 
==Sound Emulation==
Sound emulation is generally performed by internal generation of original megahertz-rate audio, which is resampled to the output frequency of the host computer. Therefore just like the video can scale up to modern low-latency high-refresh-rate displays, the audio can scale up to digital output rates such as 96Khz and 192Khz.
+
Sound emulation is generally performed by internal generation of original megahertz-rate audio, which is resampled to the output frequency of the host computer. Therefore just as the video can scale up to modern low-latency high-refresh-rate displays, the audio can scale up to digital output rates such as 96Khz and 192Khz.
  
 
Filling sound packets is an independent trigger of emulation — the emulated machines will run to make sure they're up to date when the display needs a new frame, and they'll also run to produce the next packet of audio when the previous has been consumed.
 
Filling sound packets is an independent trigger of emulation — the emulated machines will run to make sure they're up to date when the display needs a new frame, and they'll also run to produce the next packet of audio when the previous has been consumed.
  
 
That generally allows the emulator to maintain audio latency guarantees completely decoupled from the frame rate. It aims for between 5 and 10ms of audio latency.
 
That generally allows the emulator to maintain audio latency guarantees completely decoupled from the frame rate. It aims for between 5 and 10ms of audio latency.
 
==Emulated Machines==
 
* the Acorn Electron;
 
* the Amstrad CPC;
 
* the Atari 2600;
 
* the ColecoVision;
 
* the Commodore Vic-20 and C-1540;
 
* the MSX 1;
 
* the Oric 1/Atmos; and
 
* the ZX80 and ZX81.
 
  
 
==Host Environments==
 
==Host Environments==
For macOS Clock Signal is a fully-native document model application, which means that the user can simultaneously launch as many different machines as they want, sizing and positioning each independently across multiple displays, arranging their machines into a tabbed interface or performing any other standard Mac windowing actions.
+
For macOS, Clock Signal is a fully-native document model application, which means that the user can simultaneously launch as many different machines as they want, sizing and positioning each independently across multiple displays, arranging their machines into a tabbed interface or performing any other standard Mac windowing actions.
  
Clock Signal also has an SDL-based kiosk mode, which is compatible with Linux and any other target offering SDL 2.x, at least OpenGL 3.2 and C++11, and which attempts to follow ordinary UNIX conventions as to file naming and locations. It is intended to be launched however the user would normally launch something from the command-line; the target use case is to set up a file association in the user's preferred desktop environment and launch emulated applications by double clicking on them exactly like the user would launch native applications.
+
Clock Signal also has an SDL-based kiosk mode, which is compatible with Linux and any other target offering SDL 2.x, at least OpenGL 3.2 and C++11, and which attempts to follow ordinary UNIX conventions as to file naming and locations. It is intended to be launched however the user would normally launch something from the command-line; the target use case is to set up a file association in the user's preferred desktop environment and launch emulated applications by double-clicking on them exactly like the user would launch native applications.
  
 
In neither case does Clock Signal offer much in terms of appreciable interface. It currently assumes it can always determine the proper machine and machine configuration automatically based on the software the user wants to run and provides those only after the user has nominated their software.
 
In neither case does Clock Signal offer much in terms of appreciable interface. It currently assumes it can always determine the proper machine and machine configuration automatically based on the software the user wants to run and provides those only after the user has nominated their software.
 +
 +
[[Category:Atari 2600 emulators]]
 +
[[Category:ColecoVision emulators]]
 +
[[Category:Emulators]]
 +
[[Category:Linux emulation software]]
 +
[[Category:macOS emulation software]]
 +
[[Category:Multi-emulators]]
 +
[[Category:MSX emulators]]
 +
[[Category:SG-1000 emulators]]
 +
[[Category:Master System emulators]]

Revision as of 18:38, 6 August 2019

Clock Signal
CLK (emulator) Icon.png
Developer(s) Thomas Harte
Latest version 2019-09-28
Active Yes
Platform(s) Linux, macOS, BSD
Emulates Acorn Electron, Amstrad CPC, Apple II, Atari 2600, ColecoVision, Commodore VIC-20, early Macintosh, MSX 1, Oric 1/Atmos/Pravetz, Sega SG-1000, Master System, Sinclair ZX80/ZX81
Accuracy Subcycle
Download(s) Official releases (macOS)
Programmed in C++; Mac bindings in Objective-C and Swift
License MIT License
Source code GitHub

Clock Signal, also known as CLK, is an MIT-licensed open-source emulator of a collection of 8-bit computers and consoles for Linux, macOS and BSD.

It is unique in its approach to screen emulation and as a result offers worst-case video latency equal to the refresh rate of the screen on which it is being displayed — 1/60th of a second on a 60Hz monitor, 1/120th of a second on a 120Hz monitor, etc — regardless of the refresh rate of the machine being emulated.

It is also noteworthy for the degree to which it deploys automatic analysis in an attempt automatically to launch class software: in addition to ahead-of-time static analysis, it can simply run and monitor multiple different machines or machine configurations in parallel to determine what the proper hardware configuration for a particular title should be, often offering a seamless continuous display to the user.

It generally emulates components internally at single-cycle or half-cycle precision but seeks to decouple execution wherever possible. E.g. even if video and processor share memory which would naively imply running each component for a single cycle in a round robin fashion, the emulator actually applies something analogous to a write-through cache: the processor writing to the shared region will cause video processing to run just-in-time as though it had been interleaving reads until then.

Regardless of this, Clock Signal does not currently offer a perfect emulation of every supported machine. It is an active, developing emulator.

Display Emulation

The emulated display of a ZX80, showing accurate emulation of synchronization issues.

Clock Signal's emulated machines produce a 1d video signal, just as real machines do. Its emulated display, therefore, has to:

  • maintain a raster positioning;
  • run sync-triggered phase-locked loops to place horizontal and vertical retraces; and
  • decode composite color if that's what the machine is supplying.

It uses this information to paint a virtual phosphor display — in practice just an accumulation of recently-painted material with each new painting undergoing exponential decay. Output to the host screen is simply a capture of that surface as and when the host screen requests a new frame.

An unambiguously desirable result is that machines with variable programmatic sync, such as the Atari 2600, ZX80/81 and Amstrad CPC, should produce the proper display results, even down to rolling, bouncing and other sync issues as and when the programmer diverges, even if only transiently, from PAL or NTSC timing specifications.

A further positive effect is that composite video produces the proper per-platform results simply because the timing is correct: e.g. the Atari 2600 and ColecoVision produce an in-phase signal when outputting NTSC so they show obvious fixed vertical banding between strong color transitions, but the Oric, Electron and PAL Atari are not in-phase so produce undulating diagonals at color transitions.

The emulator goes as far as to use the Oric's original color ROM for Oric composite video generation — it replays the actual PCM-sampled output values generated by the real machine to produce realistic color.

Composite color is optional for all machines on which it was originally optional. Machines such as the Oric, Electron, and MSX originally shipped with the option of RGB output, so the emulator offers the same.

Sound Emulation

Sound emulation is generally performed by internal generation of original megahertz-rate audio, which is resampled to the output frequency of the host computer. Therefore just as the video can scale up to modern low-latency high-refresh-rate displays, the audio can scale up to digital output rates such as 96Khz and 192Khz.

Filling sound packets is an independent trigger of emulation — the emulated machines will run to make sure they're up to date when the display needs a new frame, and they'll also run to produce the next packet of audio when the previous has been consumed.

That generally allows the emulator to maintain audio latency guarantees completely decoupled from the frame rate. It aims for between 5 and 10ms of audio latency.

Host Environments

For macOS, Clock Signal is a fully-native document model application, which means that the user can simultaneously launch as many different machines as they want, sizing and positioning each independently across multiple displays, arranging their machines into a tabbed interface or performing any other standard Mac windowing actions.

Clock Signal also has an SDL-based kiosk mode, which is compatible with Linux and any other target offering SDL 2.x, at least OpenGL 3.2 and C++11, and which attempts to follow ordinary UNIX conventions as to file naming and locations. It is intended to be launched however the user would normally launch something from the command-line; the target use case is to set up a file association in the user's preferred desktop environment and launch emulated applications by double-clicking on them exactly like the user would launch native applications.

In neither case does Clock Signal offer much in terms of appreciable interface. It currently assumes it can always determine the proper machine and machine configuration automatically based on the software the user wants to run and provides those only after the user has nominated their software.