DECLARE SUB bmpload (file$)
DECLARE SUB fade2color (a%, c%, t%, r%, g%, b%)
DECLARE SUB plasmaoutput (w%)
DECLARE SUB plasmaout (w%)
DECLARE SUB getfonts ()
DECLARE SUB updatescroll ()
DECLARE SUB delay (i%)

DIM SHARED fsin1%(-1024 TO 1024), fsin2%(-1024 TO 1024), fsin3%(-1024 TO 1024)
DIM SHARED r%(255), g%(255), b%(255)

'$DYNAMIC
DIM SHARED buffer1%(32000), buffer2%(32000)
DIM SHARED font%(255, 7, 7)
DIM SHARED buffer00%(319, 31)
DIM SHARED buffer01%(319, 31)
DIM SHARED buffer02%(319, 31)

FOR i% = -1024 TO 1024
fsin1%(i%) = SIN(i% / 45) * 63
fsin2%(i%) = SIN(i% / 35) * 45
fsin3%(i%) = SIN(i% / 75) * 127
NEXT i%

DIM SHARED prec1%(-1024 TO 1024)

FOR i% = -1024 TO 1024
IF i% >= 0 THEN prec1%(i%) = i% MOD 256 ELSE prec1%(i%) = -(i% MOD 256)
NEXT i%


text$ = "Hi! This is Optimus at the ReAct demoparty (And at the pic 2) who decided to release any silly thing just for the contribution."
text$ = text$ + " These pictures are taken in Thessaloniki, with my scene friends Nuclear, Amoivikos, Vvas, Jobo and Nina. I was highly drunken that time, preety nice time, but preety weird..."
text$ = text$ + "I released crap (or no thing at all) since I am still very newbie and no time to be able to make something good,. and thus pains for me the silly perfectionist,. anyways ;P  "
text$ = text$ + "I am tired anymore,. going to quit working on the computer for today and have some more fun with scene friends in the party instead. Scene focus started to become tiring but I should reorganize myself and take things more easy.."
text$ = text$ + "See you in next party, in a better form and with more real and not bad prods done in a hurry at the partyplace I hope..         Exiting!                                                "



SCREEN 13
getfonts

OUT &H3C8, 255
OUT &H3C9, 63
OUT &H3C9, 63
OUT &H3C9, 63


delay 384
bmpload "friends0.bmp": plasmaoutput (0)
delay 1024
plasmaout (4)
bmpload "friends1.bmp": plasmaoutput (1)
delay 1024
plasmaout (3)
bmpload "friends2.bmp": plasmaoutput (2)
delay 1024
plasmaout (2)
bmpload "friends3.bmp": plasmaoutput (3)
delay 1024
plasmaout (1)
bmpload "friends4.bmp": plasmaoutput (4)
delay 1024
plasmaout (0)
bmpload "cpckeys.bmp": plasmaoutput (2)
delay 2048 + 1024
plasmaout (4)
delay 1024

REM $STATIC
SUB bmpload (file$)

c$ = " "
OPEN file$ FOR BINARY AS #1

fp& = 55

FOR i% = 0 TO 254
OUT &H3C8, i%

GET #1, fp&, c$
b% = ASC(c$) \ 4
fp& = fp& + 1
GET #1, fp&, c$
g% = ASC(c$) \ 4
fp& = fp& + 1
GET #1, fp&, c$
r% = ASC(c$) \ 4
fp& = fp& + 1
fp& = fp& + 1

OUT &H3C9, r%
OUT &H3C9, g%
OUT &H3C9, b%

NEXT i%


fp& = 1079

FOR y% = 199 TO 0 STEP -1
DEF SEG = &HA000 + y% * 20

FOR x% = 0 TO 319

GET #1, fp&, c$
c% = ASC(c$)
IF y% < 100 THEN buffer1%(y% * 320 + x%) = c% ELSE buffer2%((y% - 100) * 320 + x%) = c%

fp& = fp& + 1

NEXT x%
a% = INP(&H60): IF a% = 1 THEN fade2color 0, 255, 128, 0, 0, 0: END
WAIT &H3DA, 8: WAIT &H3DA, 8, 8
updatescroll
NEXT y%

CLOSE #1

END SUB

SUB delay (k%)
FOR i% = 1 TO k%
a% = INP(&H60): IF a% = 1 THEN fade2color 0, 255, 128, 0, 0, 0: END
WAIT &H3DA, 8: WAIT &H3DA, 8, 8
updatescroll
NEXT i%
END SUB

SUB fade2color (a%, c%, t%, r%, g%, b%)

OUT &H3C7, 0
FOR i% = 0 TO 255
r%(i%) = INP(&H3C9)
g%(i%) = INP(&H3C9)
b%(i%) = INP(&H3C9)
NEXT i%

FOR s% = 1 TO t%
FOR k% = a% TO c%
OUT &H3C8, k%
OUT &H3C9, r%(k%) + s% * ((r% - r%(k%)) / t%)
OUT &H3C9, g%(k%) + s% * ((g% - g%(k%)) / t%)
OUT &H3C9, b%(k%) + s% * ((b% - b%(k%)) / t%)
NEXT k%

WAIT &H3DA, 8: WAIT &H3DA, 8, 8

NEXT s%

END SUB

SUB getfonts

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

COLOR 255
FOR i% = 0 TO 255
LOCATE 1, 1: IF i% > 31 THEN PRINT CHR$(i%)
FOR y% = 0 TO 7
FOR x% = 0 TO 7
font%(i%, x%, y%) = POINT(x%, y%)
NEXT x%
NEXT y%
NEXT i%
CLS

