Screen Editing
As an ATARI owner, you will benefit from having its built-in "screen editor," one of the best available in the micro market. What's a screen editor? It's the built-in program that allows you to change words and letters after they have been keyed onto your display screen.
As you begin to program with your ATARI, you will come to appreciate this powerful tool. At first, though, it may seem strange to you, and you will make mistakes until you learn how it works.
The most important thing to do, in this or any other computer function, is to read the instructions. These are in your Operators Manual, and in the BASIC Reference Manual, under "Screen Editing" and "Editing." Read these, do the exercises, and experiment. Be bold. You cannot damage your computer by making keyboard errors.
Ground Zero
Connect your computer as instructed, insert the BASIC cartridge, and power-up. On a color television you will see a blue screen with black borders, the word READY, and the white cursor beneath the "R". Remember, this is not an exercise in BASIC, but in screen editing. The BASIC program used is just an example.
This blue screen is BASIC Graphics Mode 0, designed to display text. This mode divides the screen into 40 character positions across the screen and 24 lines down, i.e., a 40x24 grid yielding 960 character positions. Each position on the screen is the size of the cursor, and can be identified by its column and row number, beginning with 0,0 in the upper left corner and ending with 40,24 at the lower right. The first number, 40, indicates the column and the second number, 24, is the line number.
The content of each of the 960 positions is controlled by the Editor program, built into the ATARI Operating System. It takes one byte of memory to code the contents of each position. For the ATARI computers, this code is called the ATASCII code. You will find it in Appendix C of your Atari BASIC Reference Manual.
The important thing to know is that you can determine and change the content of these screen positions by using your keyboard. Editing deals mostly with changing and erasing the display.
You should now be running Atari BASIC and have the READY prompt on the screen. Type in the following program, beginning at "10 REM . . ." and be sure to include the misspelling of "capabilities." [RET] means press Return key. Begin!
10 REM * SCREEN EDITOR EXAMPLE * [RET]
20 PRINT "THIS IS AN EXAMPLE OF ATARI SCREEN EDITING CAPABILTIES" [RET]
RUN
Notice that as you typed line 20, the line "broke" between ATARI and SCREEN. This is an example of the "logical line" continuing over two "physical" lines. This phenomenon is called "wraparound." A logical line can be as long as three physical screen lines. The computer will "beep" when you are close to the logical line limit.
After the run, you should see on the screen:
THIS IS AN EXAMPLE OF SCREEN EDI
TING CAPABILTIES
READY
Now we will edit this material. Generally speaking, we edit by moving the cursor to the character position we wish to change and then changing the character. The cursor rests at the left margin below the R in READY. Find the Delete Back Space key (upper right corner), which we will represent as [DEL], and press it. The cursor does not move.
How can we move the cursor? Find the [CTRL] key. Press it down and hold it there. Find the "up" arrow key and press it three times. Release the [CTRL]. The cursor will move up three lines and be superimposed over the T in TING. Notice that the T appears dark blue within the field of the cursor. This condition is called "inverse video."
Press the space bar four times. The cursor moves across the letters of TING, erasing them as it passes.
To the right of the cursor is the word CAPABILTIES. Next, correct the spelling. Press and hold [CTRL], and press the right-pointing arrow key until the cursor is superimposed on the T. We want to insert the letter I. Holding the [CTRL], press the Insert key (top row, third from right).
Voila! A space opens between the L and the T. Release [CTRL] and type in the letter I. The cursor now rests over the letter T. To exit from the word without changing it further, press and hold [CTRL], and press the left-pointing arrow until you have backed out of the word. Release [CTRL].
Up and Over
Here is a surprise for you. Press [DEL] six times. This will be enough to make the cursor back up to the line above. This is due to wraparound. It would not be possible between logical lines without using the [CTRL].
We can now repair the damage done to the word EDITING by typing it again. When the cursor again rests between EDITING and CAPABILITIES, press and hold the [CTRL], press the down-arrow key three times, release [CTRL] and finally, press [RETURN].
Let's see if we have corrected the misspelling. Type LIST and press [RET]. This command rewrites the corrected program. You should have lines 10 and 20 come up, and the error is still there! That's because the correction was made to the "run," and not the program. This time we will fix it for good. Press and hold [CTRL]. Press the up arrow three times till the cursor is over the S in SCREEN. Press the right-pointing arrow key till the cursor is over the T in CAPABILITIES. Still holding [CTRL], press the Insert key. Pop! Release [CTRL], then [RET]. Type RUN and press [RET]. A new line should appear on the screen. Read your correction. WHAT! The error is still there?
That's right. This is the trickiest part of screen editing in BASIC. Remember, changes to the screen do not necessarily change the stored program. Changes within lines (deferred mode) are made permanent by pressing the return key [RET] before you leave the logical numbered line on which the change was made.
Let's do it right this time. Hold [CTRL]. M ove the cursor up until it is over the S in SCREEN. Hold the [CTRL] and press the right-arrow until the cursor is over our "I" (yes, it's still there in screen memory, but not in program memory). Release [CTRL]. This time, press [RET]. The cursor jumps down to the beginning of the next line, above the READY. Type RUN and [RET].
Aha! This time the change has been made in the program. Failure to use the screen editor correctly can cause you no end of grief. The main thing to remember is that all corrections to program (numbered lines) must be confirmed by pressing [RETURN] before moving the cursor from the corrected line.
by Robert DeWitt
Robert DeWitt is a journalist from San Francisco who began writing about computers in 1980 based on studies at Control Data Institute. He bought an ATARI as an apparent "best-buy " tool for his writing, and gravitated to the fledgling ANTIC through the local user group. He gradually assumed more of the editorial functions of the magarine, becoming Managing Editor in November, 1982.