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;
}
const name = 'Emil Halim';
pointer leftstr = Left(@name,4);
print(leftstr);