Exact emulation of the Snow effect.

Struggling with Fuse or trying to find an emulator with a specific feature. Ask your questions here.
User avatar
Weiv
Microbot
Posts: 178
Joined: Fri Apr 06, 2018 5:28 pm
Location: Ukraine

Re: Exact emulation of the Snow effect.

Post by Weiv »

In my yesterday's test border color indicates current upper page number, paper color indicates active screen (0 - cyan, 1 - white), ink color indicates from what page the snow bytes are fetched.

So we see the test results in the table below. In this table rows mean upper page number, columns mean active screen number, table cells mean from what page the snow bytes are fetched.

Code: Select all

Upper Page     Screen 0(page 5)             Screen 1(page 7)
    1                1                           3 
    3                1                           3
    5                5                           7 
    7                5                           7
Thank you again, @TheMartian !
TheMartian
Microbot
Posts: 107
Joined: Wed Feb 03, 2021 5:18 am

Re: Exact emulation of the Snow effect.

Post by TheMartian »

I was thinking this:
As VELESOFT said, in 128K machines we've got the HAL which gives us these equations:

ULA15 = A15 & !A14 | A15 & A14 & !B0 -> '1' if 8000-BFFF or C000-FFFF on RAM 0,2,4,6 -> That's UNCONTENDED RAM.
ULA14 = !A15 & A14 | A15 & A14 & B0 -> '1' if 4000-7FFF or C000-FFFF on RAM 1,3,5,7 -> That's CONTENDED RAM.

These two lines are fed to the contention manager in the ULA, so it works when ULA15 = 0, ULA14 = 1. This allows for using the same old 48K contention manager on 128K machines.
ULA15 is also fed to the PCF, as it is the A15 line for uncontended RAM. (It looks like RAM is placed in the 4164 chips in order 0,4,2,6).

UA15 = A15 & !A14 | A15 & A14 & !B0 & B1 -> '1' if 8000-BF00 or C000-FFFF on RAM 2,6
UA14 = A15 & A14 & !B0 & B2 -> '1' if C000-FFFF on RAM 4,6.

These two are only fed to the PCF, so I guess these are only relevant for uncontended RAM.

VA15 = A15 & A14 & B0 & B1 -> '1' if C000-FFFF on RAM 3,7.
VA14 = !A15 & A14 | A15 & A14 & B0 & B2 -> '1' on 4000-7FFF or C000-FFFF on RAM 5,7

