Colin
admin
- Posts
- 928
- Threads
- 49
- Location
- Bulgaria
Hi Emil,
blob is no longer supported, I am currently porting the emit plugin, and will get back to you soon with a new beta release.
Emil_halim
member
- Posts
- 639
- Threads
- 104
- Location
- Alex, Egypt
okay , with new emit plugin we can emit to exe buffer, but what about other macros in the above example?
http://www.freewebs.com/ogremagic/index.htm
Emil_halim
member
- Posts
- 639
- Threads
- 104
- Location
- Alex, Egypt
BTW , where are those symbols defined
IDENT_TYPE
TOKEN_NUMBER
TOKEN_FLOAT
....
....
also could you please explain the plugin functions by examples.
http://www.freewebs.com/ogremagic/index.htm
Colin
admin
- Posts
- 928
- Threads
- 49
- Location
- Bulgaria
Hi Emil
The definitions can be found in ziron.zir
As for op macros, they're still supported, but ideally, better to use the plugin system.
I am in progress of upgrading the plugin and macro system, once done I will be making some examples, and hopefully start updating the documentation.
Emil_halim
member
- Posts
- 639
- Threads
- 104
- Location
- Alex, Egypt
i think there was a bug in op macro
try this
//sample of implementing the opcode or
//todo reg1:REGISTER
inline op procedure _or($reg1, $reg2) {
$expect sizeof $reg1 as sizeof $reg2: 'Operands must be equal size';
$if sizeof $reg1 == 32:
emit 1,0x0B 1,0xC0 + (($reg1*8)+$reg2);
$elseif sizeof $reg1 == 16:
emit 1,0x66 1,0x0B 1,0xC0+(($reg1*8)+$reg2);
$else
emit 1,0x0A 1,0xC0+(($reg1*8)+$reg2);
$end
}
_or eax,eax
http://www.freewebs.com/ogremagic/index.htm
Colin
admin
- Posts
- 928
- Threads
- 49
- Location
- Bulgaria
Hi Emil,
I have just finished fixing a bug with the plugin system. Please re-download the beta:
Download Here
$expect is no longer supported (for now), however you can easily implement this through a macro or plugin.
Ported version:
inline op procedure _or($reg1, $reg2) {
$if sizeof $reg1 != sizeof $reg2:
$raise 'Operands must be equal size';
$end;
$rp = 0xC0 + ((ord($reg1)*8)+ord($reg2));
$if sizeof $reg1 == 4:
emit byte 0x0B, $rp;
$elseif sizeof $reg1 == 2:
emit byte 0x66,0x0B, $rp;
$else
emit byte 0x0A, $rp;
$end;
}
_or edx, ecx;
creating an expect equal macro:
inline procedure expectEqual($p1, $p2, $err) {
$if $p1 != $p2:
$raise $err;
$end
}
usage:
expectEqual(sizeof $reg1, sizeof $reg2, 'Operands must be equal size');
Using $If is more logically and easier for programmers to understand.
Emil_halim
member
- Posts
- 639
- Threads
- 104
- Location
- Alex, Egypt
nice work Mr. Colin,
actually , i did net like $expect in old Ziron ,and agree with you $if is much better.
i have another question , in old plugin we used FileEntry to pares the buffer of code and
change it as we need , so how we can make that with new Ziron.
for example , see this
procedure FileEntry(DWord handle; char* strCode) {
uses edi;
eax = strOffset(strCode, '#define');
while (char[eax] <> 0) {
char[eax] = "_";
eax = strOffset(eax, '#define');
}
}
http://www.freewebs.com/ogremagic/index.htm