Информационный сервер для программистов: Исходники со всего света. Паскальные исходники со всего света
  Powered by Поисковый сервер Яndex: Найдется ВСЁ!
На Главную Pascal Форум Информер Страны мира
   Demo Making    >>    pixtun
   
 
 Pixel Tunnel [320x200x256]   Stian SЫreng 08.02.95

Эффект вьющегося туннеля, состоящего их точек.
A cool pixel tunnel in 320*200 mode.



7k 
 

This source performs a pixel tunnel in chunky mode (320x200x256). It is a rather unoptimized, slow source, but I hope you will learn something out of it anyways. All circles and sinuses are precalculated and is being done internal by the source itself, so no external files are needed. All you need is turbo pascal with ASM options (5.3+?), since a couple of the procedures uses this facillity. It was coded at school on request, so I uploaded it on the net as well. More sources to follow, so stick around! If you have any question at all, considering this source or programming in all, on 680x0, 6502, Z80 or 80x86 do ask. I don't bite.. that hard! *bows* stians@interlink.no Stian SЫreng Naustjorde 4 7560 Vikhamar Norway {> Cut here. FileName= PIXTUN.PAS } {¬ђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђ¬ ¬ђ ђ¬ ¬ђ PIXTUN.PAS - This source was coded by The Jerk of Hoaxers aka ђ¬ ¬ђ Stian SЫreng in February 1995. If you have any questions about ђ¬ ¬ђ this source, email to: stians@interlink.no, 100% answer. (Bug ђ¬ ¬ђ reports are welcome!) Boy, can this source be optimized !!! ђ¬ ¬ђ Feel free to use it at any time, as long as you give me the ђ¬ ¬ђ credits for it. Tested on 486SX/30: ok, 486DX2/66: fast and ђ¬ ¬ђ 386SX/25 slow. Conclusion: Requires mcga and a 486. ђ¬ ¬ђ stians ђ¬ ¬ђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђђ¬} USES crt; CONST Amount=30; { number of circles } VAR circles:array[1..360,1..Amount] of word; ypts,xpts:array[1..90,1..Amount] of integer; xsinus,ysinus:array[1..720] of integer; sinptr, xx,yy, x,y,a:integer; r:real; PROCEDURE pal(c,r,g,b:byte); { sets palette } begin port[$3c8]:=c; port[$3c9]:=r; port[$3c9]:=g; port[$3c9]:=b; end; procedure sync;assembler;asm { synchronize routine, wait for vblank } mov dx,03dah @frame: in al,dx test al,8 jz @frame @besure: in al,dx test al,8 jnz @besure end; { ****************************************************************** } BEGIN { ** Precalculate circles ** } Writeln('Calculating, please wait..'); for a:=1 to Amount do begin r:=0; for x:=1 to 360 do begin r:=r+(0.0175)*4; circles[x,a]:=round(sin(r)*(5+(a shl 2)))+(5+(a shl 2)); end; end; { ** Precalc x and y sinuses ** } r:=0; for x:=1 to 720 do begin r:=r+0.0175; xsinus[x]:=round(sin(r)*140)+140; ysinus[x]:=round(cos(r)*90)+90; end; { ** Initialize 320x200x256 chunky mode ** } asm mov ax,13h { Using bitplanes, this routine would be MUCH } int 10h { faster, but a 256 colour pixtunnel is cooler } end; { ** Set grayscale palette ** } for a:=63 downto 0 do pal(a,a,a,a); sinptr:=0; { ** Main loop ** } repeat sync; if sinptr>358 then sinptr:=0; { loop sinus } inc(sinptr,2); { ** Draw and clear circles ** } for a:=1 to Amount do for x:=1 to 90 do begin xx:=xpts[x,a]; { store old pts } yy:=ypts[x,a]; mem[$a000:xx+yy*320]:=0; { clear old } xx:=(circles[x,a]+xsinus[(a shl 3)+sinptr])-a*4; { new pos } yy:=(circles[x+23,a]+ysinus[sinptr+90+(a shl 2)])-(a*4); if ((xx>0) AND (xx<319)) then { check if inside bounds } if ((yy>0) AND (yy<199)) then begin mem[$a000:xx+yy*320]:=a+5; { put pixel } xpts[x,a]:=xx; ypts[x,a]:=yy; end; end; until keypressed; { loop } { ** Back to text mode ** } asm mov ax,3h int 10h end; end.