home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Underground
/
UNDERGROUND.ISO
/
graphic
/
starx.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1995-07-28
|
2KB
|
55 lines
{$G+}
Uses ModeXLib,Crt;
Var Stars:Array[0..500] of Record
x,y,Plane:Integer;
End;
st_no:Word;
vscreen:Pointer;
vpage:Word;
palette:Array[0..768] of Byte;
Procedure PutPixel(x,y,col:word);assembler;
{sets pixel (x/y) to color col (Mode X)}
asm
mov ax,0a000h {load segment}
mov es,ax
mov cx,x {define Write Plane}
and cx,3 {as x mov 4}
mov ax,1
shl ax,cl {set appropriate bit}
mov ah,al
mov dx,03c4h {Timing Sequencer}
mov al,2 {Register 2 - Write Plane Mask}
out dx,ax
mov ax,80 {Offset = Y*80 + X div 4}
mul y
mov di,ax
mov ax,x
shr ax,2
add di,ax {load offset}
mov al,byte ptr col {load color}
mov es:[di],al {and set pixel}
End;
Begin
Randomize; {initialize random numbers}
Init_ModeX;
Repeat {executed once per display}
For St_no:=0 to 500 do Begin{calculate new position for each start}
With Stars[st_no] do Begin
PutPixel(x,y,0); {clear old pixel}
Dec(x,Plane shr 5 + 1); {continue moving}
if x <= 0 Then Begin {left ?}
x:=319; {then reinitialize}
y:=Random(200);
Plane:=Random(256);
End;
PutPixel(x,y,Plane shr 4 + 16); {set new pixel}
End;
End;
Until KeyPressed; {run until key pressed}
TextMode(3);
End.