Jump to content
IGNORED

Smooth Horizontal Scrolling


djmips

Recommended Posts

Preamble:

 

I did some C64 programming back in the day, some of it was pretty cool too. I have the listing of a version of my 32 sprite multiplexing routines and I'm planning on typing it in (or OCR) and see if I can get it running again. It wasn't really using any amazing tricks but the dynamic zone calculation code was quite good for the time I think.

 

Some of my colleagues were doing things that were supposed to be impossible like putting sprites in the borders. I understood how that worked but I'd only heard rumours that there was a pretty cool way to do smooth horizontal scroll without needing to do a coarse scroll in character map and colour memory. Several of the games I did had pretty decent (I thought) scrolling routines but yes the big overhead was the shifting of the entire character map memory and colour memory every eighth shift as the hardware smooth scroll registers only shifted the screen eight pixels before they reset.

 

Now it turns out that the fancy smooth scrolling techniques operated on a similar fashion as the techniques to put sprites in the borders in that you tricked the simple hardware that was waiting for some condition like a particular line and then change what it was waiting for to something earlier after it had already past the earlier check. This meant the check never triggered and lets say a border was never enabled.

 

In the smooth scrolling case, if you use a similar trick to get the VIC 2 chip into thinking it's time to start a new line and you time it to happen, say in the middle of the screen you can force the entire screen to be shifted over by that amount. It's pretty cool since you can scroll a lot without having to have to copy every eighth scroll position. This is especially nice in bitmap mode. Apparently it was invented by a demo coder in 1987 here -> http://www.pouet.net/prod.php?which=19753

 

How did I find out about this, well it's probably on the net somewhere but a nice fellow put together what appears to be definitive lecture on the C64 video hardware at some hacker conference or something. In any case he also covers the 6502 in quite a bit of detail partially based on the work of this Hungarian fellow (amazing) http://impulzus.sch.bme.hu/6502/6502/ although he regurgitates this again in a better and more complete 6502 talk that is tied in with the amazing http://visual6502.org/ which if you haven't seen the site or heard about this. shame shame shame.

 

The links to the talks are 6502 -> http://www.pagetable.com/?p=517

Ultimate C64 talk -> http://www.pagetable.com/?p=54

 

All these cool C64 tricks are explained in much more technical detail here for those who are interested -> https://sh.scs-trc.net/vic/vic_article_3.14.htm#3.14.6

 

Well it's too late to not be guilty of being sidetracked on the C64 and 6502 stuff but that stuff is very cool and the visual6502 guys have also reverse engineered and gate level simmed the TIA chip as well!

 

THE 2600 dollar Question.

 

Now finally to my question to the 2600 home-brew / tech community. Is there some equivalent trick maybe maybe maybe on the 2600 TIA that would allow some way of doing horizontal smooth scrolling of playfields? There was some discussion at one time on the Stella list but I only vaguely recall the discussion. I'm fairly un-optimistic that there will be a solution found that could be done software only but perhaps even something crazy that worked on a fancy cart would be an interesting but even that seems unlikely.

Link to comment
Share on other sites

THE 2600 dollar Question.

 

Now finally to my question to the 2600 home-brew / tech community. Is there some equivalent trick maybe maybe maybe on the 2600 TIA that would allow some way of doing horizontal smooth scrolling of playfields? There was some discussion at one time on the Stella list but I only vaguely recall the discussion. I'm fairly un-optimistic that there will be a solution found that could be done software only but perhaps even something crazy that worked on a fancy cart would be an interesting but even that seems unlikely.

Not that I am aware of. IIRC some people did some experiments with RSYNC, but to no success.

 

But you can circumvent the problem in multiple ways. E.g. if you compare Vanguard's with Thrust's horizontal PF scrolling, the later does look much better (IMO ;)). Or you can try do use e.g. the ball for edge smoothing, or maybe even flicker the edges.

Link to comment
Share on other sites

Preamble:

 

I did some C64 programming back in the day, some of it was pretty cool too. I have the listing of a version of my 32 sprite multiplexing routines and I'm planning on typing it in (or OCR) and see if I can get it running again. It wasn't really using any amazing tricks but the dynamic zone calculation code was quite good for the time I think.

 

Some of my colleagues were doing things that were supposed to be impossible like putting sprites in the borders. I understood how that worked but I'd only heard rumours that there was a pretty cool way to do smooth horizontal scroll without needing to do a coarse scroll in character map and colour memory. Several of the games I did had pretty decent (I thought) scrolling routines but yes the big overhead was the shifting of the entire character map memory and colour memory every eighth shift as the hardware smooth scroll registers only shifted the screen eight pixels before they reset.

 

