program RAW_IMAGE 'test';
#set bits 32;
dword x, y;
y = @x;
program RAW_IMAGE 'test';
#set bits 32;
dword x = @x;
Operand 2 is invalid
A community discussion post from the original code:zIRON forum.
program RAW_IMAGE 'test';
#set bits 32;
dword x, y;
y = @x;
program RAW_IMAGE 'test';
#set bits 32;
dword x = @x;
Operand 2 is invalid
Thanks, fixed for next release.
Currently this
program RAW_IMAGE 'test';
#set bits 32;
dword x = @x;
x;
translated to
00000000 C7050A0000000A00 mov dword [dword 0xa],0xa
-0000
0000000A 0000 add [eax],al
0000000C 0000 add [eax],al
it wrong result.
Also this cannot be compiled:
program RAW_IMAGE 'test';
#set bits 32;
const MY_CONST_STRING = 'some string';
const ADDRESS_Of_MY_CONST_STRING = @MY_CONST_STRING;
Unexpected symbol @
translated to Code: 00000000 C7050A0000000A00 mov dword [dword 0xa],0xa
-0000
0000000A 0000 add [eax],al 0000000C 0000 add [eax],al it wrong result.
Why is this wrong result? If you mean that it doesn't initialize as the address, this I will add later after fixing rest of the bugs from the list. (I will add it to my list)
I will take a look at const, but I'm not sure I will add this as a const should be constant data, where as an address requires fixups, relocations etc etc
If you mean that it doesn't initialize as the address
Yes, I mean this.
This will be right
mov dword [dword 0xa],0xa
in case
dword x;
x = @x;
I will take a look at const, but I'm not sure I will add this as a const should be constant data, where as an address requires fixups, relocations etc etc
But other assemblers allow to do it. If Ziron also is assembler then why not?
I have added initialized data addresses for variables.
For consts I may consider it, but I'm still not sure if it is not worth it as it has no usability except to over complicate source.
Maybe is the next release I will add it after fixing a few other things.
Maybe it relevant to this topic:
program RAW_IMAGE 'test';
#set bits 32;
sysword Values[5];
eax = @Values[3];
Result:
00000000 B805000000 mov eax,0x5
00000005 0000 add [eax],al
00000007 0000 add [eax],al
00000009 0000 add [eax],al
0000000B 0000 add [eax],al
0000000D 0000 add [eax],al
0000000F 0000 add [eax],al
00000011 0000 add [eax],al
00000013 0000 add [eax],al
00000015 0000 add [eax],al
00000017 0000 add [eax],al
Also similar problem:
program RAW_IMAGE 'test';
#set bits 32;
sysword dValues;
inline procedure TestX() {
$X = 0;
$repeat 5:
ecx = $X;
ecx << $log2i(sizeof sysword);
ecx += @dValues;
$X = $X + 1;
$end
}
testX();
Result:
00000000 33C9 xor ecx,ecx
00000002 C1E102 shl ecx,0x2
00000005 33C9 xor ecx,ecx
00000007 C1E102 shl ecx,0x2
0000000A 33C9 xor ecx,ecx
0000000C C1E102 shl ecx,0x2
0000000F 33C9 xor ecx,ecx
00000011 C1E102 shl ecx,0x2
00000014 33C9 xor ecx,ecx
00000016 C1E102 shl ecx,0x2
00000019 0000 add [eax],al
0000001B 0000 add [eax],al