Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/overhertz/domains/codeziron.com/public_html/ziron/ziron.db.connector.php on line 13 code:zIRON - Get the latest releases plus source-codes and tutorials - Simplifed Assembly Programming Language.
Register | Login
Forum Index > Requests and Feedback > calling functions by register token
Author Message
Pages: 1
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 638
Topics: 103

Location:
Alex, Egypt
[85] calling functions by register token - posted: 2011-10-23 18:52:05
hi OverHertz.

suppose you have a pointer to a function or a procedure which has it's parameters , stored in
a register. so can call that function by it's name as usual or by register token. .eg

function blabla(param1,param2,param3)
{
..............
}


we can call it as usual

myvar = blabla(p1,p2,p3);

so we can get it's address stored in ebx register

ebx = @blabla;

then we can call it by ebx register

myvar = Ebx(p1,p2,p3);

Emil.

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

avatar

(send private message)

Posts: 925
Topics: 54

Location:
OverHertz Studio
[90] - posted: 2011-10-23 23:04:54
This could be interesting, the current method is to create a pointer function

Code:
function* Name(params); DWord; stdcall;


and then assign the register to the function pointer.

Code:
Name = ebx;


if we come up with a way to allow the compiler to know which function method is inside ebx, then this will be possible...

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: 638
Topics: 103

Location:
Alex, Egypt
[95] - posted: 2011-10-23 23:44:09

I think compiler did not need to know which function method is inside ebx, so
you can push all the parameters then emit call [ebx] instruction.

may be the point here is the calling type which mean ,cdecl , stdcall ,...etc
and the solution can be as the following.

Ebx(p1,p2,p3); // default to stdcall
Ebx(p1,p2,p3) as cdecl; // self explnaition


Emil.



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

avatar

(send private message)

Posts: 925
Topics: 54

Location:
OverHertz Studio
[96] - posted: 2011-10-23 23:58:20
This is a fine solution, however it will not be able to type-check or check the amount of parameters; but i guess for such a thing it does not really matter. I will see about adding this for next release.

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: 638
Topics: 103

Location:
Alex, Egypt
[97] - posted: 2011-10-24 00:10:11

very nice , thank you.

BTW , this feature will easily calling a function which stored in array , if we have
an array which hold a pointers to some functions , so we also do the following.

var1 = Ebx[1](par1,par2,par3); // call first function in array pointer.
var4 = Ebx[4](par1); // call 4 th function in array pointer.

and so on

what do you think ?

Emil.

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

avatar

(send private message)

Posts: 925
Topics: 54

Location:
OverHertz Studio
[99] - posted: 2011-10-24 00:43:34
I am not too sure about that, since ebx[4] will be fourth byte of ebx... [ebx+3] .. i will look into that further.

meanwhile i have added register calling for next release, however it will be experimental, it will probably need alot of testing for the next few releases.

Code:
eax(1,2,3,4) as cdecl;


default is stdcall.

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: 638
Topics: 103

Location:
Alex, Egypt
[102] - posted: 2011-10-24 08:00:57

yes , i was wrong , Ebx[3] is the fourth function in array.

implementing it with next release is very nice , smile

i will continue feeding another ideas.

thank you for your Ziron cake.

Emil.

http://www.freewebs.com/ogremagic/index.htm
Pages: 1
create new reply


Quick reply:

Message:



Currently Active Users:
There are currently 1 user(s) online. 0 member(s) and 1 guest(s)
Most users ever online was 999, May 11, 2018, 9:01 am.


Statistics:
Threads: 223 | Posts: 1837 | Members: 50 | Active Members: 50
Welcome to our newest member, NobodyAtWork
const Copyright = '2011-2018 © OverHertz Ltd. All rights reserved.';
Web development by OverHertz Ltd