// "Micro3D" intro.
// (c)2001 Wega (2:5055/141.10@FidoNet)
// Compiled on SPHINX C-- Compiler v0.236.7 (Jan 28 2001)

#usePentium
#codesize
#resize FALSE
#jumptomain SHORT
#pragma option X

byte COPYRIGHT="(c)WEGA";

#define PI2 3.14159265358979324*2
#define XPixels 50
#define YPixels 50

float ang1,ang2,k1=0,k2=0;
long x,y=0,z,r=5;
word t=0;
byte tt=0;

#include "micro3d.h--"

main()
{

 @Begin();

 do{

  k1+=0.005;
  k2+=0.01;
  BX=t;
  BX++;
  IF(BX<75)r++;
  IF(BX>500)&&(BX<575)r--;
  IF(BX==600){BX=0;tt++;}
  t=BX;
  IF(tt>6)tt=0;

  ang2=0;DI=0;
  do{
   ang1=0;BP=0;
   do
   {
    BL=tt;
    $fld ang2
    $fadd k1
    $fsincos
    IF(BL<2) $fimul y ELSE $fimul r
    $fistp x
    IF(BL==0)||(BL==2) $fimul x ELSE $fimul r
    $fistp y
    $fld ang1
    $fadd k2
    $fsincos
    IF(BL==3) $fimul r ELSE $fimul x
    $fiadd r
    $fistp z
    IF(BL==4) $fimul r ELSE IF(BL==5) $fimul y ELSE $fimul x
    $fistp x
    x+=r+60;y+=r-5;
    CL=z;
    IF(CL>220)CL=0;
    IF(CL>127)CL=127;
    @PutPixel3D(word x,word y,word z,byte CL);
    ang1+=PI2/XPixels;
    BP++;
   }while(BP<XPixels);
   ang2+=PI2/YPixels;
   DI++;
  }while(DI<YPixels);

  @WaitRetrace();
  @PutVideoBuf();

  SI=64000;
  loop(SI){
   AL=GSBYTE[SI];
   IF(AL>12) AL-=12; ELSE AL=0;
   GSBYTE[SI]=AL;
  }

  $in AL,60h
 }while(AL!=1); // Пока не ESC

 @End();
}