VA15 and VA14 are only fed to the IC30, which is a 74LS157 selector. The output goes to the bit A7 in the RAM chips. VA15 is output on RAS = '0', VA14 is output on RAS = '1'. (I'm assuming that the ULA generates all RAS/CAS signals for contended RAM).

So we have that, during RAS low, A7-A0 to the RAM are (VA15,A6-A0); during RAS high (?) A7-A0 are VA14,A13-A7.

ULA pins DMA7-0 and RAS# are tri-state, so when the ULA is not reading video they are disconnected and the signals in the RAM pins come from PCF/HAL. There are also resistors; the level in the RAM pins is the one from the ULA, not the PCF, in case of conflict.

Now there is something I don't understand: If the snow effect is still caused by having a wrong latched row address (in this case, VA15,A6-A0), why in Ninja Hamster do we keep getting snow from page 1 even if page 3 is in?
User avatar
Weiv
Microbot
Posts: 178
Joined: Fri Apr 06, 2018 5:28 pm
Location: Ukraine

Re: Exact emulation of the Snow effect.

Post by Weiv »

@balford confirmed during running my tests on his machines that on some 128 machines the snow leads to crash, but on some of them it does not.
User avatar
1024MAK
Bugaboo
Posts: 3151
Joined: Wed Nov 15, 2017 2:52 pm
Location: Sunny Somerset in the U.K. in Europe

Re: Exact emulation of the Snow effect.

Post by 1024MAK »

Weiv wrote: Wed Apr 05, 2023 5:29 pm @balford confirmed during running my tests on his machines that on some 128 machines the snow leads to crash, but on some of them it does not.
Did he investigate any further, such as what the mechanism was that actually caused it?

Mark
:!: Standby alert :!:
“There are four lights!”
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb :dance
Looking forward to summer later in the year.
User avatar
Weiv
Microbot
Posts: 178
Joined: Fri Apr 06, 2018 5:28 pm
Location: Ukraine

Re: Exact emulation of the Snow effect.

Post by Weiv »

1024MAK wrote: Wed Apr 05, 2023 5:52 pm Did he investigate any further, such as what the mechanism was that actually caused it?

Mark
As far I know he did not, so did I. Apparently the hardware reasons that lead to snow also lead to crash on some machines. The same test was crashed on one 128 machine and went ok on another one.
Last edited by Weiv on Wed Apr 05, 2023 6:19 pm, edited 4 times in total.
User avatar
Weiv
Microbot
Posts: 178
Joined: Fri Apr 06, 2018 5:28 pm
Location: Ukraine

Re: Exact emulation of the Snow effect.

Post by Weiv »

Interesting thing that the snow reasons lead to crash on early +2A/+3 (but without the snow itself) as I found out recently.
User avatar
1024MAK
Bugaboo
Posts: 3151
Joined: Wed Nov 15, 2017 2:52 pm
Location: Sunny Somerset in the U.K. in Europe

Re: Exact emulation of the Snow effect.

Post by 1024MAK »

For the 128K toastrack, what would be interesting, would be to swap the PAL 10H8 (IC29) between a machine that crashes and a machine that does not. Then retesting to see if the results were different or if they are the same.

Also, if a PAL 10H8 is found to be the reason, to try it in a +2 (grey) in position IC7.

Mark
:!: Standby alert :!:
“There are four lights!”
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb :dance
Looking forward to summer later in the year.
User avatar
Weiv
Microbot
Posts: 178
Joined: Fri Apr 06, 2018 5:28 pm
Location: Ukraine

Re: Exact emulation of the Snow effect.

Post by Weiv »

1024MAK wrote: Wed Apr 05, 2023 6:27 pm For the 128K toastrack, what would be interesting, would be to swap the PAL 10H8 (IC29) between a machine that crashes and a machine that does not. Then retesting to see if the results were different or if they are the same.

Also, if a PAL 10H8 is found to be the reason, to try it in a +2 (grey) in position IC7.

Mark
I can only share the videos that @balford made for me:
User avatar
Pegaz
Dynamite Dan
Posts: 1210
Joined: Mon Nov 13, 2017 1:44 pm

Re: Exact emulation of the Snow effect.

Post by Pegaz »

That Balford test on 48k model (second video), shows a very different pattern than my test from a couple of years ago, with plain 48k rubber Speccy issue 3.
It was loaded directly through the audio jack, without any peripherals attached (like divide etc).

btw, in the meantime I tried the latest SpecIde windows build from 07/10 last year and it shows a nice snow effect in Ninja Hamster, as well as in this latest test example.
It may not be quite perfect as in the latest development, but it is very close.
Obviously, at the moment, we don't seem to have an emulator running all these tricky tests.
Spin and SpecEmu support ULA artifacts, but the snow effects arent as good, as in SpecIde for example.
Also, theres a game "Chromatrons Attack", I can't remember which emulator supports it, but it doesn't work well on most of them.
https://csscgc2013.blogspot.com/2013/06 ... ttack.html
There are certainly other examples, but this is the most common difference I notice between good and highly accurate emulators...
Last edited by Pegaz on Wed Apr 05, 2023 8:48 pm, edited 1 time in total.
User avatar
Pegaz
Dynamite Dan
Posts: 1210
Joined: Mon Nov 13, 2017 1:44 pm

Re: Exact emulation of the Snow effect.

Post by Pegaz »

...and yes, this emulator should support Chromatrons Attack:
https://github.com/ec429/spiffy
User avatar
Weiv
Microbot
Posts: 178
Joined: Fri Apr 06, 2018 5:28 pm
Location: Ukraine

Re: Exact emulation of the Snow effect.

Post by Weiv »

Pegaz wrote: Wed Apr 05, 2023 8:41 pm That Balford test on 48k model (second video), shows a very different pattern than my test from a couple of years ago, with plain 48k rubber Speccy issue 3.
It's my modifications of the Hikaru's snow test on balford's videos.
Obviously, at the moment, we don't seem to have an emulator running all these tricky tests. Spin and SpecEmu support ULA artifacts, but the snow effects arent as good, as in SpecIde for example.
My emulator ZX Miracle runs all the snow tests ok of course. Also the newest version of SpecEmu.
Also, theres a game "Chromatrons Attack", I can't remember which emulator supports it, but it doesn't work well on most of them.
https://csscgc2013.blogspot.com/2013/06 ... ttack.html
That's the thing I still can't do for now.
User avatar
Pegaz
Dynamite Dan
Posts: 1210
Joined: Mon Nov 13, 2017 1:44 pm

Re: Exact emulation of the Snow effect.

Post by Pegaz »

Weiv wrote: Wed Apr 05, 2023 9:04 pmMy emulator ZX Miracle runs all the snow tests ok of course. Also the newest version of SpecEmu.
Strange, I use Specemu version from 25/03, but Ninja Hamster doesnt show the snow effect...
Snow option is enabled, ofc.
User avatar
Weiv
Microbot
Posts: 178
Joined: Fri Apr 06, 2018 5:28 pm
Location: Ukraine

Re: Exact emulation of the Snow effect.

Post by Weiv »

Pegaz wrote: Wed Apr 05, 2023 9:23 pm Strange, I use Specemu version from 25/03, but Ninja Hamster doesnt show the snow effect...
Snow option is enabled, ofc.
It's today's version, I saw only video from it)
User avatar
Pegaz
Dynamite Dan
Posts: 1210
Joined: Mon Nov 13, 2017 1:44 pm