END SUB

SUB plasmaout (w%)

FOR k% = 0 TO 255



FOR y% = 0 TO 199
DEF SEG = &HA000 + y% * 20
FOR x% = 0 TO 319

SELECT CASE w%

CASE 0
c% = fsin1%(x%) + fsin2%(y%) + fsin3%(x% - fsin2%(x% + y%)) + fsin1%(x% - y%)
CASE 1
c% = fsin2%(x% - y%) + fsin2%(y%) + fsin1%(x% - fsin2%(x% + y%)) + fsin1%(x% - y%)
CASE 2
c% = fsin2%(x% - y%) + fsin2%(y%) + fsin1%(y% - fsin3%(x% + fsin2%(y%))) + fsin2%(x% - fsin1%(y%))
CASE 3
c% = fsin3%(x% - y%) + fsin1%(y% - fsin3%(y% + fsin2%(y% - x%))) + fsin2%(x% - fsin1%(y%))
CASE 4
c% = fsin2%(x% - y%) + fsin3%(y%) + fsin1%(y% - fsin3%(x% + fsin2%(y%)))
CASE ELSE
END SELECT
IF prec1%(c%) = k% THEN POKE x%, 0
IF y% > 167 AND prec1%(c%) = k% THEN buffer00%(x%, y% - 168) = 0

NEXT x%
NEXT y%

'getbuffer
updatescroll

a% = INP(&H60): IF a% = 1 THEN fade2color 0, 255, 128, 0, 0, 0: END
WAIT &H3DA, 8: WAIT &H3DA, 8, 8
NEXT k%

END SUB

SUB plasmaoutput (w%)


FOR k% = 0 TO 255


yp% = 0: ypp% = 0
FOR y% = 0 TO 99
DEF SEG = &HA000 + yp%
FOR x% = 0 TO 319

SELECT CASE w%
CASE 0
c% = fsin1%(x%) + fsin2%(y%) + fsin3%(x% - fsin2%(x% + y%)) + fsin1%(x% - y%)
CASE 1
c% = fsin2%(x% - y%) + fsin2%(y%) + fsin1%(x% - fsin2%(x% + y%)) + fsin1%(x% - y%)
CASE 2
c% = fsin2%(x% - y%) + fsin2%(y%) + fsin1%(y% - fsin3%(x% + fsin2%(y%))) + fsin2%(x% - fsin1%(y%))
CASE 3
c% = fsin3%(x% - y%) + fsin1%(y% - fsin3%(y% + fsin2%(y% - x%))) + fsin2%(x% - fsin1%(y%))
CASE 4
c% = fsin2%(x% - y%) + fsin3%(y%) + fsin1%(y% - fsin3%(x% + fsin2%(y%)))
CASE ELSE
END SELECT

IF prec1%(c%) = k% THEN POKE x%, buffer1%(x% + ypp%)

NEXT x%
yp% = yp% + 20
ypp% = ypp% + 320
NEXT y%

yp% = 100 * 20: ypp% = 0
FOR y% = 100 TO 199
DEF SEG = &HA000 + yp%
FOR x% = 0 TO 319

SELECT CASE w%
CASE 0
c% = fsin1%(x%) + fsin2%(y%) + fsin3%(x% - fsin2%(x% + y%)) + fsin1%(x% - y%)
CASE 1
c% = fsin2%(x% - y%) + fsin2%(y%) + fsin1%(x% - fsin2%(x% + y%)) + fsin1%(x% - y%)
CASE 2
c% = fsin2%(x% - y%) + fsin2%(y%) + fsin1%(y% - fsin3%(x% + fsin2%(y%))) + fsin2%(x% - fsin1%(y%))
CASE 3
c% = fsin3%(x% - y%) + fsin1%(y% - fsin3%(y% + fsin2%(y% - x%))) + fsin2%(x% - fsin1%(y%))
CASE 4
c% = fsin2%(x% - y%) + fsin3%(y%) + fsin1%(y% - fsin3%(x% + fsin2%(y%)))
CASE ELSE
END SELECT

IF prec1%(c%) = k% THEN POKE x%, buffer2%(x% + ypp%)
IF y% > 167 AND prec1%(c%) = k% THEN buffer00%(x%, y% - 168) = buffer2%(x% + ypp%)

NEXT x%
yp% = yp% + 20
ypp% = ypp% + 320
NEXT y%

'getbuffer
updatescroll

a% = INP(&H60): IF a% = 1 THEN fade2color 0, 255, 128, 0, 0, 0: END
WAIT &H3DA, 8: WAIT &H3DA, 8, 8
NEXT k%


END SUB

SUB updatescroll

SHARED kt%, text$

'WHILE kt% < LEN(text$) * 32 - 1
FOR y% = 0 TO 31
buffer01%(319, y%) = font%(ASC(MID$(text$, kt% \ 16 + 1, 1)), (kt% MOD 16) \ 2, y% \ 4)
NEXT y%


FOR y% = 0 TO 31
DEF SEG = &HA000 + (y% + 168) * 20
FOR x% = 0 TO 318
buffer01%(x%, y%) = buffer01%(x% + 1, y%)
IF buffer01%(x%, y%) = 255 THEN buffer02%(x%, y%) = buffer01%(x%, y%) ELSE buffer02%(x%, y%) = buffer00%(x%, y%)
POKE x%, buffer02%(x%, y%)
NEXT x%
NEXT y%
'WAIT &H3DA, 8: WAIT &H3DA, 8, 8

kt% = kt% + 1
'WEND



END SUB

