Colin
admin
Posts
928
Threads
49
Location
Bulgaria
Post #249
2011-11-01 18:05:31 UTC
btw your post above
just want to understand some uncleared things.
1- when Ziron_Execute executes it's parameters , is it interpreter , i am Little confused.
2- the return value of Ziron_Execute how can we make use of it?
3- can i extract some date from our line just like emit_Pligin then process that data then
pass it again to Ziron_Execute.
please more explanation. OK, so...
when you pass the string parameter to Ziron_Execute, it will convert your passed code (ziron syntax etc) into machine code and enter it into the current scope m/c buffer. The return value of Ziron_Execute is a simple true or false, if the syntax you passed to Ziron_Execute is not supported (not valid Ziron syntax) or for any other reason it fails, it will return false, else if the code is entered into the m/c it will return true. Yes, so lets say you parse the code: mov 10 into eax
you can then call
Ziron_Execute('eax = 10;')
Please let me know if you have further questions :)
Emil_halim
member
Posts
639
Threads
104
Location
Alex, Egypt
Post #252
2011-11-01 18:51:58 UTC
very nice , got it new.
just want to touch that feature , when will you release it ?
http://www.freewebs.com/ogremagic/index.htm
Colin
admin
Posts
928
Threads
49
Location
Bulgaria
Post #253
2011-11-01 18:57:26 UTC
I'm working on implementing fastcall, and have plans for a few other features and improvements, once i am satisfied with them i will make a new release. I may make a pre-release tomorrow afternoon - a kind of beta release for testing before offical release, but i will see.
Emil_halim
member
Posts
639
Threads
104
Location
Alex, Egypt
Post #254
2011-11-01 19:07:13 UTC
great ,
so i can test a pre released version , and tell you if there were any bugs.
http://www.freewebs.com/ogremagic/index.htm
Colin
admin
Posts
928
Threads
49
Location
Bulgaria
Post #262
2011-11-02 16:36:46 UTC
I'm hoping i have not broken anything other when implementing fastcall, but else it seems fine
program WIN32CUI 'test';
#cpu 686;
#include 'console.zir';
#include 'ch.zir';
procedure myStdCallFunc(DWord a,b,c) {
eax = a;
}
procedure cdecl myCDeclFunc(DWord a,b,c) {
eax = a;
}
procedure fastcall myFastCallFunc(DWord a,b,c) {
eax = a;
}
//////////////////////////////////////////////////
push esi
push edi
esi = getTickCount();
for (edi = 1 to 900000000) {
myStdCallFunc(1,2,3);
}
eax = getTickCount();
sub eax, esi
print('Time taken: ', eax:int, 'ms\r\n');
//////////////////////////////////////////////////
esi = getTickCount();
for (edi = 1 to 900000000) {
myCDeclFunc(1,2,3);
}
eax = getTickCount();
sub eax, esi
print('Time taken: ', eax:int, 'ms\r\n');
//////////////////////////////////////////////////
esi = getTickCount();
for (edi = 1 to 900000000) {
myFastCallFunc(1,2,3);
}
eax = getTickCount();
sub eax, esi
print('Time taken: ', eax:int, 'ms\r\n');
pop edi
pop esi
//////////////////////////////////////////////////
wait_key(nil);
ExitProcess(0);
after running this code a few time the averages...
stdcall, cdecl: 3438
fastcall: 2657
Colin
admin
Posts
928
Threads
49
Location
Bulgaria
Post #263
2011-11-02 16:45:03 UTC
some more for fun
program WIN32CUI 'test';
#cpu 686;
#include 'console.zir';
#include 'ch.zir';
procedure myStdCallFunc(DWord a,b,c,d,e,f) {
uses edi esi ebx;
eax = a;
edx = b;
ecx = c;
ebx = d;
esi = e;
edi = f;
}
procedure cdecl myCDeclFunc(DWord a,b,c,d,e,f) {
uses edi esi ebx;
eax = a;
edx = b;
ecx = c;
ebx = d;
esi = e;
edi = f;
}
procedure fastcall myFastCallFunc(DWord a,b,c,d,e,f) {
uses edi esi ebx;
eax = a;
edx = b;
ecx = c;
ebx = d;
esi = e;
edi = f;
}
//////////////////////////////////////////////////
esi = getTickCount();
for (edi = 1 to 900000000) {
myStdCallFunc(1,2,3,4,5,6);
}
eax = getTickCount();
sub eax, esi
print('Time taken: ', eax:int, 'ms\r\n');
//////////////////////////////////////////////////
esi = getTickCount();
for (edi = 1 to 900000000) {
myCDeclFunc(1,2,3,4,5,6);
}
eax = getTickCount();
sub eax, esi
print('Time taken: ', eax:int, 'ms\r\n');
//////////////////////////////////////////////////
esi = getTickCount();
for (edi = 1 to 900000000) {
myFastCallFunc(1,2,3,4,5,6);
}
eax = getTickCount();
sub eax, esi
print('Time taken: ', eax:int, 'ms\r\n');
//////////////////////////////////////////////////
wait_key(nil);
ExitProcess(0);
stdcall: 7409 ms
cdecl: 7000 ms
fastcall: 4071 ms
Colin
admin
Posts
928
Threads
49
Location
Bulgaria
Post #264
2011-11-02 17:26:48 UTC
and finally a peek of using the new ziron call method zircall
Emil_halim
member
Posts
639
Threads
104
Location
Alex, Egypt
Post #265
2011-11-02 17:47:49 UTC
well done :yess:
is FastCall passes the first and second parameters in Eax , Edx or what?
also what ZironCall passes the parameters?
finally , need to use register directly as a parameter instead pushing in the stack , this will increase the speed of course.
http://www.freewebs.com/ogremagic/index.htm