Classic Computer Magazine Archive ANTIC VOL. 3, NO. 1 / APRIL 1984



Logo's Antics



This article explains where to locate machine-language programs when using the Logo programming language, and how to create text displays with large letters. The program requires the Logo cartridge from Atari, and runs on all Atari computers.

The secrets of Atari's Logo finally are beginning to emerge! This month we'll discuss two places where you can store your machine-language code and a method that allows you to use Logo to print large letters on the screen. We'll even be able to move turtles aronnd on a text screen! (by the way, both of these topics were covered in direct response to readers requests -- so if you want it, ask for it!)


First of all, Logo is not an "applications" language. That is, it was designed to serve as an environment for experimentation, rather than as a language for writing polished, arcade-style game programs. It doesn't offer sophisticated error-trapping capabilities, or easy access to the Atari's own special capabilities. Atari did take special pains to produce an improved Logo that is highly compatible with Apple Logo. That's the good news. The had news is that -- as a result -- we Atari users often have to deal with the Apples poor design as we travel in Logo's world. Wouldn't you love to have access to the Atari's full-screen editor in Logo?

Logo's memory is divided into two sections, oner below the graphics screen and one above it, because Apple does it that way. As in all Logos, this memory, called "nodespace," is made up of five-byte units called nodes. This space is used to store your program and to execute its procedures. To find it's way around nodespace, Logo sets up a series of "pointers" that tell it where things are. Generally, pointers are two bytes long, and are stored low byte first, then high byte. (A byte is a character or a numerical value.)


Now we're ready to consider the best way to store machine-language programs. But, just to make things more interesting, note that nodespace pointers are only one-byte long -- the "high" byte. The pointer at 14268 directs us to the start of the first bank of nodespace, or the bottom of memory. To get this decimal address, type:

PR 256 * .EXAMINE 14268

Let's call this address STARTONE. ENDONE, the end of the first bank, is pointed to by the high-byte at 14271. The two pointers for the second bank are STARTTWO at 14269 and ENDTWO at14270.

Just as in BASIC, the best hiding place for machine code is an area of memory that the language processor has "forgotten." So, just move up the bottom of memory by .DEPOSITing a new value in 14268. Logo only stores page addresses (a 'page' is 256 bytes), so if you add one to the value in STARTONE, memory moves 256 bytes. But -- since nodespace is made up of 5-byte nodes and five doesn't divide into 256 evenly -- it soon becomes apparent that we have to move the bottom of memory in increments of five pages each -- or a whopping 1280 bytes! By the way, the folks at LCSI have warned that memory shoyld be moved only when Logo is first booted.

If you don't need 1280 bytes and aren't planning to create your own turtle shapes, a good storage area is the shape table, which is ordinarily used to store the shapes you create with the shape editor. This table has 256 bytes and starts at 13824. You can probably use the SETSH command sequence to install the code without a series of .DEPOSITs


Atari computers use several processors. The one we think of as "the computer" is a 6502 microprocessor. The Atari uses another processor to handle the screen display so that the 6502 can work as efficiently as possible. This is the main reason that the Atari 800XL is more "powerful" than the Apple IIe; Atari's special processor frees the 6502 to make calculations more efficient than the Apple can.


This special processor is called ANTIC, or the ANTIC chip. ANTIC is actually a tiny computer. It needs a special program, called a display list, to tell it how to display the data that the 6502 processor puts into memory. Each of the different display modes is simply a different program for ANTIC. So we can produce large letters by providing ANTIC with a large-character display program. The one I've chosen is known in BASIC as Graphics 2. Under Logo, it displays 12 lines of 20 characters in four colors.


Using the listing as our road map, let's build a special display list for Logo. Chris Mitchell, a computer hobbyist, musician and colleague of mine who lives in Seattle, came up with the idea of using the screen buffer as a text screen. This allows us to display both the turtle and text at the same time! As a result, you can use a specially-shaped turtle as a pointer to highlight words or make the regular turtle dance around the title of your program. (Unfortunately, however, if you try to draw with the turtle either your drawing will not appear, or it will display weird characters. Sorry about that!)

To set up, we first call a Full Screen, followed by a Hide Turtle (leave this out if you want the turtle to appear on the screen) and a Clear Screen. The last step ensures that we won't display an old drawing. ANTIC looks for a display list memory address pointed to by the two-byte pointer at 560 and 561. The second line takes those values and uses them to start building a new display list. Generally the first values in the list are 112's, which tell ANTIC to display blank lines (these allow for TV pictures that aren't quite right). The next instruction, a 71, tells ANTIC that we're going to display Graphics 2 characters.

The next two values, 17 and 59, make up a two-byte pointer to the data that ANTIC will display. At this point, things get a bit tricky. Logo uses a two-byte pointer at 14272 and 14273 to find the start of the screen buffer that we use for our data. The buffer is 960 bytes long. But we're using only 240 bytes (12 lines of 20 bytes). As a result, if we start at the beginning of the buffer we'll encounter 36 blank lines before seeing anything on the screen. Because of this, we simply skip 720 bytes to the 240 bytes we need. If you're using a 64K system, use 209 and 66 instead of 17 and 59. The next 11 peices of data in the list are sevens. These tell ANTIC to "display this line as large letters." Next, we send ANTIC a 65 to tell it that we're finished. Finally, ANTIC needs the address of the next program, or display list. In this case, we simply use the values for the same display list, since we want ANTIC to jump back to the beginning and do it again.


I hope that at this point you'll be off and running with these special displays for your Logo programs. Further information on display lists can be found in a series of articles in ANTIC by Allan Moose and Marian Lorenz (Display Lists Simplified, page 33, February/March 1983; Start Interrupting, page 24, June 1983; More Interrupting, page 54, December 1983). If there's enough interest, I'II cover procedures for other special displays in future columns. By the way, when you exit these special modes, use a TS (text screen) and a CT (clear text) to get everything back to normal.

Ken Harms, our Contributing Editor for the Logo/PILOT department, is Vice President of administratzion for the California Division of the American Cancer Society.

Listing: SAFESPC.LGO Download / View