home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / GFXFX2.ZIP / SVGA.PAS < prev    next >
Pascal/Delphi Source File  |  1995-02-14  |  996b  |  53 lines

  1.  
  2. program tseng_svga; { SVGA.PAS }
  3. { Small SuperVGA demonstration without BGI, GRAPH or any unit or library.
  4.   Works only on TsengLabs ET-3000/4000 or compatibles!
  5.   By Bas van Gaalen. }
  6. uses u_vga,u_kb;
  7. const yofs=100;
  8.  
  9. procedure putpixel(x,y:word; c:byte); assembler;
  10. asm
  11.   mov es,u_vidseg
  12.   mov ax,640
  13.   mul y
  14.   add ax,x
  15.   adc dx,0
  16.   mov di,ax
  17.   mov al,dl
  18.   mov dx,03cdh
  19.   out dx,al
  20.  @skip:
  21.   mov al,c
  22.   mov es:[di],al
  23. end;
  24.  
  25. function getpixel(x,y:word):byte; assembler;
  26. asm
  27.   mov es,u_vidseg
  28.   mov ax,640
  29.   mul y
  30.   add ax,x
  31.   adc dx,0
  32.   mov di,ax
  33.   mov al,dl
  34.   mov dx,03cdh
  35.   shl al,4
  36.   out dx,al
  37.  @skip:
  38.   mov al,es:[di]
  39. end;
  40.  
  41. var x,y:word; i:byte;
  42. begin
  43.   setvideo($2e); { 02eh=640x480x256 }
  44.   putpixel(320,pred(yofs),7);
  45.   for y:=0 to 254 do
  46.     for x:=319-y to 321+y do begin
  47.       i:=getpixel(pred(x),yofs+pred(y)) xor getpixel(succ(x),yofs+pred(y));
  48.       if i>0 then putpixel(x,yofs+y,i);
  49.     end;
  50.   waitkey(0);
  51.   setvideo(u_lm);
  52. end.
  53.