Register | Login
Forum Index > Bugs and Fixes > problems in Helper.zir file.
Author Message
Pages: 1
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[338] problems in Helper.zir file. - posted: 2011-11-05 08:51:34

Hi

I was collecting some functions in Helper.air file and was compiled ok with previous version

but gave some problem with ver 1.1.26.1 alpha
Code:
//*********************
//  helper functions
//   By Emil Halim
//*********************

#include 'smm32.zir';


procedure H_memcpy(Dword dst,src,len)
{
  uses Esi Edi Ecx;
  Edi = dst;
  Esi = src;
  Ecx = len;
  rep movsb
}

function H_strlen(char* str)
{
  Eax = nil;
  Ebx = str;
  while(char[Ebx] != 0)
   {
     Ebx++;
     Eax++;
   }
}

function  H_strcpy(Dword dst,src)
{ 
  Eax = dst; 
  Edx = src; 
  push Eax;
  BL =  [Edx]; 
  while ( BL != 0)  
   { 
      [Eax] = BL; 
      Eax++; Edx++; 
      BL =  [Edx]; 
   }  
  [Eax] = 0;
  pop Eax;
} 

function H_strcat(Dword dst,src) 
{ 
  Eax = dst; 
  Edx = src;
  push Eax;
  while (byte [Eax] != 0) { Eax++; } 
  while (byte [Edx] != 0)  
   { 
      BL =  [Edx]; 
      [Eax] = BL;  
      Edx++; Eax++; 
   } 
  [Eax] = 0;
  pop Eax;
} 


function H_GetNextLine(char* strbuf; pointer dest)
{ 
  global int32 incr;

  uses esi edi;
  eax = xor;
  
  ecx = incr;
  esi = strbuf;  
  add esi, ecx
  edi = dest;
  
  while(char[esi] != 0)
   {
      if (word[esi] == "\r\n")
       {
         eax += 2; 
         break;
       }
      bl = char[Esi]; 
      char[edi] = bl; 
      eax++; 
      esi++;
      edi++;
   }
  char[edi] = 0; 
  
  add ecx, eax
  incr = ecx;
}

function H_GetTmpStr(DWord sizeInByte)
{
   uses Ebx Ecx;   
   global int32   StrCnt;
   global char*   StrFunc[2048];
   Eax = StrCnt;
   Eax++;
   and Eax,2047
   StrCnt = Eax;
   Ebx = @StrFunc;
   lea Ebx,[Ebx+Eax]
   Eax=DWord[Ebx];
   if( Eax> 0)
    {
       freemem( Eax);
    }
   [Ebx]= malloc(sizeInByte);
}

function H_Trim(char* str;int32* len)
{  
  uses Ebx Ecx;
  Ebx = str;
  al = char[Ebx];
@Rept:     
 if(al==32 or al==9 or al==10 or al==11 or al==13)
  { 
    Ebx++;
    al = char[Ebx];
    goto @Rept;
  }       
 Ecx = Ebx;
 while(char[Ecx] != 0)
  {
     Ecx++;
  }
 al = char[Ecx-1];
@Rept1:
  if(al==32 or al==9 or al==10 or al==11 or al==13)
  { 
    Ecx--;
    al = char[Ecx-1];
    goto @Rept1;
  }     
 sub Ecx,Ebx 
 if(len != nil )
  {
    //*len = Ecx;
    Eax = len;
    Dword[Eax] = Ecx;  
  }
 Eax = H_GetTmpStr(Ecx);
 char[Eax+Ecx]=0;
 H_memcpy(Eax,Ebx,Ecx);
}

function H_LTrim (char* str)
{  
  uses Ebx Ecx;
  Ebx = str;
  al = char[Ebx];
@Rept:     
 if(al==32 or al==9 or al==10 or al==11 or al==13)
  { 
    Ebx++;
    al = char[Ebx];
    goto @Rept;
  }     
 Ecx = Ebx;
 while(char[Ecx] != 0)
  {
     Ecx++;
  }
 sub Ecx,Ebx 
 Eax = H_GetTmpStr(Ecx);
 push Eax
 strlcpy(Eax,Ebx,Ecx);
 pop Eax
}

function H_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 = H_GetTmpStr(Ecx);
  char[Edi+Ecx]=0;
  push Edi 
  rep movsb
  pop Eax
}


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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[342] - posted: 2011-11-05 13:17:39
can you also show what is the error you received - i just compiled this file without a problem.

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Pages: 1
create new reply


Quick reply:

Message:



Currently Active Users:
There are currently 8 user(s) online. 0 member(s) and 8 guest(s)
Most users ever online was 1046, January 28, 2022, 2:08 pm.


Statistics:
Threads: 225 | Posts: 1848 | Members: 51 | Active Members: 51
Welcome to our newest member, yecate
const Copyright = '2011-2024 © OverHertz Ltd. All rights reserved.';
Web development by OverHertz Ltd