Forum breadcrumbs - You are here:ForumGeneral: HelpZX Spectrum 48K simulation
You need to log in to create posts and topics.

ZX Spectrum 48K simulation

Page 1 of 2Next

I have notice there is a simulation for ZX Spectrum 48K. On the website is the picture which  have a composite monitor / tv  which show output. I have download and compiled latest source and run simulation, however there is no output on any composite monitor. 

What I'm missing?

There is no monitor nor tv. The video ram content can be displayed by right click on ULA ZX48k and Open MCU monitor. But I noticed that there is a problem with screen refresh.

The refresh problem can be solved editing the file:
data/Z80/ULA ZX48k/ULA ZX48k.mcu

At line 11 change "monitorscale" by "scale":

    <display name="screen" width="448" height="312" scale="2"/>

 

Anyway I will fix it in the code.

 

Thanks.  Now it works, but very slowly and screen should be 256 x 192, not 448 x 312.

First of all, speed of CPU is 3.5MHz and accordingly anything else. But here is shown it is 0MHz during simulation. And there is no way to change frequency of Z80. Frequency for different versions of Z80 goes from 2.5 to 8MHz, but here with ZX Spectrum is used one which works at 3.5MHz. Reset process until it is ready with original ZX spectrum last around 1s. 

Secondly, the same thing for ULA, there is several versions. With SZ Spectrum 16/48K is uses 5C and 6C.

And the last, keyboard. I have tried actually to type some very simple BASIC program, but that doesn't work. Basically because ZX Spectrum spending most of interrupt time scanning keyboard and since frequency is not correct, all is messed up. I have tried pressing 1,0,F in order to get 10 FOR..., but that can't be done as on real computer, actually after many times pressing I have got 0... Using PC keyboard seem is not synchronized anyway and many  keys doesn't works, even simulator shows it is pressed. 

BTW, ZX Spectrum 48 was my first home computer and I have spent a lot of time with it as a kid back in 80s , programming in BASIC and assembler as well... Quite a big nostalgia is related with. Though, real one still works without problems when I turned it on after so many decades!

More, ULA_Z80-MCU.sim1,  ULA_Z80-MCU-fast.sim1 and ULA_Z80-MCU-debug.sim1 have different keyboards. All should have ZX Spectrum keyboard.

Backspace actually stops simulator, instead to delete last token, there is no way to type "=" sight etc. Ser Sinclair's computers are unique how to type commands and special characters... It would be really great if that could be done here as well!

 

Of course it is slow, you are simulating a relatively complex circuit at 3,5 MHz.

About some points you commented:

- As vranik mentioned you are watching the video RAM, not an "screen".
- Z80 frequency is determined by whatever you put in Pin Clk.
- ULA can be configured to 5 different models.
- Keyboard is not "synchronized", it is just a subcircuit with a bunch of switches.

You need to understand that this is not the real computer nor even an emulator.
This is a circuit simulator and you are using some example circuits using Z80 and ULA components.
The purpose of a circuit simulator is to design, study and understand circuits. If you want to write and test Basic programs, better use the real computer or an emulator.

These are just example circuits using the components Z80 and ULA and a subcircuit for the keyboard.
You can create other circuits using the Z80, ULA and these keyboards or you can create your own components.

I understand upper, but still I can't believe that this is 10x slower even on 1000 times faster machines these days with half-dozen or more than a dozen multi-cores. It have to be a way to speed up all... This circuit is a bare bone form of original ZX Spectrum 48 issue 4 I have or other versions.

Though I can't see how to change frequency of CPU and I see in the code and this mcu file some 14MHz constants... A bit confusing for me, I may say...

Unfortunately a circuit simulation is an inherently sequential proccess, not well suited for parallelism.
In this case the number of cores does not help.

Unfortunately, something is problematic with ULA simulation... If I detach the component, real simulation percentage raise to 100%. When ULA is present, simulation speed is 10%.

If ULA is real chip simulation on all raw logic gate levels, I could understand why all this is so slow. Otherwise, something in the code radically slow down execution...

Page 1 of 2Next