Real Windows for SuperBasic

Authors

Publication

Pub Details

Date

Pages

See all articles from QL Hacker's Journal 3

The QUANTA library has a number of routines that will allow real non-destructive windows in SuperBasic. Since I started working with C, I wanted the same feature written to used with both C compilers.

Before going straight into C, I decided to test my algorithm in SuperBasic. SuperBasic is far easier to do developmental testing on. I was not initially going for speed, but correctness of my algorithm. I’m glad I used SuperBasic, because my first couple of algorithms were way off the mark. After totally revamping my algorithm, I finally got the program to work.

Below is the SSB code for real windows in SuperBasic. It is slow, even when compiled. I’m presenting it here for its algorithm and not for actual use. I hope to translate it to both Small C and Lattice C, but so far a have a few details to work out. I hope you find it useful.

Since the program does not keep track of the dimensions of each window created, you can use the procedures to move a piece of the screen to another part of the screen. Save the part you want to move, then give different coordinates when you load it.

** This number may need to be changed as needed DIM store(5000)

DEFine PROCedure save_bg (length, height, x, y)
LOCal mem, i, j
mem = 1

FOR i = 131072+(y*128) TO 131072+((y+height)*128) STEP 128
FOR j = i+(x/4) TO i+((x+length)/4) STEP 2
store(mem) = PEEK_W(j)
mem = mem + 1
END FOR j
END FOR i
END DEFine save_bg

DEFine PROCedure load_bg (length, height, x, y)
LOCal mem, i, j
mem = 1

FOR i = 131072+(y*128) TO 131072+((y+height)*128) STEP 128
FOR j = i+(x/4) TO i+((x+length)/4) STEP 2
POKE_W j,store(mem)
mem = mem + 1
END FOR j
END FOR i
END DEFine load_bg

Here is an example program using the procedures:

100 save_bg 80, 100, 40, 20
110 OPEN #3, con_80x100a40x20_32
120 PAPER #3,0: INK #3,7
130 CLS #3
140 PRINT #3,"This is a test"
150 PRINT #3,"of real windows"
160 PAUSE 100
170 CLS #3
180 PRINT #3,"Hit Return"
190 PRINT #3,"to make this"
200 PRINT #3,"go away"
210 INPUT #3,in$
220 CLOSE #3
230 load_bg 80, 100, 40, 20

Products

 

Downloadable Media

 

Image Gallery

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

Scroll to Top