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
A community discussion post from the original code:zIRON forum.
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
and finally for what you want here:
if(char[Esi] == 13 and char[esi+1] == 10)
updated func:
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 :)
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
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:
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:
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);
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
first one crashed in my system , ...
are you using the original WriteLn macro? if not then try
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
yes i am using it from console.zir as it came from you.
still crashing!!!
http://www.freewebs.com/ogremagic/index.htm
Which OS are you using?