The Atari home computer has the capability to scroll lines of text on the screen. This was first made popular from the game Eastern Front and the rest as they say is history. Many other commercial games adapted this same approach to make their titles more appealing. A screen can be scrolled horizontally (left and right) or vertically (up and down). Keep in mind that while Basic can scroll your screen, it will appear jerky since pixels scroll best in machine language.
There are actually two types of scrolling that can occur coarse and fine. Coarse scrolling will move individual characters one at a time. This can be either text or graphics. Coarse scrolling can appear jittery since it doesn’t scrolling the individual dots of a character (known as the pixels).
When implementing fine scrolling, each pixel has the ability to move in any direction. As a result this creates a smooth scrolling screen. Fine scrolling only has the ability to move screen data a total of one row or column. This is accomplished by moving bits 0-7 (known again as the “pixels”). In actuality to create perfect scrolling, both coarse and fine scrolling are combined.
Once the bits count from zero to seven, they must be reset to begin scrolling the character pixels again. This is best implemented under a Vertical Blank Interrupt to allow a smooth operation.
In order to successfully pull off this feat, it is necessary to use a VBI (Vertical Blank Interrupt) while running code in machine language. Every 60 seconds, the television utilizes an electronic gun that draws a picture from top to bottom, scanning the screen from left to right. After the beam arrives at the right hand side (known as the “horizontal blank”), the electron gun is turned off to reset itself at the top of the left hand screen to begin the next scan a line lower.
The Display List
The Atari home computer accomplishes scrolling by using a display list. A display list is a set of instructions that tells the computer how to display graphics on a screen. The memory locations 560 and 561 contain a point to this data in memory. See the Display List page for more information. When a GRAPHICS command is executed, the Atari captures the screen data (display list) in its memory. The command to execute this looks like the following (as stored in a variable of your choice):
Within this list, the 5th and 6th numbers are used to store the address of memory locations 560 (low byte) and 561 (high byte). Adjusting the data that exists at the fifth and sixth numbers of the display list causes the screen to shift, which produces scrolling when set in a loop.
Below is a simple example of an Atari Basic program that allows the user to scroll through memory using a joystick. It utilizes and scrolls through data at locations 4 and 5 in the display list. The picture will appear to wrap as you move the joystick. Once two intervals are complete horizontally, the line moves up the screen, but is now displaced. As mentioned earlier, Basic is not the best language to scroll a screen since it runs slower. Assembly language will always get the job done right.
10 GRAPHICS 3: COLOR 1: PLOT 0,0: DRAWTO 40,20 20 DL=PEEK(560)+256*PEEK(561) 30 DL4=DL+4:DL5=DL+5: NUML=PEEK(DL4):NUMH=PEEK(DL5) 40 ST=STICK(0) 50 IF ST=11 THEN NUML=NUML+1 60 IF ST=7 THEN NUML=NUML-1 70 IF NUML<0 THEN GOTO 110 80 IF NUML>256 THEN GOTO 140 90 NUML=NUML-256:NUMH=NUMH+1 100 GOTO 120 110 NUML=NUML+256: NUMH=NUMH-1 120 IF NUMH<0 THEN GOTO 40 130 IF NUMH>255 THEN GOTO 40 140 POKE DL4,NUML:POKE DL5, NUMH 150 GOTO 40
Eastern Front Example
Finally an example video for the game Eastern Front can be viewed below. Take careful notice of the fine scrolling taking place. Thanks for stopping by. Feel free to leave comments.