Fast Banner

Sol Guber

Run an advertisement or display banner across the screen.

The internal registers of the Atari are easily accessed and many interesting effects are possible without much difficulty. This program will place a message on the screen and then move it along the screen, shifting the color every time the message is printed. The speed can be controlled so that the letters move very slowly or at a speed where they cannot be read. This is one step away from animation for the Atari.

The program is divided into three parts. The first part determines the message and translates it into a string variable. The second part decides which part of the string to put onto the screen. The second part consists of machine language subroutine that specifically moves the string onto the screen. The nice thing about this program is the size. The total memory usage of the program is less than 3.5K and will produce any message up to 120 characters long.

A small amount of information about the internals of the Atari is needed to understand fully how the program works. The screen memory is a continuous section of memory that stores the information linearly. For each Graphics mode, the exact location of the beginning of memory is stored in locations 88 and 89, with 89 being the HI portion of memory. The size of the screen memory depends on the Graphics mode and for Graphics 4 is 480 bytes long (10 * 48). Graphics 4 is a single color mode so that the information stored in each byte will determine which pixel on the screen is lit. Thus, if the byte contains the number 170 (10101010 in binary), every other pixel will be lit. If the byte contains the number 255 (11111111 in binary), every pixel will be lit. If the byte contains the number 0, then no pixel will be lit. Every spot on the screen will have a corresponding number in the screen memory, and every time a number is POKEd into the screen memory, it will have an effect on the screen.

To put a letter on the screen, the right information needs to be put into the screen memory. Because of the linearity of the screen and the fact that there are eight lines that make up each letter, it is not possible to put the eight bytes in a simple configuration in Graphics 4. To make a letter, information must be put in a screen memory byte, then in a screen memory ten bytes further, then in a screen memory ten bytes further, and so forth. The information on how to make the letter is its binary component, and this is made up of eight bytes. This information is presently stored in memory and can be generated for each letter as needed. To use this information, it must be removed from memory and stored in a variable. The two methods to do this would be a dimensioned variable or a string variable for the large amounts of information needed. The Atari BASIC stores each number as a six byte word and takes up a great deal of memory to store many numbers. The Atari BASIC stores string variables with one letter per byte and is much more compact when a great deal of information needs to be stored. Thus, the eight bytes of each letter are stored as a part of a string, and the 960 numbers take up only 960 bytes rather than the 5760 that would be taken up if they were stored as numbers.

A description of the program follows.

Lines 5–7 initialize several constants that will be used throughout the program. Line 10 dimensions the three string variables that will be used. Line 15 puts the value of 0 into the string L$ and line 18 determines where in memory the string L$ is found. Lines 20–48 determine the message, its length, how many times it is to cycle, and the speed of it.

Lines 50–120 translate the string message into its components and put it into the string L$. The subroutine at 600 determines where the offset of the letter is found in memory, and variable 13 contains that value. The value in that byte is stored in L$ with a 120 byte offset for each line. The sound is turned on to show that something is happening. It cycles through eight times for each letter, and each letter is put into an appropriate spot in the string L$.

Line 125 turns off the sound and goes into Graphics 4. Line 127 goes to the beginning of the string L$ and defines a variable R which will be the color variable. In Graphics 4, the color register is located at 708 and the value in 708 defines the color of the letters. Its format is that the first four bits in the byte define the intensity of the color and the last four bits define the color itself, with the first bit in the byte being ignored. Thus, there are eight intensities to the color and 16 colors possible. To shift from one color to the next at the same intensity, a multiple of 16 is added to the value of register 708. The maximum value is 255 as for any register. Line 129 defines the point on the screen memory where the message will start.

Lines 130 to 190 put the message into the screen memory and the system itself puts it onto the screen. Line 130 defines the number of cycles for the message. Lines 133–134 define the color for the message cycle. The heart of the movement is in the loop from 140-165. Line 153 points to the letter in the message that is to be on the far left of the screen. The machine language subroutine on page six (1536) moves the appropriate letters to the screen memory. Line 163 is a timer that displays the line for a certain amount of time before it is shifted over to the next letter. When the speed is fast, the time lag is short and the letters look as if they were marching across the screen. When the speed is very fast, the letters are a blur. The subroutine at 3000 reads in a machine language subroutine into page six of memory where it is used to move parts of the string variable L$ into the screen memory.

This program opens up several possibilities for further utilization. The subroutine can be modified to put anything on the screen anywhere. With changes in the graphics mode, the size of the letters can be doubled or decreased by 25%. Any of the graphics characters can be used by the program. With modification, the letters can be reversed or made upside-down or even sideways. Using interrupts, the colors can flow along with the letters so that each letter can be a different color. The possibilities are endless for showing off the capabilities of your Atari computer.

PROGRAM. Fast Banner.

5 C1 = 1 : C16 = 16 : C4 = 4 : C0 = 0 : C7 = 7
6 LTT = 600 : C31 = 31 : C32 = 32 : C128 = 128 : C96 = 96 : C64 = 64 : C127 = 127 : C12 = C4 + C7 + C1
7 C2 = 2 : C120 = 120 : C60 = C64 - C4
10 DIM L$(960), A$(110), O$(1)
15 L$(1) = "{,}" : L$(960) = "{,}" : L$(2) = L$
18 LPT = ADR(L$) + C4 + C1
30 INPUT A$ : N = LEN(A$)
45 GOSUB 3000
48 ? "HOW FAST 1 - SLOW 10 - FAST" : INPUT S2 : S2 = (C128 + C32) / S2
50 FOR I = C1 TO N
60 0$ = A$(I, I) : GOSUB LTT
70 13 = 57344 + X * 8 : FOR J = C0 TO C7 : M = PEEK(I3 + J)
80 Y = J * 120 + I : POKE Y + LPT, M
115 SOUND 1, M + C16, 10, 8
125 SOUND 1, 0, 0, 0 : GRAPHICS C4 + C16
127 LPT = ADR(L$) : R = C16 - C4
129 T = PEEK(88) + 256 * PEEK(89) + 59
130 FOR K = C1 TO N1
133 R = R + C16 : IF R <= 255 THEN POKE 708, R : GOTO 140
134 R = 12 : POKE 708, R
140 FOR I = C0 TO N + C4
155 A = USR(1536, LPT + I, T)
163 FOR K1 = 1 TO S2 : NEXT K1
165 NEXT I
175 R = PEEK(708)
190 NEXT K
500 STOP
600 X = ASC(0$) : IF X > C127 THEN X = X - C128
610 IF X > C31 AND X < C96 THEN X = X - C32 : RETURN
620 IF X < C32 THEN X = X + C64
3000 FOR I = 1536 TO 1600 : READ X : POKE I, X : SOUND 1, X, 10, 10 : NEXT I
3005 SOUND 1, 0, 0, 0
3010 DATA 104, 104, 133, 199, 104, 133, 198, 104, 133
3020 DATA 201, 104, 133, 200, 162, 8, 160, 12
3030 DATA 177, 198, 145, 200, 136, 208, 249, 24
3040 DATA 165, 200, 105, 10, 133, 200, 144, 3
3050 DATA 230, 201, 24, 165, 198, 105, 120, 133, 198
3060 DATA 144, 3, 230, 199, 24, 202, 208
3070 DATA 221, 96, 0, 0, 0, 0, 0, 0, 0, 0, 0
3080 DATA 202, 208, 215, 96, 0, 0, 0, 0, 0, , 24

Return to Table of Contents | Previous Section | Next Section