In Sync: Effective Graphics on the TS 2068

Authors

Publication

Pub Details

Date

Pages

BASIC Terms

See all articles from T-S Horizons n15

When you try out a new program, the first impression you get is from the graphics. In fact, clever graphics (or lack o1) can make or break a well written but otherwise lackluster program. The following annotated routines show how simple but effective graphics displays are created. The program scrolls a 60 character message through a 16 character window, changes the message and then clears the screen. Type in the following program and run it. It’s surprising what a few lines of BASIC will do.

Set a$ to contain a 60 character message to be scrolled through the window. Repeat the first 16 characters of the message at the end.

 10 LET a$="...T-S Horizons...Your Timex/Sinclair information source.....T-S Horizons..."

Set the BORDER color, clear the screen and set the temporary PAPER color. Note that if you set the PAPER color before the CLS command the entire screen changes color.

 20 BORDER 4: CLS: PAPER 3

Draw a frame around the window. It takes a few tries to get the PLOT – DRAW coordinates right if you move the window.

 30 PLOT 54,97: DRAW 131,0
40 DRAW 0,-11: DRAW -11,0
50 DRAW 0,11: PLOT 51,99
60 DRAW 137,0: DRAW 0,-15
70 DRAW -137,-: DRAW 0,15

Scroll through the message three times.

 80 FOR a=1 TO 3

Loop through each character of the message.

 90 FOR b=1 TO 60

Slow down the message scroll and BEEP to get the user’s attention.

 100 PAUSE 10: BEEP .01,3

Print 16 character slices of the message in the window

 110 PRINT AT 10,7;a$(b to b+15)

End the two FOR-NEXT loops.

 120 NEXT b: NEXT a

Turn the OVER command on.

 130 OVER 1

“Roll” the message six times.

 140 FOR a=1 TO 6

DRAW over the message, top to bottom with 8 lines. The OVER command causes the message in the window to be inverted.

 150 FOR b=95 TO 88 STEP -1
160 PLOT 56,b: DRAW 127,0
170 PAUSE 3: NEXT b

Turn off the OVER command and BEEP to get the user’s attention.

 190 OVER 0: BEEP .05,2
200 BEEP .05,9: BEEP .08,20

Print a message so the user is sure the program is through.

 210 PRINT AT 10,7;"PROGRAM COMPLETE"

Change the temporary paper color 4 times.

 220 FOR b=3 to 7

Set the PAPER to the value of the variable ‘b’.

 230 PAPER b

This unusual FOR-NEXT loop PRINTs over each character in the window with the same character but a different PAPER color underneath.

 240 FOR a=7 TO 22
250 PRINT AT 10,a;SCREEN$ (10,a)

PAUSE and then close a FOR-NEXT loop.

 260 PAUSE 5: NEXT a

BEEP and close a FOR-NEXT loop.

 270 BEEP .05,b*8: NEXT b

This elaborate FOR-NEXT loop creates a very unusual display for clearing the screen. It draws a line over the message window with the OVER command off, then redraws over the same line with the OVER command on, effectively clearing that line from the screen. Since this is done from the top down and from the bottom up at the same time, it appears that the window slowly vanishes! It will take quite a bit of experimenting to get this routine to work with different windows, but the effect is worth the effort.

 280 FOR a=84 TO 91
290 OVER 0
300 PLOT 51,a+1: DRAW 137,0
310 PLOT 51,182-a: DRAW 137,0
320 OVER 1
330 PLOT 51,a: DRAW 137,0
340 PLOT 51,183-a: DRAW 137,.0
350 BEEP .2,(a-84)*7
360 NEXT a: OVER 0

Now that you have several graphic routines, I hope you experiment with them and try to adapt them for use in your own programs. Next month I’ll have a short renumber routine for the 2068 and 1000.

Products

 

Media

 

Image Gallery

Source Code

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

Scroll to Top