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 7:39 pm

Horizontal scrolling tricks?

Post by monzamess » Thu Oct 12, 2017 3:02 am

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 5 times
vscroll.P
(4.85 KiB) Downloaded 2 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 7 times
hscroll.P
(4.92 KiB) Downloaded 5 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: 627
Joined: Sat Nov 26, 2016 1:42 am

Re: Explain this behavior

Post by Lardo Boffin » Thu Oct 12, 2017 4:07 pm

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
ScreenMemory.JPG (230.42 KiB) Viewed 130 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...
ZX81 iss 1 (bugged ROM, kludge fix, normal, kit)
Iss 3 with ZXVid, another in nearly perfect box
TS 1000 iss 3, ZXPand AY, ZX8-CCB & ZX-KDLX
TS 1500
TS 2000
Spectrum 16k (iss 1 s/n 1499)
Spectrum 48k
Toastrack + DIVMMC future

User avatar
sirmorris
Posts: 2669
Joined: Thu May 08, 2008 4:45 pm
Location: oxon, uk

Re: Explain this behavior

Post by sirmorris » Thu Oct 12, 2017 9:01 pm

Fast horizontal scrolling will require a modified video routine, one which allows movement across a larger buffer. It's possible.
--=== ZXpand+ ... A more moderner all-in-one upgrade solution for ZX81 ===--
* SD/MMC storage * 32K Hires-capable RAM * AY sound chip * Joystick port * Serial *
* BASIC enhancements - plug & play * Reset button * Auto-boot facility *

User avatar
siggi
Posts: 760
Joined: Thu May 08, 2008 8:30 am
Location: Dauernheim, Germany
Contact:

Re: Explain this behavior

Post by siggi » Fri Oct 13, 2017 8:57 am

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
http://zx81-siggi.endoftheinternet.org/index.html

monzamess
Posts: 25
Joined: Sat Jul 08, 2017 7:39 pm

Re: Explain this behavior

Post by monzamess » Fri Oct 13, 2017 2:12 pm

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

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest