PROGRAMMER'S PAGE
PROGRAMMING FOR EFFECT: DARE TO DAZZLE
RANDY THOMPSON
This month I've compiled some reader tips that are sure to catch your attention. I like to call them dazzlers because of their flashy, graphic appeal. Try a few and see what you think.
Flash!
After running the following program, all shifted characters displayed on the 64's screen flash wildly. By taking advantage of the computer's extended color background mode, this machine language routine toggles the characters' background colors, making the letters appear to flicker and glow.
MQ 100 FOR 1 = 679 TO 758 : READ D : POKE I, D : NEXT PB 110 SYS 679 : POKE 251, 1 : POKE 252, 6 : POKE 253, 3 : POKE 53281, 0 : POKE 53280, 0 XF 120 POKE 53283, 15 BE 130 PRINT "{CLR}WITH THIS PROGRAM ANY {YEL} SHIFTED {CYN} CHARACTERS" JJ 140 PRINT "{11 SPACES} ARE HI GHLIGHTED" BD 150 REM POKE 251, SPEED OF FLASH KB 160 REM POKE 252, COLOR 1 QG 170 REM POKE 253, COLOR 2 HK 180 DATA 120, 169, 192, 141, 20, 3, 169, 2, 141, 21, 3, 173, 17, 208, 9, 64 PS 190 DATA 141, 17, 208, 169, 0, 133, 162, 88, 96, 165, 162, 197, 251, 240, 3, 76 SB 200 DATA 49, 234, 173, 252, 3, 201, 1, 240, 4, 201, 2, 240, 17, 165, 252, 141 FJ 210 DATA 34, 208, 169, 2, 141, 252, 3, 169, 0, 133, 162, 24, 144, 225, 165, 253 SC 220 DATA 141, 34, 208, 169, 1, 141, 252, 3, 169, 0, 133, 162, 24, 144, 208, 2
You can change the speed at which the letters flash by POKEing a value 0-255 into memory location 251 after running the program. The lower the value, the faster the characters flash—except in the case of the value 0, which is the slowest setting possible (1 is the fastest).
To change the background color of the flashing characters, POKE two different color values into locations 252 and 253. The machine language routine will alternate between these two colors to create the flashing effect.
You can easily disable the flashing by turning off extended background color mode. Turn it off with POKE 53265, PEEK(53265) AND 191. If you want the effect to run again, turn it back on with POKE 53265, PEEK (53265) OR 64.
JOEL SUDQUIST
STERLING HEIGHTS, MI
Screen Scrambler
Here's a routine that scrambles and then clears your computer screen. It works by decreasing the value of each character's screen code until all of the characters turn into spaces. It's an eye-catching way to remove information from the screen, and it works with the 64 and the 128 in 40-column mode.
MS 10 AD = 4864 QQ 20 FOR 1 = 0 TO 49 : READ D : POK E AD + I, D : NEXT GS 30 DATA 169, 4, 133, 251, 160, 0, 132, 250 FJ 40 DATA 132, 252, 177, 250, 201, 32, 240, 15 AX 50 DATA 162, 1, 134, 252, 201, 0, 208, 2 QC 60 DATA 169, 33, 170, 202, 138, 145, 250, 230 KQ 70 DATA 250, 208, 231, 230, 251, 165, 251, 201 KF 80 DATA 8, 208, 223, 165, 252, 201, 0, 208 QH 90 DATA 207, 96
After you've run the program, execute SYS 4864 to clear the screen. For the best results, get a bunch of characters on the screen first. For such a simple concept, the effect is really quite impressive.
By default, this program stores its screen-clearing machine language routine in memory at 4864–4913. By changing the value assigned to AD in line 10, you can move the routine to any 50-byte area of free memory. Just remember to change your SYS statements to reflect this change. For example, if you move the routine into the 64's cassette buffer located at 828, you must enter SYS 828 to invoke the screen scrambler.
STACY OLIVAS
GRAHAM, WA
128 Screen Split
For an interesting example of scrolling the 128's split graphics screen, type in and run the following demo program. Don't clear the graphics screen before you run the program. In fact, it's best if you turn the computer off and then on again before entering the listing.
PH 10 GRAPHIC 2, 0, 0 EB 20 FOR I = 48 TO 249 QS 30 POKE 2612, 1 QG 40 NEXT MR 50 FOR I = 249 TO 48 STEP -1 QA 60 POKE 2612, I RJ 70 NEXT QF 80 GOTO 20
This program opens a hi-res graphics screen and smoothly scrolls it down over the text screen and back up again. It does this by altering memory location 2612. This location holds the raster number used by the interrupt routine that controls the GRAPHIC 2 and GRAPHIC 4 split screen.
STEVE SCHOWIAK
GIESSEN, WEST GERMANY
"Programmer's Page" is interested in your programming tips and tricks. Send all submissions to Programmer's Page, COMPUTE's Gazette, 324 West Wendover Avenue, Suite 200, Greensboro, North Carolina 27408. We'll pay $25–$50 for each tip we Publish.