ZX Spectrum emulator

Post screenshots, binaries and projectfiles of the projects you have made with ZGE that you want to share!

Moderator: Moderators

Post Reply
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

ZX Spectrum emulator

Post by VilleK »

This is a ZGE port of Jasper ZX Spectrum emulator: https://github.com/begoon/jasper

Features:
- Kempston joystick emulation (use a PC joypad, or cursor + ctrl keys)
- Supports .sna and .z80 format files. More available here: http://www.planetemu.net/roms/sinclair-zx-spectrum-z80

I did this project as a test to see if the ZGE scripting language is fast and powerful enough to run a emulator at full speed and I'm pleased with the results. Recent optimizations such as function inlining and switch-statement jump tables make all the difference here.
Attachments
Jasper.zgeproj
(183.8 KiB) Downloaded 505 times
zge_jsw.png
zge_jsw.png (95.83 KiB) Viewed 14140 times
User avatar
Kjell
Posts: 1876
Joined: Sat Feb 23, 2008 11:15 pm

Re: ZX Spectrum emulator

Post by Kjell »

:o

Very cool & nice benchmark! No sound though? Admittedly .. i can imagine it's a little tricky to do without being able to write to a sound buffer directly, especially when you want to for example support games that basically halt the program for a bit and write to the AY-3-8910 as fast as possible ( for rudimentary sample playback ).

K
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: ZX Spectrum emulator

Post by VilleK »

The Jasper emulator does not try to emulate sound so I didn't attempt either. And I think you are right that it would require a method of writing to the sound buffer directly.

The 48k Spectrum is a very simple device with no additional support chips so the emulator is basically just Z80 emulation together with a shader to convert the ZX Spectrum video memory layout to the screen. Later 128k Spectrum model had AY-sound chip but initially there was just a speaker with on/off control (like the original PC).

If you run exe-compressor then all this will fit in 65kb: The emulator, the 16k Spectrum ROM, a 48kb game, and the ZGE engine itself. Also a good benchmark for compactness.
User avatar
Kjell
Posts: 1876
Joined: Sat Feb 23, 2008 11:15 pm

Re: ZX Spectrum emulator

Post by Kjell »

Hej Ville,
VilleK wrote:The 48k Spectrum is a very simple device with no additional support chips so the emulator is basically just Z80 emulation together with a shader to convert the ZX Spectrum video memory layout to the screen. Later 128k Spectrum model had AY-sound chip but initially there was just a speaker with on/off control (like the original PC).
Oops .. i guess that's what i get by assuming the original ZX Spectrum even had a PSG ( and therefore Google'ing "ZX Spectrum PSG" ) :oops:

By the way, have you tried rendering to a 256×192 RenderTarget? Because of the complexity of the fragment-shader i suspect it might improve performance ( a bit ).

K
User avatar
Lupo
Posts: 76
Joined: Wed Sep 09, 2009 6:21 pm
Location: Montevideo, Uruguay

Re: ZX Spectrum emulator

Post by Lupo »

Simply amazing!!
Close, but not there yet.
Post Reply