Skip to content
Low-level programming · Higher-level thinking
Login Register
Forum / Plugins

Plugin: EMIT source

A community discussion post from the original code:zIRON forum.

Replies

Colin admin
Posts
928
Threads
49
Location
Bulgaria

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...

  1. 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.
  1. 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.
  1. 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

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

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

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

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

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

and finally a peek of using the new ziron call method zircall

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

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