STARTING LINE
Screen Editing
by Robert DeWitt
As an ATARI owner, you will benefit from having its builtin "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 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 its workings.
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 for example.
This blue screen is BASIC Graphics Mode Zero, 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 every ATARI. 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 [RET]
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."
After the run, you should see on the screen
THIS IS AN EXAMPLE OF ATARI 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 to 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, 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 by typing the word EDITING. 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 to 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 CAPABILTIES. Still holding [CTRL], press the Insert key. Pop! Release [CTRL], type I. There!
Having corrected the I, let's exit the line. Hold [CTRL], press the down arrow three times, 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 equal changes to the Deferred Mode program. Changes within number lines (Deferred Mode) are made permanent by pressing the return key [RET] before you leave the logical line on which the change was made.
Let's do it right this time. Hold [CTRL]. Move 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 return. 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.
GLOSSARY
BASIC--Beginners All Purpose Symbolic Instruction Code. This high level programming language was developed at Dartmouth College as an instructional tool. Your BASIC cartridge translates your instructions (program) into numbers the ATARI understands.
K--as in "48K memory." This computer jargon indicates thousands. When someone says, "32K," they are referring to approximately 32,000 memory locations. To be absolutely correct K really means 1024. 1024 is two raised to the tenth power. Therefore, 32K is 32 x 1024 or 32,768.
BINARY--a method of coding in which only two representations exist; yes/no, on/off, 1/0 are examples. This coding technique lends itself to computers since power is either on or off.
BIT--an abbreviation for Binary Digit. A Binary Digit can hold one of two values, 0 or 1. Contrast this with a Decimal Digit which can hold any of ten values, 0, 1, 2, 3, 4, 5, 6, 7, 8, or 9.
BYTE--This word refers to one addressable location in ATARI memory. It has commonly come to refer to eight contiguous bits. A byte is the minimum addressable quantity in memory.
EDITOR--In computer terminology this refer to a program used to insert, delete, correct, or change text. The important distinction here is that these changes can be made without the necessity of having to retype the entire line. The ATARI screen editor that most of you use with BASIC is a good example.