Register | Login
Forum Index > Source Help > compiling error
Author Message
Pages: 1 2 3 4
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[172] - posted: 2011-10-27 20:52:26
please see my previous , i post it while you posting your last one.

BTW , i tried you last code but it crashed.

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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[173] - posted: 2011-10-27 20:55:26
and finally for what you want here:
Code:
if(char[Esi] == 13 and char[esi+1] == 10) 


updated func:

Code:
function GetNextLine(char* strbuf) { 
  uses esi edi;
  eax = xor;
  
  esi = strbuf;  
  edi = @LineIn;
  
  while( char[esi] != 0) {
    if (word[esi] == "\r\n") {
      eax += 2; 
      break;
    }
    bl = char[Esi]; 
    char[edi] = bl; 
    eax++; 
    esi++;
    edi++;
  }
  char[edi] = 0;   
}



I have tested both with this and last and both work perfectly 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
[174] - posted: 2011-10-27 20:59:55

in my last version , i was using global variable to keep track of last line readed so that
each new cal will start from correct position, but when run the program only the first
line is printed !!!!!!!!!

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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[175] - posted: 2011-10-27 21:09:05
Why use a global variable which would be excessivly slow?

The latest version i posted, starts from the correct position using just the registers. Compile it as it is and you will see:

Code:
program WIN32CUI 'test';

#include 'console.zir';
#include 'ch.zir';

const buf = loadfs('fpu_opcodes.txt');
char LineIn[1024];

function GetNextLine(char* strbuf) { 
  uses esi edi;
  eax = xor;
  
  esi = strbuf;  
  edi = @LineIn;
  
  while(char[esi] != 0) {
    if (word[esi] == "\r\n") {
      eax += 2; 
      break;
    }
    bl = char[Esi]; 
    char[edi] = bl; 
    eax++; 
    esi++;
    edi++;
  }
  char[edi] = 0;   
}


push edi
ecx = @buf; //eax would be changed by GetNextLine
edi = GetNextLine(eax);

while(edi > 0) {
  WriteLn(@LineIn);
  
  add ecx, edi  
  edi = GetNextLine(ecx);
} 

int32 k = edi;
pop edi


wait_key(nil);

ExitProcess(0);


if you really want to use a global then i guess something like this:

Code:
program WIN32CUI 'test';

#include 'console.zir';
#include 'ch.zir';

const buf = loadfs('fpu_opcodes.txt');
char LineIn[1024];

function GetNextLine(char* strbuf) { 
  global int32 incr;

  uses esi edi;
  eax = xor;
  
  ecx = incr;
  esi = strbuf;  
  add esi, ecx
  edi = @LineIn;
  
  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;
}


push edi
edi = GetNextLine(@buf);
while(edi > 0) {
  WriteLn(@LineIn);
  edi = GetNextLine(@buf);
} 
int32 k = edi;
pop edi

wait_key(nil);

ExitProcess(0);


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
[176] - posted: 2011-10-27 21:15:59

first one crashed in my system , second one works fine.

anyway this will be a first of some functions those we will use them in plugin system.

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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[177] - posted: 2011-10-27 21:28:46

first one crashed in my system , ...


are you using the original WriteLn macro? if not then try

Code:
push edi
push esi
esi = @buf; //eax would be changed by GetNextLine
edi = GetNextLine(eax);

while(edi > 0) {
  WriteLn(@LineIn);
 
  add esi, edi  
  edi = GetNextLine(esi);
} 

int32 k = edi;
pop esi
pop edi


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
[178] - posted: 2011-10-27 21:35:38

yes i am using it from console.zir as it came from you.

still crashing!!!

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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[179] - posted: 2011-10-27 21:38:41
Which OS are you using?

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


Quick reply:

Message:



Currently Active Users:
There are currently 7 user(s) online. 0 member(s) and 7 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