{Essaye ça - Ca fonctionne sans aucune unité supplémentaire}
{$M 2048,0,0}
program Sinus;
{uses Clavier,EcranVga,Polic8x8;}
const
TxtY = 100;
Samp = 5;
Slen = 255; { samp 0..30 / sofs = height }
Taille = 2; { min=1; cool=4; max=10 }
Curve = 3;
Xmax = 309 div Taille;
Ymax = 7; {Hauteur du texte}
ScrSpd = -1;
ScrText : string =
´Hai world... This looks a bit like the ´+
´scroll of the second part ´+
´of Future Crew´´s Unreal demo ´+
´( part one)... It´´s not filled ´+
´but it sure looks nicer ( imho)... ´;
type
ScrArray = array[0..Xmax,0..7] of byte;
var
TableSin : array[0..Slen] of word;
BitMap : ScrArray;
X,I,SinIdx,vram : word;
Y,ScrIdx,CurChar : byte;
Fseg,Fofs : word;
procedure GetFont; assembler;
asm
mov ax,1130h;
mov bh,3; {Remettre mov bh,1 si la fonte apparait mal à l´écran}
int 10h;
mov Fseg,es;
mov Fofs,bp;
end;
procedure SetGraphics(Mode : word); assembler;
asm
mov ax,Mode;
int 10h
end;
function keypressed : boolean; assembler;
asm
mov ah,0bh;
int 21h;
and al,0feh;
end;
{Fast ClearScreen}
Procedure ClearScr; Assembler;
Asm
mov ax, $A000
mov es, ax
xor di, di
xor ah, ah
mov cx, 32000
rep stosw
end;
procedure CalcSinus;
var
I : word;
begin
for I := 0 to Slen do
TableSin[I] := round(sin(I*4*pi/Slen)*Samp);
end;
procedure Scroll;
begin
fillchar(BitMap,sizeof(BitMap),0);
ScrIdx := 1;
SinIdx := 0;
repeat
Curchar := ord(ScrText[ScrIdx]);
inc(ScrIdx);
if ScrIdx = length(ScrText) then
ScrIdx := 1;
for I := 0 to 7 do
begin
{Dessine le caractère dans ´Bitmap´}
move(BitMap[1,0],BitMap[0,0],Xmax shl 3);
for Y := 0 to 7 do
{if ( ( Police8x8^[CurChar,Y] shl I) and 128) < > 0}
if ( (mem[Fseg:Fofs+8*CurChar+Y] shl I) and 128) < > 0
then BitMap[Xmax,Y] := ( ( ScrIdx+Y-I) mod 70)+32
else BitMap[Xmax,Y] := 0;
{ --- Le scrolling --- }
{Nouveau AttendEcran;}
while ( port[$3da] and 8) < > 0 do;
while ( port[$3da] and 8) = 0 do;
{Routine qui attend la fin de raffraichissement de l´écran}
{Fin Nouveau AttendEcran :}
{EffaceEcran ( 0);}
ClearScr;
for X := 0 to Xmax do
for Y := 0 to 7 do
begin
vram := ( Taille*Y+TableSin[(SinIdx+X+Curve*Y) mod SLen]) +TxtY;
vram := vram shl 8 + vram shl 6 +Taille*X +TableSin[(X+Y) mod SLen];
if BitMap[X,Y] < >0 then
Mem[$A000: vram] := BitMap[X,Y];
end;
SinIdx := ( SinIdx+ScrSpd) mod SLen;
{ -------------------- }
end;
until KeyPressed;
end;
begin
{Avant
CalcSinus;
ModeVga256;
Scroll;
ModeTxt;
}
{Maintenant}
CalcSinus;
GetFont;
SetGraphics($13);
Scroll;
SetGraphics(3);
end.