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

GetTmpStr function

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

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

GetTmpStr function

Hi

i will start converting some functions from BCX to Ziron.

this is the first one.

Here is it in c

char *BCX_TmpStr (size_t Bites)
{
  static int   StrCnt;
  static char *StrFunc[2048];
  StrCnt=(StrCnt + 1) & 2047;
  if(StrFunc[StrCnt]) free (StrFunc[StrCnt]);
  return StrFunc[StrCnt]=(char*)calloc(Bites+128,sizeof(char));
}

here is Ziron one , any suggestion

function GetTmpStr(DWord sizeInByte)
{
   global int32   StrCnt;
   global char*   StrFunc[2048];
   //StrCnt=(StrCnt + 1) & 2047;
   Eax = StrCnt;
   Eax++;
   and Eax,2047
   StrCnt = Eax;
   //if(StrFunc[StrCnt]) free (StrFunc[StrCnt]);
   Ebx = @StrFunc;
   lea Ebx,[Ebx+Eax]
   Ecx=DWord[Ebx];
   if( Ecx> 0)
    {
       freemem( Ecx);
    }
   //return StrFunc[StrCnt]=(char*)calloc(Bites+128,sizeof(char));
   Eax = malloc(sizeInByte);
   DWord[Ebx]=Eax;
}

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

Replies

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

when Ziron will support this

DWord[Ebx] = malloc(sizeInByte);

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

Colin admin
Posts
928
Threads
49
Location
Bulgaria

doesn't it already?

#include 'smm32.zir';

[ebx] = malloc(1024);
Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

it 's okay now , thank you.

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