Skip to content
Low-level programming · Higher-level thinking
Login Register
Forum / Source Help

Left function

A community discussion post from the original code:zIRON forum.

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

Left function

Hi ,

continue to converting some BCX functions to Ziron , so here is the Left function

function Left(char* str; int32 length)
{
  uses Esi Edi Ecx;
  Esi = str;
  Ecx = Esi;
  while(char[Ecx] != 0)
   {
     Ecx++;
   }
  sub Ecx,Esi 
  if(length < Ecx)
   {
      Ecx = length;
   }
  Edi = GetTmpStr(Ecx);
  push Edi 
  push Ecx
  rep movsb
  pop Ecx
  pop Eax
  char[Eax+Ecx]=0;
}

can be used like this

const name = 'Emil Halim';
pointer leftstr = Left(@name,4);
print(leftstr);

http://www.freewebs.com/ogremagic/index.htm

Replies

Colin admin
Posts
928
Threads
49
Location
Bulgaria

btw.. what is BCX ?