SyntaxBomb - Indie Coders

General Category => 8-bit / 16-bit retro world => Topic started by: Baggey on July 24, 2021, 16:09:21

Title: Port 255 on the ZX Spectrum
Post by: Baggey on July 24, 2021, 16:09:21
Ive tried various researchs on the web and can't seem to find anything on the above PORT 255.

Any Zx Spectrum or Z80 Gurru's out there know what port 255 is or how it effects the machine itself?

Emulating the Game Cobra by imagine their is an in on PORT 255 i can only get it to work by forcing it to recive a 1? or it hangs forever.

Kind Regards Baggey
Title: Re: Port 255 on the ZX Spectrum
Post by: col on July 25, 2021, 04:47:35
This is related to what is called 'the floating bus' on the Spectrum - a timing trick used to know when to start rendering pixels for smooth screen scrolling.
https://sinclair.wiki.zxnet.co.uk/wiki/Floating_bus (https://sinclair.wiki.zxnet.co.uk/wiki/Floating_bus)
https://worldofspectrum.org/faq/reference/48kreference.htm#IOContention (https://worldofspectrum.org/faq/reference/48kreference.htm#IOContention)

Here's a little explanation of how it worked in the Sidewize game:
https://stevewetherill.com/2015/02/24/the-sidewize-test-zx-spectrum-floating-bus-shenanigans/ (https://stevewetherill.com/2015/02/24/the-sidewize-test-zx-spectrum-floating-bus-shenanigans/)
http://www.zxdesign.info/sidewizeTest.shtml (http://www.zxdesign.info/sidewizeTest.shtml)

After reading that article take a look at a screenie for Cobra and you'll also notice the same 'black bar' between the play area and the stats area that's used for syncing the cpu with the TVs raster beam 8)
Title: Re: Port 255 on the ZX Spectrum
Post by: Baggey on July 30, 2021, 17:50:50
Quote from: col on July 25, 2021, 04:47:35
This is related to what is called 'the floating bus' on the Spectrum - a timing trick used to know when to start rendering pixels for smooth screen scrolling.
https://sinclair.wiki.zxnet.co.uk/wiki/Floating_bus (https://sinclair.wiki.zxnet.co.uk/wiki/Floating_bus)
https://worldofspectrum.org/faq/reference/48kreference.htm#IOContention (https://worldofspectrum.org/faq/reference/48kreference.htm#IOContention)

Here's a little explanation of how it worked in the Sidewize game:
https://stevewetherill.com/2015/02/24/the-sidewize-test-zx-spectrum-floating-bus-shenanigans/ (https://stevewetherill.com/2015/02/24/the-sidewize-test-zx-spectrum-floating-bus-shenanigans/)
http://www.zxdesign.info/sidewizeTest.shtml (http://www.zxdesign.info/sidewizeTest.shtml)

After reading that article take a look at a screenie for Cobra and you'll also notice the same 'black bar' between the play area and the stats area that's used for syncing the cpu with the TVs raster beam 8)

:o Wow thanks for the Links.

I am in deed getting some flickering on graphics in some games. Cobra, Sidewize, Commando, Arkanoid.

Im also getting some graphic curruption with, Konami's Ping Pong, War, Scuba dive, Sidewize

Incidently I cant get Green Beret to move right passed the middle of the screen for some reason?

Cyclone was hard to get going as it called an Interupt at 65535 ie in the real machine we fetch values from address 0, i was getting random numbers. I needed to to write a check insuring i fed back 243! To get it to run.

Deviating slightly from port 255 i know but Contended memory timing and video/ ULA screen timing and sound Timing seems to be Creeping up on me. Pointing me in the direction now of Keeping track off Time Better.  ::)

So to stop the flickering could be tricky as im printing the whole screen out in one go. It now seems that on the forth Cycle of the ULA or the last Attribute byte needs to be sent to Port 255. Every 32 byte's of the screen updated? It would seem  ???

if i understand it thou, once the ULA has control it write's the whole screen in one go anyway! So how does a reference to IN A,(255) give a value that's say 2/3 rd's down the screen. Because if the Screen is written in one go the Attribute value would hold the bottom right corner of the screen? Hmm

Baggey

Title: Re: Port 255 on the ZX Spectrum
Post by: Baggey on July 30, 2021, 19:23:10
So, Ive ordered this book!

http://www.zxdesign.info/book/theZXSpectrumULA.shtml

Hopeing that I can perfect SpecBlitz Emulator and Understand More of the internal workings of the ULA ::)

Kind Regards Baggey
Title: Re: Port 255 on the ZX Spectrum
Post by: 3DzForMe on July 31, 2021, 08:57:52
Good luck with sorting out Port 255, sterling work so far with your ZX emulator!