Register | Login
Forum Index > Requests and Feedback > ZirToken
Author Message
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[546] - posted: 2011-11-09 22:01:24
Ziron_GetID is a id for the internal data, so it is not valid for anything else, only for Ziron_GetVarTypeString for now.

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
[547] - posted: 2011-11-09 22:02:50

ok , thanks

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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[548] - posted: 2011-11-09 22:13:02
as for strComp we could have something like:

Code:
function strCmp(char* s1, s2) {
  uses edi esi;
  
  esi = s1;
  edi = s2;
  
  lodsb
  while (char[edi] == al) {
    lodsb
    edi++;
    
    if (al == 0) { break; }
  }
  
  if (al == 0 and char[edi] == 0) {
    xinc eax;
  } else {
    eax = xor;
  }
}


i will add it to strings.zir next release, will improve it over time 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
[549] - posted: 2011-11-09 22:22:28

thank you.

BTW , i was did it in sphinx C-- like this
Code:
int fastcall strcmp2(ESI,EDI)          // mixed asm & C  
{ 
   AL = DSBYTE[ESI]; 
   while(AL==DSBYTE[EDI]) 
     { 
       if(AL==0) return 0; 
       ESI++;  EDI++; 
       AL = DSBYTE[ESI]; 
     } 
   return  DSBYTE[ESI] - DSBYTE[EDI]; 
} 


hope Ziron will be close to sphinx C--

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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[550] - posted: 2011-11-09 22:25:39
i dont think that would give correct results. Also the assembled code will be larger.

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
[551] - posted: 2011-11-09 22:40:21
why you did not think so

here is my full example
Code:
/*************************************** 
*             Sphinx C--               *   
*                                      * 
*     strcmp demo  By Emil Halim       * 
*           23 / 9 / 2011              * 
***************************************/ 

#pragma option w32         //create Windows GUI EXE. 
#pragma option OBJ         //create OBJ file 
#pragma option OS          //speed optimization  
#pragma option J0          //no startup code. 

#include <Windows.h>  

#pragma option ia          // allow inline asm 
#pragma option LST 

extern cdecl _printf();    
#define printf  _printf 


/*************** 
s > t >>>  > 0 
s = t >>>  = 0 
s < t >>>  < 0 
***************/ 
int strcmp1(char *s, char *t)           // pure C code 
{ 
   for( ;byte *s == byte *t; s++, t++) 
   if (byte *s == '\0') return 0; 
   return  DSBYTE[s] - DSBYTE[t]; 
} 

int fastcall strcmp2(ESI,EDI)          // mixed asm & C  
{ 
   AL = DSBYTE[ESI]; 
   while(AL==DSBYTE[EDI]) 
     { 
       if(AL==0) return 0; 
       ESI++;  EDI++; 
       AL = DSBYTE[ESI]; 
     } 
   return  DSBYTE[ESI] - DSBYTE[EDI]; 
} 

char* testStr1 = "SPHINX C-- is so easy (an intermediate position between Assembler and C)"; 
char* testStr2 = "SPHINX C-- is so easy (an intermediate position between Assembler and C)"; 

main() 
{ 
_start:   
     printf("string length is %d\n",strcmp1( testStr1 , testStr2 ));  
     printf("string length is %d\n",strcmp2( testStr1 , testStr2 ));  
     MessageBox(0,"","",0);  
} 



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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[552] - posted: 2011-11-09 22:47:01
try your strcmp with both variations of

str1 = "test "
str2 = "test"

then

str1 = "test"
str2 = "test "

tell me result, or maybe i do not understand something, what is dsbyte ? i assume like char[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
[553] - posted: 2011-11-09 22:53:20

yes , you are wright.

BTW , dsbyte[esi] is like char[esi]

http://www.freewebs.com/ogremagic/index.htm
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
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