WINDOW gives BASIC a new command that draws a 3-D window: a block of colour with a black shadow, at any position and size and in any of the eight colours. The syntax is PRINT USR window;AT L,C;W,H;A, where L (1–20) and C (1–30) are the top left corner, W (1–30) and H (1–20) the width and height in characters, and A the colour (0–7). It only paints a background, so ordinary PRINT is used to put text in it. The demo shows a message in a window, waits for a key and then fills the screen with random windows.
It ran in Michael J. DiRienzo’s Mike’s Notebook column of January 1991, on the February 1991 RMG UPDATES disk. DiRienzo suggests using it with his GETPUT routine to save and restore the part of the screen a window covers.
Program Analysis
- Lines 10–110: the demo.
- Lines 200–290: loader.
CLEAR 49855, POKE 323 bytes into 49856–50178 with a checksum of 32454, thenRUN. - The code reads its own parameters from the rest of the PRINT statement: it checks for the semicolon, the
ATtoken and the commas, evaluates each number with the ROM, and stores the line, column, width, height and colour at 49920–49923. Errors in the syntax give “Nonsense in BASIC”.
Notable Techniques
- Parsing the PRINT statement that follows
USRgives the routine a keyword-like syntax. - The shadow is always black, as the column notes, which makes the panel look raised.
Potential Issues
- There is little checking of the sizes; a window that runs off the screen stops with “Integer out of range”.
- The code is not relocatable.
Typed in from the Mike’s Notebook column on RMG Enterprises’ monthly RMG UPDATES disk for January 1991, where the program exists only as a listing in the column’s text. The DATA total matches the checksum in line 230. It was tokenized for tape and tested in ZEsarUX.
Source Code
10 LET window=49856
20 PRINT USR window;AT 5,4;25,4;5
30 PRINT PAPER 5; INK 2;AT 6,5;"This is the window DEMO!"; FLASH 1;AT 7,5;"Press a key to continue."
40 PAUSE 0
50 LET line=INT (1+RND*19)
60 LET column=INT (1+RND*29)
70 LET width=INT (1+RND*(31-column))
80 LET height=INT (1+RND*(21-line))
90 LET color=INT (1+RND*7)
100 PRINT USR window;AT line,column;width,height;color
110 GO TO 50
200 CLEAR 49855: LET t=0
210 FOR n=49856 TO 50178
220 READ a: POKE n,a: LET t=t+a
230 NEXT n: IF t<>32454 THEN PRINT FLASH 1;"Data Error! Recheck DATA lines": STOP
240 RUN
250 DATA 17,117,33,225,167,237,82,32,250,213,223,254,59,32,35,231,254,172,32,30,205,220,27,205,96,38,237,67,0,195,223,254,59,32,15,205,220,27,205,96,38,237,67,2,195,223,254,59,40,2,207,11,205,228,27,205,96,49,121,50,13,195
260 DATA 24,4,0,0,0,0,62,2,205,48,18,62,17,215,62,3,215,237,91,0,195,58,3,195,71,58,2,195,79,62,22,215,123,215,122,215,62,32,215,13,32,250,28,16,236
270 DATA 253,54,86,56,33,22,0,237,91,0,195,205,69,23,121,50,0,195,58,0,195,135,135,135,50,0,195,58,1,195,135,135,135,61,50,1,195,58,2,195,135,135,135,60,50,2,195,58,3,195,135,135,135,60,50,3,195
280 DATA 58,1,195,79,58,0,195,71,205,62,38,58,2,195,79,6,0,17,1,1,205,163,195,14,0,58,3,195,71,30,1,22,255,205,163,195,58,2,195,79,6,0,30,255,22,1,205,163,195,14,0,58,3,195,71,17,1,1,205,163,195,24,10,217,229,217,205,19,40,217,225,217,201
290 DATA 58,3,195,71,58,0,195,152,61,71,46,3,229,58,1,195,60,60,60,79,197,205,62,38,58,2,195,79,6,0,17,1,1,205,163,195,193,5,225,45,32,226,58,1,195,71,58,2,195,128,60,79,46,3,229,58,0,195,61,61,61,71,197,205,62,38,14,0,58,3,195,71,22,255,30,1,205,163,195,193,12,225,45,32,225,201Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