Re: Exact emulation of the Snow effect.

Post by Pegaz »

Weiv wrote: Wed Apr 05, 2023 9:37 pm It's today's version, I saw only video from it)
Thanks, apparently Woody hasn't made it public yet.
btw, I wrote before that newer versions of SpecEmu do not support all ULA artifact test programs.
Most of them works, but these two do not work well, on revisions in the last couple of years.
https://easyupload.io/6jex4p
User avatar
Weiv
Microbot
Posts: 178
Joined: Fri Apr 06, 2018 5:28 pm
Location: Ukraine

Re: Exact emulation of the Snow effect.

Post by Weiv »

Pegaz wrote: Thu Apr 06, 2023 8:55 am Thanks, apparently Woody hasn't made it public yet.
btw, I wrote before that newer versions of SpecEmu do not support all ULA artifact test programs.
Most of them works, but these two do not work well, on revisions in the last couple of years.
https://easyupload.io/6jex4p
Well, my emulator ZX Miracle emulates them a bit better than SpecEmu)
User avatar
Pegaz
Dynamite Dan
Posts: 1210
Joined: Mon Nov 13, 2017 1:44 pm

Re: Exact emulation of the Snow effect.

Post by Pegaz »

That's a good thing.
ZX Spin also emulates this, better than SpecEmu.
I hope SpecIde also gets support for this ULA behavior soon.
Here's what your test looks like on last year's build.
If I understood correctly, Marta has a fixed version, but it must be compiled from source.

Image
User avatar
Weiv
Microbot
Posts: 178
Joined: Fri Apr 06, 2018 5:28 pm
Location: Ukraine

Re: Exact emulation of the Snow effect.

Post by Weiv »

Pegaz wrote: Thu Apr 06, 2023 11:27 am That's a good thing.
ZX Spin also emulates this, better than SpecEmu.
ZX Miracle emulates ULA artefacts better than ZX Spin, actually I think there are no emualtors for now that emulate flash stripes right except mine.
TheMartian
Microbot
Posts: 107
Joined: Wed Feb 03, 2021 5:18 am

Re: Exact emulation of the Snow effect.

Post by TheMartian »

I think I'm retiring for some time from the road of the 100% exact snow effect in the upper pages. :lol:

