Register | Login
Forum Index > Source Help > detecting '\'
Author Message
Pages: 1 2 3 4 5
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1174] - posted: 2012-05-20 20:05:24
in the post above:

Code:
   char strArr[10240]; storage for hold all string array each one is 128 byte len
   dword cnt;
   dword disp;
   ..........
   .........
   //later
    eax = Ziron_GetNextToken();
    ebx = 0; 
    cnt = 0;
    edi = @strArr;
    while( eax != zirParenClose)
     {
        H_strcpy( [edi+ebx],Ziron_GetStringValue());
        ebx += 128;
        cnt++;
        eax = Ziron_GetNextToken(); 
     }


you pass [edi+ebx] as if it points to a pointer, however you defined your array as a string. What you could do is define a new macro:

Code:
inline function ptrAt($base) {
  lea eax, $base
  $return eax;
}


then change

Code:
H_strcpy( [edi+ebx],Ziron_GetStringValue());


to

Code:
H_strcpy( ptrAt([edi+ebx]),Ziron_GetStringValue());


let me know.

btw you could also make it a general purpose macro

Code:
inline function laddr($reg, $base) {
  lea $reg, $base
  $return $reg;
}

H_strcpy( laddr(eax, [edi+ebx]),Ziron_GetStringValue());


ps: using add is also fine.

Code:
while( eax != zirParenClose)
     {
        H_strcpy( edi,Ziron_GetStringValue());
        edi += 128;
        cnt++;
        eax = Ziron_GetNextToken(); 
     }



best approach:

Code:
  eax = Ziron_GetNextToken();
  esi = 0;
  edi = @parArr;
  while( eax != zirParenClose)
  {
    H_strcpy( edi, Ziron_GetStringValue());
    edi += 128;
    esi++;
    eax = Ziron_GetNextToken();          
  }
  cnt = esi;


Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[1175] - posted: 2012-05-20 23:04:29

thanks , but there is a strange problem.

using this line crashing the program
Code:
  cnt = esi;


i changed it like this and every thing is okay.
Code:
  mov cnt,eas


it seems the '=' handler has sume problem with local variable.

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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1176] - posted: 2012-05-21 00:21:08
thanks for the report, i will take a look at it smile

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1177] - posted: 2012-05-21 00:36:23
btw i tried

Code:
DWord cnt = 10;

for (edi = 0 to cnt) {
  print('Hello\r\n');
}


and i did not have any crashes.

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[1178] - posted: 2012-05-21 15:54:16

but i
was testing it inside a code and it crashed , when substitute with while it worked well.

i think the problem belong to local variable , because i replaced cnt local variable with a register , and every thing was ok.

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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1181] - posted: 2012-05-21 19:34:50
can you try to make a small test app that re-produces the problem? i can't seem to get it to crash, if you can will be great.

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1184] - posted: 2012-05-21 19:56:48
I have updated the beta which should fix a few bugs here and there smile

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[1193] - posted: 2012-05-21 21:38:07


ok , look this is part of my #define handler , if you replace this part
Code:
     // adding '$' to param
     edi = cnt;
     ebx = @parArr;
     while(edi>0)
      { 
         if(strCmp(ebx, Ziron_GetStringValue()))    
          {
             H_strcat(@val,' $'); 
             break; 
          }     
         ebx += 128;       
         edi--;
      }


with for statement the plugin makes ziron crash with access violation.

http://www.freewebs.com/ogremagic/index.htm
Pages: 1 2 3 4 5
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