Explain this behavior

Any discussions related to the creation of new hardware or software for the ZX80 or ZX81
monzamess
Posts: 25
Joined: Sat Jul 08, 2017 8:39 pm

Horizontal scrolling tricks?

Post by monzamess »

Now I'm playing with scrolling.

Vertical scrolling is really fast if you have the memory, because you basically create a really long DFILE in memory and increment the DFILE pointer by 33 bytes for each line. Attached is the "vscroll" program which lets you push the O around the screen while random junk flies by vertically.
vscroll.c
(5.21 KiB) Downloaded 172 times
vscroll.P
(4.85 KiB) Downloaded 164 times
Horizontal scrolling... is there a trick? I'm currently doing it the naive way by just moving stuff right-to-left. Attached is "hscroll" where you can again push an O around the screen while stair steps scroll by at a very boring pace. This example is double-buffered for smoother animation, but I tested it with a single buffer and it wasn't significantly faster.
hscroll.c
(4.92 KiB) Downloaded 175 times
hscroll.P
(4.92 KiB) Downloaded 170 times
I am sure some of the hscroll slowness is due to my coding technique and use of C, but fundamentally what I'm doing is slow by any method. Any tricks?
Lardo Boffin
Posts: 2160
Joined: Sat Nov 26, 2016 2:42 am

Re: Explain this behavior

Post by Lardo Boffin »

With the vertical scrolling you are in effect making use of hardware acceleration in low resolution mode as the screen is made up of horizontal layers. If you move the D_FILE start up or down a complete line at the next redraw the whole screen moves up or down a complete line.

ScreenMemory.JPG
(230.42 KiB) Downloaded 273 times

Scrolling left or right is way more complex. To scroll to the left (so as to simulate a space ship flying to the right such as in The Gauntlet/ Rocket Raid etc.) you could either: -
Move each character in each line one position to the left starting with the second character (so as to drop the first character off the end of the screen) and then insert the new character just before the terminating $76 (which over 30 operations per line * 24 lines)
or
And I'm thinking out loud here! Move each $76 one byte 'to the right' (i.e. increase the position in RAM by 1) and add in a new character where the $76 used to be. I suspect you would also have to move the start of D_FILE at the same time (increase it by 1). You would have to deal with the fact that eventually you will run out of RAM to move it into! :D

Hopefully that makes some measure of sense...
ZX80
ZX81 iss 1 (bugged ROM, kludge fix, normal, rebuilt)
TS 1000 iss 3, ZXPand AY and +, ZX8-CCB, ZX-KDLX & ChromaSCART
Tatung 81 + Wespi
TS 1500 & 2000
Spectrum 16k (iss 1 s/n 862)
Spectrum 48ks plus a DIVMMC future and SPECTRA
sirmorris
Posts: 2811
Joined: Thu May 08, 2008 5:45 pm

Re: Explain this behavior

Post by sirmorris »

Fast horizontal scrolling will require a modified video routine, one which allows movement across a larger buffer. It's possible.
User avatar
siggi
Posts: 988
Joined: Thu May 08, 2008 9:30 am
Location: Wetterau, Germany
Contact:

Re: Explain this behavior

Post by siggi »

Maybe Wilf's NOVA could be used for that?

http://www.user.dccnet.com/wrigter/inde ... va2005.htm
Wilf wrote: The most powerful feature of this program is the ability to create new Video
Display files located anywhere in memory. A variable number of character per
line, a variable number of lines per screen and the starting position (memory
address) of the screen are under program control.

The NOVA video routines create a window on the memory and this window can be
rapidly moved from one location to another by changing the OFFSET parameter.
My ZX81 web-server: online since 2007, running since dec. 2020 using ZeddyNet hardware
http://zx81.ddns.net/ZxTeaM
monzamess
Posts: 25
Joined: Sat Jul 08, 2017 8:39 pm

Re: Explain this behavior

Post by monzamess »

I'll check that out. I think I stumbled upon it earlier but maybe it will make more sense to me now. :)
Post Reply