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

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

ok , could you please extend the system , so that it allowing changing the line , then reprocess it.

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

Colin admin
Posts
928
Threads
49
Location
Bulgaria

changing the line will not be possible because it would mess with the internal buffer and would be dreadfully slow, but for following release i have an idea which you will like ;)

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

ok , Ziron will be the best programing language on earth.

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

Colin admin
Posts
928
Threads
49
Location
Bulgaria

i hope so :)

Colin admin
Posts
928
Threads
49
Location
Bulgaria

ok i just finished implementing this new feature i mentioned you will like...

First of course you will register your opcode, in my case i made a new named mycmd

Ziron_RegisterKeyword('mycmd', @event_myCMD);

next the callback

function event_myCMD() {
	eax = Ziron_Execute('mov eax, 5000', sizeof 'mov eax, 5000');
	if (eax == false) {
		Ziron_FatalError('myCMD plugin is not compatible with this version of Ziron');
	}	
	eax = true;
}

notice that you are able to execute ziron code from the Execute function, if the code fails it will return false, on success of course true :)

it will be as simple as that, no need to mess with the internal code or anything.

so the above code would allow someone to write an app like:

program WIN32CUI 'test';

#include 'console.zir';

eax = 1;
print('eax = ', eax:int, '\r\n');

myCMD;

print('eax = ', eax:int, '\r\n');

wait_key(nil);
ExitProcess(0);

and the output would be:

eax = 1
eax = 5000
Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

well done ... , thank you very much.

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.

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

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

also can i register an opcode that already been registered,

for example , can i register mov instruction so that i can extend it.

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

Colin admin
Posts
928
Threads
49
Location
Bulgaria

indeed you can, that is the point of the return false, so for example, you want to extend an opcode mov to support into....

you would move your token forward checking for into, if it does not exist, then let the assembler check if it supports the written mov by returning false. I hope you understand, anyway i will write a sample to help better understand the methods. :)