[comp.sys.ibm.pc.programmer] VGA smooth scrolling problem

8324155@max.u.washington.edu (03/07/90)

  Hi, I'm hoping someone can help me with this problem.
 
  I am trying to write an assembly routine which smoothly scrolls (one
pixel at a time) a VGA text screen.  I use the Preset Row Scan Register
(port 3d4h/3d5h, index 08h) to scroll the screen up one pixel at a time.
When I have scrolled the height of one full character (16 pixels in this
case) I reset the register, and then move the data up one line as fast as
possible (using the movsw command to move the data in video memory directly)
This works well up to a point.  The screen scrolls fine until a full
character has been scrolled.  At that point there is a slight flicker as the
register is reset and the data moved.  I have tried waiting for the video
refresh to finish by watching the status register bit 3 (port 3dah) and
then reseting the register and moving the screen, but this does not solve
the problem.  I would really appreciate any suggestions.
 
  Thanks,
 Mark
 
 

fpa@qualcom.qualcomm.com (Franklin Antonio) (03/07/90)

ea@max.u.washington.edu writes...
>  I am trying to write an assembly routine which smoothly scrolls (one
>pixel at a time) a VGA text screen.  I use the Preset Row Scan Register

Check out the Start Address Registers.  They allow you to move whole character
widths or heights without moving characters in memory.  I have never seen
a program that actually implemented smooth scrolling on a VGA, so let us 
know if you succeed!

mcdonald@aries.scs.uiuc.edu (Doug McDonald) (03/07/90)

In article <13409.25f447ea@max.u.washington.edu> 8324155@max.u.washington.edu writes:
>
>  Hi, I'm hoping someone can help me with this problem.
> 
>  I am trying to write an assembly routine which smoothly scrolls (one
>pixel at a time) a VGA text screen.  I use the Preset Row Scan Register
>(port 3d4h/3d5h, index 08h) to scroll the screen up one pixel at a time.
>When I have scrolled the height of one full character (16 pixels in this
>case) I reset the register, and then move the data up one line as fast as
>possible (using the movsw command to move the data in video memory directly)
>This works well up to a point.  The screen scrolls fine until a full
>character has been scrolled.  At that point there is a slight flicker as the
>register is reset and the data moved.  I have tried waiting for the video
>refresh to finish by watching the status register bit 3 (port 3dah) and
>then reseting the register and moving the screen, but this does not solve
>the problem.  I would really appreciate any suggestions.
> 
>  Thanks,
> Mark
> 
> 

Don't do it that way. Have a buffer in VGA memory two whole screens high.
Then do the moving up and down entirely by changing the starting
position, as you describe above. You also change the starting address
in video memory rather than moving data around. When you scroll
off the bottom of the second page you copy data to the top
of the first page before changing the video registers. This
works perfectly.

Doug McDonald

cjwein@watcgl.waterloo.edu (Chris J. Wein) (03/07/90)

In article <13409.25f447ea@max.u.washington.edu>, 8324155@max.u.washington.edu writes:
>   I am trying to write an assembly routine which smoothly scrolls (one
> pixel at a time) a VGA text screen.  I use the Preset Row Scan Register
> (port 3d4h/3d5h, index 08h) to scroll the screen up one pixel at a time.
> When I have scrolled the height of one full character (16 pixels in this
> case) I reset the register, and then move the data up one line as fast as
> possible (using the movsw command to move the data in video memory directly)
> This works well up to a point.  The screen scrolls fine until a full
> character has been scrolled.  At that point there is a slight flicker as the
> register is reset and the data moved.  I have tried waiting for the video
> refresh to finish by watching the status register bit 3 (port 3dah) and
> then reseting the register and moving the screen, but this does not solve
> the problem.  I would really appreciate any suggestions.

If you have multiple graphic pages then this method is better... 

While you are scrolling by pixel on one graphic screen, create, one another
inactive page, a screen which is scrolled one complete character.  When you
have scrolled the 16 pixels, wait for video refresh and then switch active
pages to the one scrolled by one character.  You now start scrolling this
page pixel by pixel and using the old screen as your update page.  This way
you can toggle between two pages.

Of course, there can be a problem if the scroll direction changes just before
you are switching pages but this is infrequent.

Hope this helps

Chris

by the way, this method was implemented on a c64 many eons ago by myself.
-- 
===============================================================================
 Chris Wein, cjwein@watcgl{.waterloo.edu, UWaterloo.ca} 
 Computer Graphics Lab, Department of Computer Science, University of Waterloo
===============================================================================

malloy@nprdc.arpa (Sean Malloy) (03/07/90)

In article <1892@qualcom.qualcomm.com> fpa@qualcomm.com (Franklin Antonio) writes:
>ea@max.u.washington.edu writes...
>>  I am trying to write an assembly routine which smoothly scrolls (one
>>pixel at a time) a VGA text screen.  I use the Preset Row Scan Register

>Check out the Start Address Registers.  They allow you to move whole character
>widths or heights without moving characters in memory.  I have never seen
>a program that actually implemented smooth scrolling on a VGA, so let us 
>know if you succeed!

It wasn't written specifically for the VGA, but STYPE does smooth
scrolling on both an EGA and a VGA, with adjustable scroll speed and
pausing. It's a replacement for 'type [filename] | more' or 'more
[filename]' (depending on whether you use the DOS 'more' or a more
intelligently implemented one).


 Sean Malloy                                   | "The Crystal Wind is the
 Navy Personnel Research & Development Center  | Storm, and the Storm is Data,
 San Diego, CA 92152-6800                      | and the Data is Life."
 malloy@nprdc.navy.mil                         | -- _Emerald Eyes_, D.K. Moran