Copy Link
Add to Bookmark
Report

NULL mag Issue 09 28 Plasma demo textmod

eZine's profile picture
Published in 
null magazine
 · 3 years ago

another demo for text mode... this time a plasma effect... not very good. at least not so amazing like the fire effect one.. but still counts :)

program plasma; 

uses fastcrt;

const

width = 80;

Var
XAnswer,YAnswer,
ToAdd,

X,Y : Integer;
SinArray : Array [0..width] Of Integer;

Function Rad(Angle : Real): Real;
Begin
Rad := Angle*PI/180;
End;
Begin
{set 80x50 mode to have a better resolution ;) }

asm
mov ax, 1112h
xor bl, bl
int 10h

end;

{Now to create our sine array}
For X := 0 to width Do
Begin
SinArray[X] := Trunc(Sin(Rad(X))*1024);
End;
ToAdd := 0;

While Not Keypressed Do

Begin

wait_retrace;

ToAdd := ToAdd + 1;

{Here we add our small amount to our dynamic variable}

For X := 0 to 80 Do
Begin
XAnswer := 20 * SinArray[((X * 4 ) + (ToAdd )) Mod width]+

30 * SinArray[((X ) + (ToAdd * 4 )) Mod width]+

50 * SinArray[((X Div 4) + (ToAdd Div 4)) Mod width];

{This is our first answer for our X coordinate of the square}
For Y := 0 to 50 Do

Begin

YAnswer := 40 * SinArray[((Y * 6 ) + (ToAdd )) Mod width]+
40 * SinArray[((Y ) + (ToAdd * 6 )) Mod width]+
20 * SinArray[((Y ) + (ToAdd Div 6)) Mod width];
{This is our second answer for our Y coordinate of the square}

{This function writes the "pixel" on the screen. You can use any funtion}

{you want to display a char on the screen}

fastout(x,y,chr(219),(XAnswer+YAnswer) Shr 10);
End;

End;
End;

{back to 80x25 mode}
xsetmode(3);
End.

← previous
next →
loading
sending ...
New to Neperos ? Sign Up for free
download Neperos App from Google Play
install Neperos as PWA

Let's discover also

Recent Articles

Recent Comments

Neperos cookies
This website uses cookies to store your preferences and improve the service. Cookies authorization will allow me and / or my partners to process personal data such as browsing behaviour.

By pressing OK you agree to the Terms of Service and acknowledge the Privacy Policy

By pressing REJECT you will be able to continue to use Neperos (like read articles or write comments) but some important cookies will not be set. This may affect certain features and functions of the platform.
OK
REJECT