This article broadly introduces Fine Scrolling
                but some prior knowledge of Display Lists and screen memory is
                needed. It is recommended that the listing is studied alongside
                the article.
          Scrolling allows you to use the screen as a window
              to move across a picture much larger than the television could
              normally accommodate. To do this on other computers, you would
              have to move thousands of bytes but on the Atari only a couple
              of addresses need to be changed to manipulate the screen area in
              RAM. This results in quick motion and is easily programmed but
              there is a problem in that characters or graphics blocks jump across
              the screen to give very coarse motion.
          Atari, being the machine it is, provides an answer
              to this problem by having two registers which enable fine scrolling.
              HSCROL at 54276 ($D404) allows horizontal scrolling and VSCROL
              at 54277 ($D405) allows vertical scrolling. These registers can
              only contain numbers in the range 0 to 15 and therefore can only
              scroll 16 colour clocks horizontally or 16 scan lines vertically.
              To get continuous fine scrolling of a whole picture, you must first
              execute fine scrolling until it reaches its limit, then reset the
              register to zero and execute a coarse scroll.
          In order to write a scrolling program, the display
              list must be altered. Firstly we must find the start of the display
              list.
          10 DL=PEEK(560)+256*PEEK(561)
           The next step is to enable the horizontal or vertical
              scroll and also let the display list know where to find the area
              of display memory in RAM which holds the picture to be scrolled.
              Note that for horizontal scrolling RAM must be allocated so that
              each line is wider than the TV screen. We must change the third
              byte of the display list and every 3 after it by adding to the
              ANTIC mode number, 16 to enable horizontal scrolling, 32 to enable
              vertical scrolling plus 64 to indicate a Load Memory Scan instruction.
              For example, to enable both horizontal and vertical scrolling in
              Graphics 2.
          20 FOR I=DL+3 TO DL+37 STEP 3:
              POKE I,119: NEXT I
          Then by POKEing DL+4 and DL+5 and every 3 after them
              with the low and high address of the display memory of each line,
              the display is ready for scrolling.
          30 LO=0: HI=PEEK(106)-20
            40 FOR I=DL+4 TO DL+37 STEP 3
            50 POKE I,LO: POKE I+1,HI
            60 HI=HI+1: NEXT I
          To draw a picture in the display memory, you must
              POKE values directly into the appropriate area as in the accompanying
              program.
          To actually implement the scroll is quite easy. For
              coarse horizontal scrolling, increment (or decrement) the low address
              byte (i.e. DL+4,DL+7 etc.) of every mode line. For coarse vertical
              scrolling, change it by the length in bytes of the whole line.
              In order to achieve fine scrolling, change the relevant scroll
              register between changing the address byte.
          The accompanying program demonstrates fine horizontal
              scrolling. It scrolls a terrain across the screen in a continuous
              loop. The terrain is about 12 screens wide and takes approximately
              37.4 seconds for one cycle. It is drawn with a custom Graphics
              2 character set as bit mapped graphics take up too much memory.
              A small spaceship flies above the landscape to show how player-missile
              graphics are not affected by the scrolling. To ensure smooth flicker-free
              movement, the scrolling is done in the Vertical Blank Interrupt
              as it is not possible to achieve such good results in Basic.
          After the program is typed in, save it before running
              it in case you have made a mistake. Upon execution, the new display
              list will be set up, the PM image will be drawn and lastly the
              terrain will be drawn. The latter takes quite a while as there
              is so much of it, but when finished it will all scroll smoothly
              across your screen.
          This article and program first appeared in Inside
                Info, the journal of Atari Computer Enthusiasts (N.S.W). Used
                with permission.
          
            
              |  |  |  | 
          
          top