'Future.Library using Future.EMSPutx
'

REM $INCLUDE: 'future.bi'
Set640x480 8 'Set 640x400 8 bit svga screen


handle% = AllExpMem(256000) 'get 256000 of EMS memory


FOR i% = 1 TO 255
Changepal i%, i% \ 6, i% \ 5, i% \ 4
NEXT

Future.EMSGet 0, 0, 639, 399, handle%

DefineEMSBufferSize handle%, 640, 400, 0

dx% = -1
dy% = 1
dx1% = 1
dy1% = 1
dc% = 1
X% = 320
Y% = 200
X1% = 320
Y1% = 200

Future.CLS 0
RANDOMIZE TIMER
DO
        SetEMSpage 0
        X% = X% + dx%
        IF X% > 640 THEN dx% = -((RND * 1) + 1)
        IF X% < 1 THEN dx% = (RND * 1) + 1
        Y% = Y% + dy%
        IF Y% > 400 THEN dy% = -((RND * 1) + 1)
        IF Y% < 1 THEN dy% = (RND * 1) + 1
        X1% = X1% + dx1%
        IF X1% > 640 THEN dx1% = -((RND * 1) + 1)
        IF X1% < 1 THEN dx1% = (RND * 1) + 1
        Y1% = Y1% + dy1%
        IF Y1% > 400 THEN dy1% = -((RND * 1) + 1)
        IF Y1% < 1 THEN dy1% = (RND * 1) + 1
        c% = c% + dc%
        IF c% >= 255 THEN c% = 255: dc% = -((RND * 3) + 1)
        IF c% <= 1 THEN c% = 1: dc% = (RND * 3) + 1
       
        Future.line X%, Y%, X1% - 1, Y1% - 1, c%, -1
        Future.line X% - 1, Y% - 1, X1%, Y1%, c%, -1
        Future.line X%, Y%, X1%, Y1%, c%, -1
        Future.line X% + 1, Y% + 1, X1%, Y1%, c%, -1
        Future.line X%, Y%, X1% + 1, Y1% + 1, c%, -1
        

        Setpage 0
        h! = h! + .25
        h1! = h1! + .3
        FOR i% = 0 TO 369
        xo% = COS(i% / 20 + h!) * 10
        yo% = i% + SIN(i% / 20 + h1!) * 10
        Future.EMSPutx 0, 40 + i%, handle%, xo%, yo%, xo% + 639, yo%
        NEXT
       
LOOP UNTIL INKEY$ = CHR$(27)

Future.MouseOff

DeallExpMem handle%  'free up EMS memory
ReSetScreen


