About addressing video RAM

ZXNet echo conference «zx.spectrum»

From Andrey Teplyakov To All 31 July 1997


Greetings, Max!
07/31/97 at 01:42 the silence of the night was split by a loud knock on the keys.
Max Polunin had such a hobby - writing letters to everyone. This time
the object of his attention was All. Max Polunin wrote the following:

MP> People, tell me this... How do you manage to write stuff like
MP> LAVA, ZOOM/ROTATE, etc. with such a crooked addressing of screen memory as in Zx?

MP> And how did grandpa Clive even come up with the idea to make it like this?... :(

Clive’s idea was the most optimal. And here’s why. As far as you should
know, the Spectrum does not have a text mode, why - I think
there is no need to explain. But the Spectrum was conceived as a simple and convenient computer for population who want to learn how to program, that is, as a teaching computer, and convenient and fast output of text information, so important when working with the ZX graphics video adapter, was solved using the original structure of video memory. Judge for yourself: the address in the video area, presented in binary or hexadecimal form, can be seen almost with the naked eye. “see”
the position of the printed symbol and even the corresponding symbol line! Try
write procedures for displaying symbols on a standard ZX screen and on a screen with a linear organization, and then compare their effectiveness. Everything will become clear at once.
About the attributes.I'm already silent. SUCH attributes are only suitable for text, and color
graphics is a kind of improvisation, in most cases, I must admit, very
successful (may the artists forgive me).
But let's agree for a minute: addressing in ZX is really crooked. Let us turn our attention to the well-known “Pro” computer. Its developers studied
the original Speccy in every detail and decided to create an extended
raster mode of 512x240x16/256. They knew that the ZX video memory was crooked and inconvenient. They
knew that it was impossible to write ZOOM/ROTATE with such video memory. They knew everything.
And they made a video memory... THE SAME AS THE ORIGINAL! Doesn't that mean anything to you?
As for rotozoommers, here I completely agree with you. This venerable Sir Clive was such a short-sighted person, well, he could not have imagined in 81-82 that someone in the late 90s would rush to do SUCH effects. I couldn’t.
And finally, about the effects themselves: in some cases you can
just don’t give a damn about addressing. How? Using tables of screen addresses, appropriately arranged in memory. Using this method, in 67168
cycles I was able to move 14 2x2 balls across the screen with pixel accuracy, scrolling, a 3-plane star background and an arrow cursor, sprites of balls and arrows, of course,
with masks. Well, the PT 2.1 player gobbled up the remaining 4 thousand cycles,here's "crooked addressing" for you. That's it.
Well, if I deviated from the truth somewhere, dear All will undoubtedly
correct me. As the classic said, “By teaching others, you learn yourself.”

I wish you happiness and... good luck. Andrey Teplyakov (AKA Mad Coder/ILW)