{"id":14965059,"url":"https://github.com/deanthecoder/zxspeculator","last_synced_at":"2025-07-15T10:05:11.984Z","repository":{"id":213581106,"uuid":"729950796","full_name":"deanthecoder/ZXSpeculator","owner":"deanthecoder","description":"Cross-platform ZX Spectrum emulator written in C#","archived":false,"fork":false,"pushed_at":"2024-10-13T15:36:11.000Z","size":33085,"stargazers_count":94,"open_issues_count":7,"forks_count":8,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-06T21:16:40.957Z","etag":null,"topics":["avalonia","avalonia-ui","avaloniaui","emulation","retro","spectrum","z80","zx-spectrum","zx-spectrum-emulator","zxspectrum"],"latest_commit_sha":null,"homepage":"https://github.com/deanthecoder/ZXSpeculator","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/deanthecoder.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-10T20:59:36.000Z","updated_at":"2025-04-05T08:29:46.000Z","dependencies_parsed_at":"2024-03-01T13:44:13.966Z","dependency_job_id":"54534e2d-5fd9-4748-9ef8-7376d60f1a94","html_url":"https://github.com/deanthecoder/ZXSpeculator","commit_stats":{"total_commits":225,"total_committers":3,"mean_commits":75.0,"dds":"0.013333333333333308","last_synced_commit":"70786d3c659133ac69c61d5023a444575ecf07df"},"previous_names":["deanthecoder/zxspeculator"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deanthecoder%2FZXSpeculator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deanthecoder%2FZXSpeculator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deanthecoder%2FZXSpeculator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deanthecoder%2FZXSpeculator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deanthecoder","download_url":"https://codeload.github.com/deanthecoder/ZXSpeculator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247550690,"owners_count":20956987,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["avalonia","avalonia-ui","avaloniaui","emulation","retro","spectrum","z80","zx-spectrum","zx-spectrum-emulator","zxspectrum"],"created_at":"2024-09-24T13:34:09.771Z","updated_at":"2025-06-13T05:39:28.526Z","avatar_url":"https://github.com/deanthecoder.png","language":"C#","readme":"[![Twitter URL](https://img.shields.io/twitter/url/https/twitter.com/deanthecoder.svg?style=social\u0026label=Follow%20%40deanthecoder)](https://twitter.com/deanthecoder)\n# ZX Speculator\nZX Speculator is a cross-platform ZX Spectrum 48K emulator written in C#.\n![Main UI](img/MainUI.png?raw=true \"Main UI\")\n\n## Features\n- **Cross Platfom**: Built using [Avalonia](https://avaloniaui.net/), ensuring compatibility across various platforms.\n- **Key Mapping**: Most keys on a modern PC keyboard are automatically mapped to the Spectrum, making it much easier to type in code.\n- **File Format Support**: Compatible with .z80, .bin, .scr, .tap, and .sna files.\n- **Archive Support**: Load files directly from `.zip` archives.\n- **Display**: Optional CRT TV and 'Ambient Blur' effects. ![CRT](img/CRT.png)\n- **Joysticks**: Kempston and Cursor joystick support.\n- **Sound**: Utilizes [OpenAL](https://www.openal.org/) on Mac and Windows for sound emulation.\n- **Integrated Debugger**: Includes a built-in debugger for examination of the Z80 CPU state, including:\n  - Instruction stepping.\n  - Breakpoints.\n  - Instruction history.\n- **Rollback**: Die in your favourite game? Accidentally delete a line of code? Continuous recording allows you to 'roll back' to an earlier time. (`F1` will roll back 5 seconds.)\n![Rollback](img/Rollback.png)\n- **Theming**: The Sinclair BASIC ROM can be customized to allow for:\n  - Classic ZX Spectrum input vs a per-character typing strategy. (Courtesy of the [JGH Spectrum 48K ROM](http://mdfs.net/Software/Spectrum/Harston) by J.G.Harston)\n  - Selectable colors schemes and fonts.\n    - ZX Spectrum\n    - BBC Micro\n    - Commodore 64\n![Speccy Theme](img/Theme_Speccy.png)\n![BBC Micro Theme](img/Theme_BBC.png)\n![Commodore 64 Theme](img/Theme_C64.png)\n\n## Download\n* Download from the [Releases](https://github.com/deanthecoder/ZXSpeculator/releases) section.\n* Mac users may need to run the following command to unblock the application:\u003cbr\u003e`xattr -d com.apple.quarantine /Applications/ZX\\ Speculator.app`\n\n## Development and Testing\nDeveloped on a Mac environment, ZX Speculator is also tested on Windows and passes all the ZEXDOC tests and FUSE emulator tests.\n![Jetpac published by Ultimate Play the Game](img/Jetpac.png?raw=true \"Jetpac\")\n\n## Getting Started\n### Loading Files\nCommon ZX Spectrum image files (.z80, .sna, etc) can be opened from the File-\u003eOpen menu.\n\n### Loading .tap Files\n1. Type `Load \"\"` in BASIC.\n2. The File-\u003eOpen dialog will automatically open, allowing a .tap file to be specified.\n3. Enjoy the loading experience.\n\n### Keyboard\nMove the mouse pointer to the small keyboard icon at the top-right of the screen to see a representation of the ZX Spectrum keyboard.\n![Keyboard](img/Keyboard.png?raw=true \"Keyboard\")\nMany keys on a modern keyboard are automatically mapped to their ZX Spectrum equivalent.  For example, backspace, quotes, math symbols etc.\n\nThe left shift key maps to **CAPS SHIFT** on the Spectrum, and the right shift key maps to **SYMBOL SHIFT**.\n\nESCape will reset the machine.\n\n### Joystick\nThe emulator will mimic either a Kempston or Cursor joystick.\n\nIn both cases the keyboard arrow keys are used for direction control, and the backslash or backtick keys will 'fire'.\n\n## Building From Source\n### Prerequisites\n- .NET compatible IDE, such as [JetBrains Rider](https://www.jetbrains.com/rider/) or [Visual Studio 2022](https://visualstudio.microsoft.com/vs/).\n- Basic knowledge of C# and emulation concepts.\n\n### Setup\nThe project is provided as C# source code:\n1. Clone the repository from GitHub.\n2. Open the solution (`Speculator.sln`) in your preferred IDE.\n3. Build and run the application.\n\n## Videos\nThere's a [YouTube playlist](https://www.youtube.com/playlist?list=PLPA1ndSnAZTwt7cQjDNwwsPjS89Dd3yqv) showing some classic games played in the emulator.\n![](img/ManicMiner.png)\n![](img/ChuckieEgg.png)\n![](img/BoulderDash.png)\n![](img/Tapper.png)\n\n## Experiments - Raytracer\nAs my other hobby is writing GLSL shaders on [ShaderToy](https://www.shadertoy.com/user/dean_the_coder) (See [here](https://github.com/deanthecoder/GLSLShaderShrinker) for my GLSL Shader Shrinker application), I thought it'd be interesting to try a 'cross over' project.\n\nI've taken inspiration from the [Human Shader](https://humanshader.com/) project and recreated the algorithm using ZX Spectrum BASIC, using this emulator.\n\nHere's the result:\n![](Experiments/HumanShader/Pass3_AdvancedDither.png)\nEarlier version, with a basic dither:\n![](Experiments/HumanShader/Pass2_BasicDither.png)\nFirst iteration: Solid blocks:\n![](Experiments/HumanShader/Pass1_Rough.png)\nI've included a `.sna` snapshot of the code [here](Experiments/HumanShader/HumanShader.sna).\n![](Experiments/HumanShader/Code.png)\n\n# Experiments - Conway's Game Of Life\nI realized I had never written a [Conway's Game Of Life](https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life), so decided to make one using the emulator.\n\nPerformance in this BASIC version isn't great... (See [here](Experiments/GameOfLife/Conway.sna) - Requires the JGH ROM)\n![](Experiments/GameOfLife/GameOfLife.png)\n\n...so I rewrote it in C, compiled into Z80 machine code ([here](Experiments/GameOfLife/Conway.tap)).  Muuuch faster!\n![](Experiments/GameOfLife/GameOfLifeC.png)\n\n# Experiments - Retro Fire\nC compiled into Z80 machine code ([here](Experiments/FireFX/fire.tap)). Too slow to call 'real time', but not bad for the Speccy.\n![](Experiments/FireFX/Fire.png)\n\n# Experiments - The Matrix\nC compiled into Z80 machine code ([here](Experiments/TheMatrix/matrix.tap)). This one runs in real time, which surprised me.\n\nI first populate the entire screen with characters (black on black), then build up a 768 element array of color values with a repeated sequence ranging from green to bright green, white to bright white.\n\nThis array is then used to set the colors on the screen, and a `memmove` command is used to scroll the buffer by one byte. This keeps the framerate up as it's only the color attributes that change - Not the characters on the screen.\n![](Experiments/TheMatrix/TheMatrix.png)\n\n# Experiments - 10PRINT\nC compiled into Z80 machine code ([here](Experiments/10print/10print.tap)).\n\nThe screen is filled with forward and backslashes (Drawn with a small gap in my case), then I randomly fill areas of the screen.  Quite relaxing to watch!\n![](Experiments/10print/10print.png)\n\n# Experiments - Sandy Situation\nC compiled into Z80 machine code ([here](Experiments/Sand/sand.tap)).\n\nIterating over a fixed number of grains, advancing each depending on what is below them. I did try a different approach of iterating through all cells in an x/y grid which worked well, but wasn't anywhere near as performant.\n\nI'm making use of the [z88dk](https://z88dk.org/site/)'s 'chunky' pixel blitting routines too.\n![](Experiments/Sand/Sand.png)\n\n# Experiments - Twister\nPushing my graphical skills on the ZX Spectrum, resulting in the creation of a classic 'twister' effect. The code is written in C and compiled into Z80 machine code ([here](Experiments/Twister/twister.tap)) - Needed to keep the performance up.\n\nThe twister effect, a staple of early computer graphics and demoscene productions, seemed like the perfect challenge - I've always wanted to make one of these but never got round to it. Helped with details from [8bitshack](https://8bitshack.org/post/twister/).\nIt takes a while to complete the precaching, but I like the result.\n![](Experiments/Twister/Twister.png)\n\n# Experiments - Breakout\nTwo balls fighting for dominance! I saw an effect similar to this on Twitter and thought it was a great idea.\nA little more of a 'demo-style' with this one - I've added a DTC logo (which I'll developed more in the future).\n\nThe code is written in C and compiled into Z80 machine code ([here](Experiments/BreakOut/breakout.tap)).\n![](Experiments/BreakOut/Breakout.png)\n\n# Experiments - One Small Step\nThis is based on a GLSL [shader](https://www.shadertoy.com/view/tt3yRH) I wrote a while ago. I built a library of GLSL-like functions in C to recreate the original code, then ran it over many hours.\n\nThe final quality was achieved with a Floyd-Steinberg dithering algorithm. A random dither is much easier to implement, but the result was way too noisy.\n\nThe executable is [here](Experiments/OneSmallStep/OneSmallStep.tap).\n![](Experiments/OneSmallStep/OneSmallStep.png)\n\n## Contribution and Improvements\nZX Speculator is an ongoing project and contributions are welcome. Whether it's improving emulation accuracy, testing on different platforms, or enhancing existing features, your input is valuable (although I can't always promise a fast response, as this is a side project).\n\n## Credits\n[Flux Capacitor icon](https://www.onlinewebfonts.com/icon) licensed by CC BY 4.0.\n\n## Useful Resources\n- [The Undocumented Z80 Documented](http://www.z80.info/zip/z80-documented.pdf)\n- [Z80 Undocumented Instructions (World Of Spectrum)](https://worldofspectrum.org/z88forever/dn327/z80undoc.htm)\n- [ClrHome's Z80 Opcode Table](https://clrhome.org/table/#%20)\n- [ZX Spectrum Keyboard Cheat Sheet](http://slady.net/Sinclair-ZX-Spectrum-keyboard/)\n- [Z80 Instruction Exerciser (zexall, zexdoc)](https://mdfs.net/Software/Z80/Exerciser/Spectrum/)\n- [JSMoo Z80 tests](https://github.com/raddad772/jsmoo/tree/main/misc/tests/GeneratedTests/z80)\n- [JGH Spectrum 48K ROM](http://mdfs.net/Software/Spectrum/Harston) by J.G.Harston.\n- [z88dk C to z80 compiler](https://z88dk.org/site/)\n---\nFeel free to follow me on Twitter for more updates: [@deanthecoder](https://twitter.com/deanthecoder)","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeanthecoder%2Fzxspeculator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeanthecoder%2Fzxspeculator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeanthecoder%2Fzxspeculator/lists"}