The Editors and Readers of COMPUTE!
If you have any questions, comments, or suggestions you would, like to see addressed in this column, write to "Readers' Feedback," COMPUTE!, P.O. Box 5406, Greensboro, NC 27403. Due to the volume of mail we receive, we regret that we cannot provide personal answers to technical questions.
The Logic Of Lines
How do you turn off the automatic scroll of text in Atari's graphics mode 0? My program puts a menu at the top of the screen and prints text on the next 18 lines. I delete the sixth line when the screen gets full, but everything scrolls up from one to three lines, instead of just one.
The problem you are having is common on eight-bit computers with text mode. Although the screen display always contains the same number of physical lines—23 lines, in the case you mention—it may contain a different number of logical lines at any given time. A logical line is a collection of one or more linked physical screen lines. When you clear the screen, every logical line is set to the corresponding physical line. But if printing overlaps from one line to another, the computer links the two physical lines into a single logical line. On the Atari, a logical line may contain as many as three physical lines. When you enter a program line, the computer rings a bell to warn you when you near the end of the third logical line; it's a warning to indicate that you're almost at the end of the legal size of a logical line.
Whether you're typing a program, running it, or entering direct commands, the logical line system is always enabled. That's why BASIC program lines or a typed response to an INPUT statement can be only three lines long. When the computer scrolls the screen, it scrolls an entire logical line, creating the effect you describe.
The easiest way to solve your problem is to limit the length of everything that's printed on the screen so that each logical line is only one physical line. If this is impractical, here's another solution:
POKE 690,255:POKE 691,255:POKE 692,255
Execute these statements in the program immediately before you delete a line.
They reset every logical line to one physical line. Although you might be tempted to experiment, it's better to avoid typing these POKEs in direct mode when you're editing a BASIC program. These statements split up all the lines on the screen that are longer than one logical line. If you then press RETURN over any of those partial lines, you may lose some of the program.
The Commodore 64 has a similar system of logical lines, except that its logical lines consist of either one or two physical lines. Here's an equivalent for the 64 to the three POKEs above:
FOR J = 217 TO 242:POKE J,PEEK(J) OR 128: NEXT
On the Commodore 128, logical lines can normally be up to four physical lines long. However, the 128 allows you to disable line linking so that all logical lines are just one physical line long. Turn this feature on with
POKE 248, PEEK(248) OR 64
To restore normal line linking, use
POKE 248, PEEK(248) AND 191