Now it turns out that the fancy smooth scrolling techniques operated on a similar fashion as the techniques to put sprites in the borders in that you tricked the simple hardware that was waiting for some condition like a particular line and then change what it was waiting for to something earlier after it had already past the earlier check. This meant the check never triggered and lets say a border was never enabled.

 

In the smooth scrolling case, if you use a similar trick to get the VIC 2 chip into thinking it's time to start a new line and you time it to happen, say in the middle of the screen you can force the entire screen to be shifted over by that amount. It's pretty cool since you can scroll a lot without having to have to copy every eighth scroll position. This is especially nice in bitmap mode. Apparently it was invented by a demo coder in 1987 here -> http://www.pouet.net/prod.php?which=19753

 

How did I find out about this, well it's probably on the net somewhere but a nice fellow put together what appears to be definitive lecture on the C64 video hardware at some hacker conference or something. In any case he also covers the 6502 in quite a bit of detail partially based on the work of this Hungarian fellow (amazing) http://impulzus.sch.bme.hu/6502/6502/ although he regurgitates this again in a better and more complete 6502 talk that is tied in with the amazing http://visual6502.org/ which if you haven't seen the site or heard about this. shame shame shame.

 

The links to the talks are 6502 -> http://www.pagetable.com/?p=517

Ultimate C64 talk -> http://www.pagetable.com/?p=54

 

All these cool C64 tricks are explained in much more technical detail here for those who are interested -> https://sh.scs-trc.net/vic/vic_article_3.14.htm#3.14.6

 

Well it's too late to not be guilty of being sidetracked on the C64 and 6502 stuff but that stuff is very cool and the visual6502 guys have also reverse engineered and gate level simmed the TIA chip as well!

Thanks for sharing.

 

Fascinating links.

 

I used side border sprite routines in my C64 game back in the eighties, as well as a vertical scrolling routine and my own recorded speech samples:

http://ia600303.us.archive.org/8/items/TheSecondC64LongplaySerie_3/C64-Longplay228-TerraPlagiata_512kb.mp4

 

Gideon Zweytzer (the creator of the Ultimate 1541) was a friend of mine back then.

 

He helped me out when I got stuck during programming (doing all kinds of bankshifting tricks IIRC).

 

I remember that especially the vertical borders were tricky to show sprites in.

 

Great memories.

 

8)

Edited by Rom Hunter
Link to comment
Share on other sites

I remember that especially the vertical borders were tricky to show sprites in.

8)

 

You're welcome.

 

Yeah from the descriptions sprites beyond the vertical borders required more precise timing compared to the top/bottom. This would tricky like a lot of 2600 programming.

 

Nice C64 game. Wow your game is old school difficult like 'Crazy Balloon', 'Irritating Stick' or 'Marble Craze'. I hope that when you fail you have to start at the absolute beginning? Anything else would be a disappointment. :-)

 

What do you think are the best / smoothest HORIZONTAL scrolling 2600 games?

Link to comment
Share on other sites

Nice C64 game. Wow your game is old school difficult like 'Crazy Balloon', 'Irritating Stick' or 'Marble Craze'. I hope that when you fail you have to start at the absolute beginning? Anything else would be a disappointment. :-)

Yes, it's brutally relentless.

 

For Todd Rogeresque players only.

 

Although you only have 1 life, it does not restart at the beginning after reaching a certain point in the game (mostly after beating a tough challenge).

 

And... there's an inbuild level skipper (by pressing the COMMODORE key and INST DEL key together on your C64 keyboard during the gray in-game title screen).

 

What do you think are the best / smoothest HORIZONTAL scrolling 2600 games?

Old Era: Vanguard

 

Homebrew: Thrust+

 

And I remember some game demo with a helicopter, IIRC also made by Thomas.

 

The worst: Super Cobra.

 

8)

Edited by Rom Hunter
Link to comment
Share on other sites

THE 2600 dollar Question.

 

Now finally to my question to the 2600 home-brew / tech community. Is there some equivalent trick maybe maybe maybe on the 2600 TIA that would allow some way of doing horizontal smooth scrolling of playfields? There was some discussion at one time on the Stella list but I only vaguely recall the discussion. I'm fairly un-optimistic that there will be a solution found that could be done software only but perhaps even something crazy that worked on a fancy cart would be an interesting but even that seems unlikely.

