This series of articles will show you how to do what ATARI left out of the PILOT manuals, fancy tricks such as large letters and changing colors, useful features like breaking strings into words and using the mysterious commands in the demonstration programs.
When you run your PILOT program, three sets of instructions work together to give you the result you need. The operating system in the 400/800 provides the instructions for reading the keyboard, writing characters to the TV screen, and I/O devices, such as disk drives and printers. Additionally the PILOT cartridge contains the translation system which actually interprets your PILOT program for the ATARI hardware. These two systems working together allow the ATARI to perform the instructions you provide with the third type of instructions, the PILOT application program.
PILOT programs operate on data stored in the computer's memory or RAM (random access memory). PILOT stores each variable, constant, or instruction as a value in a unique location or address. These are like P.O. boxes. You can put messages into them and read data from them. Some addresses are used by the operating system to hold information such as the color used on the screen and what size text characters to print, large or small. PILOT lets you change the contents of these addresses to give greater graphics control.
The operating system supports fourteen different ways to display data on the screen. Those of you familiar with BASIC know eight of these modes. PILOT normally uses only two modes, Graphics 0, and Graphics 7, these are a text and a graphics mode. But you can turn on at least two of the extra modes to display large letters as eyecatching program titles.
To enable large text, we need to change values in two special addresses, 1373 and 1374, by using a special form of the Compute command:
C:@B1373 = 16 C:@B1374 = 1
This command might read as: "COMPUTE the 'byte' at address 1373 equals 16". A byte is computerese for a value in memory. The first command puts a 16 in address 1373 to tell the ATARI that you want a graphic screen with regular letters at the bottom. The value 1 at address 1374 tells the ATARI that you want it to print medium large letters. These mode 1 letters are so large that only 20 fit on a line. Listing 1, lines 20 and 30, demonstrate these commands.
The next command you'll need is WRITE. It tells the ATARI to write data to a specific "device." These devices are identified by letters such as "D" for disk, "P" for printer, "C" for cassette and "S" for screen. Line 40 tells the ATARI to write to the screen "MODE 1 LETTERS." Of course, it will write anything you want. So, with those three simple commands, you have a dramatic opening for a program.
Change the contents of location 1374 to determine the size and number of characters per line.
|1374 = 0||regular letters, 40 per line|
|1374 = 1||20 rows of medium letters|
|20 characters per line|
|1374 = 2||10 rows of large letters|
|20 characters per line|
The *TEST 2 module demonstrates mode 2 large letters. In both modes, try using upper, lower and inverse characters. You'll find that each prints in a different color for interesting effects.
Address 1373 is the "sub-mode" address.
|1373 = 0||a full screen (no "text window")|
|1373 = 16||split screen (text "text window")|
|1373Z = 32||full screen opens without erasing prior data|
Listing 2 uses the 32 sub-mode to erase the text window. If you're in sub-mode 0 or 32, any text (even the READY at the end of a program) clears the screen; use a PA: command to keep the screen up. To change any mode or sub-mode, you must CLOSE:S between modes and issue both 1373 and 1374 commands in the next mode. After entering a new mode, always issue a WRITE command before a type command (T:).
Next time, we'll look at changing colors and breaking strings into letters or words.
by Ken W. Harms
10 *TEST1 [MEDIUM LETTERS MODE 1 20 C:@B1373=16 [SPLIT SCREEN 30 C:@B1374=1 [SET MODE 1 40 WRITE:S, MODE 1 LETTERS 50 PA:240 [PAUSE TO WATCH SCREEN 60 CLOSE:S [REQUIRED TO CHANGE MODES 70 J:*TEST2 80 *TEST2 [LARGE LETTERS MODE 2 90 C:@B1373=16 [SPLIT SCREEN 100 C:@B1374=2 [SET MODE 2 110 WRITE:S, THIS IS MODE 2 120 T: "T"YPED TEXT APPEARS BELOW SCREEN 130 PA:240 140 CLOSE:S 150 J:*TEST0 160 *TEST0 170 C:@B1373=0 180 C:@B1374=0 190 WRITE:S, THIS IS WRITE IN MODE 0 200 PA:100