The QBasic Forum     RULES     Other Subforums, Links and Downloads    Index of Threads

 Return to Index  

Screen Saver

October 26 2003 at 2:13 AM
Kozak  (no login)

I managed to create this program after reading up on Alipha's tutorial and thanks to some other people who gave advise here and there. It is nothing complicated really, but im quite proud of it. My first program using DMA.

DIM a(90, 40) AS INTEGER
DIM x AS INTEGER
DIM y AS INTEGER
DIM z AS INTEGER

SCREEN 0

CLS

PRINT "initializing"

LET intensity = 985

DEF SEG = &HB800
RANDOMIZE TIMER

OUT &H3C8, 0
OUT &H3C9, 0
OUT &H3C9, 0
OUT &H3C9, 0

FOR x = 11 TO 63 STEP 4
OUT &H3C8, (x - 11) / 4 + 1
OUT &H3C9, 0
OUT &H3C9, x
OUT &H3C9, 0
NEXT x

OUT &H3C8, 15
OUT &H3C9, 63
OUT &H3C9, 63
OUT &H3C9, 63

FOR i = 0 TO 15
PALETTE i, i
NEXT i

DO
FOR x = 1 TO 80
IF a(x, 0) = 0 THEN
a(x, 0) = RND * 1000
IF a(x, 0) < intensity THEN
a(x, 0) = 0
ELSE
a(x, 0) = 15
END IF
ELSE
b = RND * 1000
IF b < (intensity + a(x,0)) THEN
a(x, 0) = a(x, 0) - 1
ELSE
a(x, 0) = 15
END IF
END IF
NEXT x
FOR x = 1 TO 80
FOR y = 30 TO 1 STEP -1
a(x, y) = a(x, y - 1)
IF a(x, y) < 0 THEN a(x, y) = 0
NEXT y
NEXT x
FOR x = 24 TO 1 STEP -1
FOR y = 1 TO 80
offset = (x - 1) * 160 + (y - 1) * 2
POKE offset, RND * 222 + 32
offset = offset - 1
POKE offset, a(y, x)
'LOCATE x, y
'PRINT a(y, x)
NEXT y
NEXT x
FOR x = 1 TO 3000
FOR y = 1 TO 3000
NEXT y
NEXT x
LOOP WHILE INKEY$ = ""

PRINT "Press any key to exit..."

DEF SEG

END


 
 Respond to this message   
Response TitleAuthorDate
 Re: Screen SaverThe_LaptopOct 26, 2003