:word randseed[2];

//Пресани кей.......
:void fastcall p()
{
 $pushad EAX=0; $int 16h $popad
}

:int fastcall Rand()
{
  AX=randseed[2];
  CX=randseed[0];
  AH=AL;
  AL=CH;
  CH=CL;
  $XOR CL,CL
  $RCR AX,1
  $RCR CX,1
  randseed[0]+=CX;
  $ADC AX,randseed[2]
  randseed[0]+=0x62E9;
  $ADC AX,0x3619
  randseed[2]=AX;
}

:void fastcall Randomize()
{
  $push ES
   AX=2; BX=0; $int 31h ES=AX;
   randseed[0]=ESWORD[0x46E];
   randseed[2]=ESWORD[0x46C];
  $pop ES
}

