Classic Computer Magazine Archive ANTIC VOL. 6, NO. 11 / MARCH 1988

Mr. Smoothy

Text scrolling deluxe with a powerhouse subroutine

by Kenneth Kaye

Mr. Smoothy is a powerful subroutine that lets you add a one-line smooth scrolling text window to your BASIC programs. Mr. Smoothy works in any Atari graphics mode and displays messages as long as 120 characters. To successfully use Mr. Smoothy with your own programs, you should be an intermediate B1SIC programmer. This BASIC program works with Atari 8-bit computers having at least 32K and a disk drive.

Mr. Smoothy is a machine language routine that lets you add a one-line smooth scrolling text window to your BASIC programs. Mr. Smoothy works in all bit-mapped graphics modes (Graphics 3-11). XL and XE owners can also use Graphics 14 and 15.

After loading a picture or drawing a screen, your BASIC program starts Mr. Smoothy with a USR command. Once started, Mr. Smoothy determines what part of the screen will be blocked-out by the text window and copies this part into a safe buffer.

Next, it opens the text window and scrolls your message through it. This window is eight mode lines high and can be between one and 40 bytes wide. (A mode line is a set of TV scan lines. A single mode line may contain as few as one scan line, as in Graphics 8; or as many as 16 scan lines, as in Graphics 2.)

Your message cannot be longer than 120 characters and it may not use any inverse-video characters. All other characters, including control characters and punctuation marks, can be used. Mr. Smoothy may also be used in programs which use redefined character sets, so long as the above two rules are observed.

The SMOOTHY demonstration needs two listings: a BASIC program and a data file containing Mr. Smoothy's machine language routines. Listing 1 is the main program, Listing 2 is a BASIC program which will create the data file.

Type in Listing 1, SMOOTHY.BAS, check it with TYPO II and SAVE a copy to disk. Once you have SAVEd SMOOTHY.BAS, type NEW. Do not RUN the program yet.

Next, type in Listing 2, SMOOTH2.BAS, check it with TYPO II and SAVE a copy to disk. When RUN, Listing 2 creates SMOOTHY's data file, SMOOTHY.DAT. Be sure that SMOOTHY.DAT and SMOOTHY.BAS are on the same disk. Antic Disk users will find SMOOTHY.DAT on their monthly disk.

Now, RUN Listing 1, SMOOTHY.BAS. When RUN, the program loads the SMOOTHY.DAT file, displays a flashy, scrolling title screen, then presents the Mr. Smoothy menu.


SMOOTHY.BAS is a menu-driven program which lets you create almost any type of scrolling text window. Mr. Smoothy's menu offers seven choices:

Choice 1 sets the graphics mode. You may use any bit-mapped mode (Graphics 3-11). XL and XE owners may also use Graphics 14 and 15.

Choice 2 sets the scrolling speed. Speed values range from 0 (fastest) to 15 (slowest).

Choices 3 and 4 determine the position of the upper left hand corner of the text window. Legal values are displayed next to each choice.

Choice 5 sets the width of the text in bytes. Legal values are displayed next to this item.

Choice 6 lets you set the color of the scrolling message. In a two-color mode (such as Graphics 4, 6, 8 and 14) you don't have a choice. However, you must still enter a value between 1 and 4.

In the four-color modes, you can color the text with any foreground color, or alternate the color of each character between the three. Numbers 1-3 refer to the same color registers as BASIC's COLOR command. A value of 4 will make each character an alternate color.

Choice 7 lets you type in your message.

For example, let's create a slowly scrolling window in Graphics 9. We want our window to be 20 bytes long, centered and displayed in alternating colors.

First, type a 9 at the GRAPHICS MODE prompt. As soon as we do this, Mr. Smoothy determines the proper screen dimensions and expresses these as legal values which we may use in positioning our window.

Now, set the speed of the scroll. A 15 will give produce slow scroll.

Next, position the window. Since the screen extends from column 0 to 39, the center column would be near column 19. Since half of our 20-byte text window will be to the left of this position, the text window must begin at column 19-10, in other words, at column 9. Using an out-of-range value here will probably crash the program or at least open your window in the wrong place.

Similary, if we have 184 rows available, the center onewould be row 92, which is what we enter for choice 4. Keep in mind that your window will extend seven rows below this point.

Next, enter 20 as the window length, and choose 4 to select alternating colors.

Finally, type your message, press [RETURN], and watch it scroll.


Mr. Smoothy isn't hard to include in your own BASIC programs as long as you follow a few guidelines. First, you must have a copy of the SM00THY.DAT file on your disk. Mr. Smoothy will not work without this file so if you use Mr. Smoothy in your own BASIC program, be sure SMOOTHY.DAT is on the same disk.

Next, make sure you use both Mr Smoothy subroutines. They are contained in lines 31000-31550 of the demonstration program.

Mr. Smoothy is initialized in the subroutine in lines 31000-31045. Call this subroutine once at the beginning of your program with a GOSUB 31000 statement. This subroutine DIMensions two string variables, lowers RAMTOP and loads SMOOTHY.DAT.

The second subroutine, beginning at line 31500, is the heart of Mr. Smoothy and contains the USR call which starts the scroll.

Note that the first two lines of this subroutine begin with REM statements. The jobs that these statements perform are handled in the main program. However, if you're using this routine in your own program, remove the REMs and insert your own values, as explained in the following take-apart.

Line 31500 places the message to be scrolled into MS$. Stores the graphics mode number in MODE.

Line 31510 places the values for scrolling speed, column and row number, and window length into SPEED, COL, ROW and WLEN.

Line 31520 is the USR call which starts the Mr. Smoothy routine.


To make Mr. Smoothy as efficient as possible, the routine uses direct addressing commands and is NOT relocatable.

The SMOOTHY.DAT program must be put into RAM beginning at address 38912 ($9800, the first byte of page 152). This is eight pages under the normal value of the RAMTOP pointer (memory location 106, $006A).

Although SMOOTHY.DAT is only 1,012 bytes long, it uses an additional 845 bytes to store screen RAM and other data, so you must reserve at least eight pages above your starting address.

It's best to leave another eight-page buffer under page 152 if you're using one of the higher-resolution modes. This occurs in line 31000.

Mr. Smoothy uses Zero Page bytes 203-214 ($00CB-$00D6) when scrolling. If your main program stores data in any of these locations, be sure to copy the data to another area of memory before entering Mr. Smoothy's USR call (line 31520).

Mr. Smoothy also installs a vertical blank interrupt, using the immediate mode vectors at VVBLKI, memory locations 546 and 547 ($0222 and $0223). The entire vertical blank interval is used, so no other processing can happen until the scroll is completed.

There are six error trapping routines in the code. If Mr. Smoothy won't scroll, it will usually display a USR ERROR# message. The number of this error message corresponds to the errors listed below:

1. Incorrect number of arguments.
2. String length exceeds 120 characters.
3. Window length exceeds 40 bytes.
4. Incorrect color value.
5. Illegal character in the string.
6. Not a map mode.

Kenneth Kaye is a 37-year-old press brake operator from Garfield Heights, Ohio. He has been programming in BASIC and assembler for four yeras and this is his first appearance in Antic.

Listing1:SMOOTHY.BAS Download

Listing2:SMOOTHY.DAT Download

Listing3:SMOOTHY.M65 Download / View