The reason is, my 128K Toastrack is acting weird after the testing session yesterday :lol: (Not complaining about your test, @Weiv, it was a bit unstable before, but keep in mind that memory addresses come both from the ULA and the PCF *at the same time* with only a resistor in between, so let's better not burn Speccies to build emulators... be careful, my friends :lol:)

SpecIde already has 100% accuracy in snow effect in 48K mode, and it is quite close to it in 128K mode. From @Weiv's test and from my analysis of the schematics we've got from which page the data is coming, and I'm uploading my changes for that today. @Pegaz, I'll try to provide Windows builds this weekend. :smile:

I'll try to focus on other functionalities I intend to add to the emulator. Betadisk, a decent UI, a debugger, better Amstrad CPC emulation...
TheMartian
Microbot
Posts: 107
Joined: Wed Feb 03, 2021 5:18 am

Re: Exact emulation of the Snow effect.

Post by TheMartian »

(I think I've got PCF, ULA, and memory replacement chips, so it should be okay...)
User avatar
Pegaz
Dynamite Dan
Posts: 1210
Joined: Mon Nov 13, 2017 1:44 pm

Re: Exact emulation of the Snow effect.

Post by Pegaz »

TheMartian wrote: Thu Apr 06, 2023 12:34 pmSpecIde already has 100% accuracy in snow effect in 48K mode, and it is quite close to it in 128K mode. From @Weiv's test and from my analysis of the schematics we've got from which page the data is coming, and I'm uploading my changes for that today. @Pegaz, I'll try to provide Windows builds this weekend. :smile:

I'll try to focus on other functionalities I intend to add to the emulator. Betadisk, a decent UI, a debugger, better Amstrad CPC emulation...
Thank you very much, I really look forward to try the latest build of your great emulator. :)
User avatar
Weiv
Microbot
Posts: 178
Joined: Fri Apr 06, 2018 5:28 pm
Location: Ukraine

Re: Exact emulation of the Snow effect.

Post by Weiv »

TheMartian wrote: Thu Apr 06, 2023 12:34 pm I think I'm retiring for some time from the road of the 100% exact snow effect in the upper pages. :lol:

The reason is, my 128K Toastrack is acting weird after the testing session yesterday :lol: (Not complaining about your test, @Weiv, it was a bit unstable before, but keep in mind that memory addresses come both from the ULA and the PCF *at the same time* with only a resistor in between, so let's better not burn Speccies to build emulators... be careful, my friends :lol:)
I'm sorry if my test damaged your Speccy :( I was not awared about such possibility.

Seems like nobody will run my tests anymore)
User avatar
1024MAK
Bugaboo
Posts: 3151
Joined: Wed Nov 15, 2017 2:52 pm
Location: Sunny Somerset in the U.K. in Europe

Re: Exact emulation of the Snow effect.

Post by 1024MAK »

Bus contention (where more than one chip is driving a bus) should not damage any chips as long as the ULA and hence the Z80 clocks are running. As any contention will only last for a very, very short time.

And the data bus has resistors which limit the current flow. In any case, normal operation of a 16K/48K/+/128K/+2 (grey) includes the Z80 accessing either ROM or non-contended RAM at the same time that the ULA is accessing the screen RAM to draw the screen.

Mark
:!: Standby alert :!:
“There are four lights!”
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb :dance
Looking forward to summer later in the year.
User avatar
Weiv
Microbot
Posts: 178
Joined: Fri Apr 06, 2018 5:28 pm
Location: Ukraine

Re: Exact emulation of the Snow effect.

Post by Weiv »

Maybe the long snow time was a reason.
User avatar
1024MAK
Bugaboo
Posts: 3151
Joined: Wed Nov 15, 2017 2:52 pm
Location: Sunny Somerset in the U.K. in Europe

Re: Exact emulation of the Snow effect.

Post by 1024MAK »

So, even if you left the test running for five minutes, the Z80 only outputs data on the bus for approximately 3½ clock cycles and external devices (DRAM) typically only output data for approximately 1 clock cycle when the Z80 is reading from them.

At 3.5MHz, that’s 286ns to 1000ns (1µs) at most before the next instruction cycle/part of a cycle.

The data bus uses 470Ω resistors. Part of the address bus uses 330Ω resistors.

Even in a worse case, with one logic output high at 4V and another low at 0V, with a 330Ω resistor, that’s only 12.12mA. So a power of only 48mW per pin (8 pins 388mW). That’s so small that it would not make any significant difference to a chip.

Mark
:!: Standby alert :!:
“There are four lights!”
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb :dance
Looking forward to summer later in the year.
TheMartian
Microbot
Posts: 107
Joined: Wed Feb 03, 2021 5:18 am

Re: Exact emulation of the Snow effect.

Post by TheMartian »

@Weiv, I don't think your test damaged anything.

My Toastrack was a little bit unstable at the moment, the ULA had had a miraculous recovery so maybe it has some intermittent failure that I've got to look into.

(If something, I hope that my faulty-ish Toastrack hasn't invalidated the test results!)

I'll look into it and it'll be fine in no time. :smile:
Post Reply