Odds & Ends: Atari
Add A Text Window To GRAPHICS 0
Charles Brannon
Editorial Assistant
Here is an example program to demonstrate the use of the window. It is a simple disk menu program. Notice that you don't need to use PRINT #6 to print to the upper part of the screen until after the POKE 703,4 takes place.
The text window can be a useful feature in the graphics modes, enabling a simultaneous text and graphics display. The text window is very similar to a miniature GRAPHICS 0 text screen: all the editor functions are supported, and scrolling and screen clearing are confined to the small four-line window.
This same capability would be useful for a GRAPHICS 0 display. For example, a menu, a list of choices, could be presented in the top twenty or so lines of the screen, and the user's input taken in the lower four lines of the text window. Any errors, such as the user typing editor keys in an INPUT statement, would not interfere with the rest of the screen. Conveniently, any scrolling when caused by a line like this one:
150 PRINT "NAME"; : INPUT N$ : IF LEN(N$)>8 THEN PRINT "* TOO LONG *" : GOTO 150
would not cause the menu above it to scroll as well.
How is all this done? With a single POKE statement. Location 703 normally contains the number 24. If you POKE a four in its place, the cursor is zapped to the bottom of the screen and the text window is in place.
Note that you can't print to the upper part of the screen with PRINT statements; you have to use PRINT#6 as you do with GRAPHICS modes 1 and 2. The POSITION statements also only affect the upper part of the display, you must use POKEs to position text window output.
100 REM DEMONSTRATES "TEXT WINDOW" 110 REM SIMPLE MENU PROGRAM 120 REM FOR DISK DRIVE 130 TRAP 150 140 OPEN #1, 6, 0, "D : *.*" : GOTO 160 150 ? "Can't read directory" : END 160 GRAPHICS 0 : COL = 0 = POKE 752, 1 : REM DISABLES CURSOR 170 DIM A$(20),F$(14) : TRAP 230 180 INPUT #1; A$ 190 POSITION COL,LINE : ? A$(1, 14) 200 LINE = LINE + 1 210 IF LINE>20 THEN COL = COL + 13 : LINE = 0 220 GOTO 180 230 POKE 703, 4 : REM CREATES TEXT WINDOW 240 FOR I = 1 TO 100 : ? I,: NEXT I : REM ONLY FOR DEMONSTRATION 250 ? "{CLEAR}Run which program"; : INPUT A$ : REM CLEAR ONLY CLEARS WINDOW 260 TRAP 290 270 F$ = "D : " = F$(3) = A$ 280 RUN F$ 290 ? "Can't RUN ";F$;"." 300 END