Classic Computer Magazine Archive ANTIC VOL. 3, NO. 8 / DECEMBER 1984

the toolbox



The conclusion of a two-part series that shows you how to create onscreen text windows in Atari programs-in all graphics modes.  The BASIC program, Listing 1, runs on all Atari computers of any memory configuration.  Antic Disk subscribers RUN "D:WINDOWS2.BAS"

To best understand this article, you should read "Windows" (Antic, November 1984).  In that article we explained the technique of incorporating text windows in Graphics 0 text displays.  We used two assembler subroutines to convert ASCII characters to screen display format and display the characters in a text window that you define.
   This time we add another machine-language routine to provide high-speed display of colorful text within a graphics window in any BASIC graphics mode.  For a demonstration, type in Listing 1, check it with TYPO, SAVE a copy, then RUN it.  The program displays Graphics modes 8 to 3 in succession with a short pause in between, and creates three windows in each Graphics mode.  The text in each window shows the current Graphics mode and the color used for that window.  You needn't enter the assembler source code in Listing 2; this is provided for those who wish to alter the subroutine.
   To understand how the program works, examine the listing.  We add 16 to the graphics mode numbers in lines 180-230 to tell the computer to use the entire screen for the graphics mode.  If you alter this demo to use the routines in your own program, make sure that your MSG$ ends with CHR$(0) (looks like a heart, obtained by pressing [CTRL][,]), and WORK$ is cleared as shown in line 280.  WORK$ must be 16 times the length of MSG$.
   The BASIC demo stores two assembler routines in strings.  The window display subroutine stored in W$ is described in last month's article.
   The routine stored in E$ must reformat our message (MSG$) before the routine in W$ can move it into a graphics window.  Line 330 in Listing 1 demonstrates how to use the reformatting routine in E$ with a BASIC USR command.  The first parameter is the address of the routine, followed by the address of WORK$, the address of MSG$, the length of MSG$ less one, and a color code.  In the demo, the variable "LINE" is used as the color code.  When the three messages are displayed on the screen, the color code used for each message appears next to the world 'type.'
   Again, Antic is interested in printing any unusual or interesting use for these routines that you come up with.

Antic Contributing Editor Jerry White is a leading professional programmer of Atari software.  Dave Culbertson is vice president of Custom Electronics, Inc., an applications software house.

Listing 1: WINDOWS2.BAS Download

Listing 2: WINDOWS2.ASM Download / View