Not that I am aware of. IIRC some people did some experiments with RSYNC, but to no success.

 

But you can circumvent the problem in multiple ways. E.g. if you compare Vanguard's with Thrust's horizontal PF scrolling, the later does look much better (IMO ;)). Or you can try do use e.g. the ball for edge smoothing, or maybe even flicker the edges.

 

I do like the delayed scrolling in Thrust which is an elegant approach given the coarse horizontal resolution of the playfield.

 

Have you ever seen someone do a demo of playfield scrolling using the ball for edge smoothing? I think it would be a neat trick for sure.

 

You would have to do leading edge and trailing edge so your design would have to accommodate that on each line you would have enough time and resources to cover up the leading edges and trailing edges for the entire width of the screen.

 

I'm seeing your flicker the edges idea in my mind's eye as a form of anti-aliasing or time division multiplexing or pulse width modulation, and I can see how that would work but I don't think our eyes would be able to integrate this without some very irritating flicker side effects and I'm not sure it would be successful at conveying the smoothed edges appropriately. But the only way to find out... :-)

 

But getting back to the RSYNC idea. RSYNC is documented as Reset Sync - resets the horizontal sync counter to define the beginning of horizontal blank time, and is used in chip testing. <- From Stella Programmer's Guide.

 

Really? chip testing?

 

RSYNC is also described in Andrew Tower's TIA Hardware Notes where he has discerned the function of the TIA partially using some published schematics. Here is Andrew's description:

 

ref: http://www.atarihq.com/danb/files/TIA_HW_Notes.txt

RSYNC resets the two-phase clock for the HSync counter to the

H@1 rising edge when strobed. It looks like this could be used

to move the HSync counter into phase with the CPU on any cycle

(although there is some auto-synchronisation between the two-phase

clock and the div-by-3 counter for the CPU clock, I haven't looked

into this yet.) A full H@1-H@2 cycle after RSYNC is strobed, the

HSync counter is also reset to 000000 and HBlank is turned on.

This one requires more investigation.

 

H@1 and H@2 are the two phase clock for the TIA which uses the 3.58 Mhz Color burst divided by 4.

Link to comment
Share on other sites

Have you ever seen someone do a demo of playfield scrolling using the ball for edge smoothing? I think it would be a neat trick for sure.

Yes, that would be one possibility. In fact, some games do use the ball or missiles to draw a background with hi-res lines that scroll smoothly-- Defender or StarGate come to mind. But it would probably be a bear to use the ball to smooth out the edges of the playfield while it's scrolling-- not as long as only one edge per line needs to be smoothed, but certainly if multiple edges need to be smoothed per scan line.

 

I'm seeing your flicker the edges idea in my mind's eye as a form of anti-aliasing or time division multiplexing or pulse width modulation, and I can see how that would work but I don't think our eyes would be able to integrate this without some very irritating flicker side effects and I'm not sure it would be successful at conveying the smoothed edges appropriately. But the only way to find out... :-)

I've tried using flicker to try to make it look like the playfield is scrolling more smoothely, and the results pretty much sucked! :) It didn't work at all, at least certainly not like I'd hoped.

 

But getting back to the RSYNC idea. RSYNC is documented as Reset Sync - resets the horizontal sync counter to define the beginning of horizontal blank time, and is used in chip testing.

RSYNC doesn't help with scrolling, either. All it does is redefine the beginning of horizontal blanking and horizontal sync (or the horizontal counter in general), making that particular scan line shorter than normal. There's no way to change the way the TIA aligns and draws the playfield pixels in relation to the end of horizontal blanking (or the beginning of the visible line). It would have been a nice feature, but there's no way to do it (that I know of, anyway) short of replacing the TIA with a different chip. :(

 

Michael

Link to comment
Share on other sites

I'm seeing your flicker the edges idea in my mind's eye as a form of anti-aliasing or time division multiplexing or pulse width modulation, and I can see how that would work but I don't think our eyes would be able to integrate this without some very irritating flicker side effects and I'm not sure it would be successful at conveying the smoothed edges appropriately. But the only way to find out... :-)

 

I don't know if I'm following you, but the diagonal lines in my ballblazer kernal look great when in movement. I guess non-vertical patterns will do the best. I also tried to enhance the resolution of the 4x width players, like you see in my avatar (its like a high-res image, sampled down), but that didn't work out too good because of the low vertical resolution (double-line kernal).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...