Colin
admin
Posts
928
Threads
49
Location
Bulgaria
Post #1479
2015-01-17 14:26:35 UTC
I am avoiding to add the ability to write complex expressions to keep the simple assembly readability. But I will consider to add some of these. such as eax != ... etc.
Colin
admin
Posts
928
Threads
49
Location
Bulgaria
Post #1483
2015-01-20 21:13:29 UTC
OK, i have implemented the following:
eax != ecx; // mov eax, ecx; not eax
eax != eax; // not eax
eax &= ecx; // and eax, ecx
eax ^= ecx; // xor eax, ecx
eax |= edx; // or eax, edx
They will be available on todays release.
0CodErr
member
Posts
201
Threads
37
Location
Unknown
Colin
admin
Posts
928
Threads
49
Location
Bulgaria
Post #1488
2015-01-20 21:52:17 UTC
I never planned for Ziron to resemble C, but I am happy to add ~ as an additional not operator.
0CodErr
member
Posts
201
Threads
37
Location
Unknown
Post #1494
2015-01-21 14:04:11 UTC
Why we should pay attention to this?
You write
eax != ecx; // mov eax, ecx; not eax
This is something more complicated than others.
In the first post I suggested the
-eax
it's like
neg eax
.
If we do like
eax != ecx
then we get
eax -= ecx
.
But we already have "-=" operator. If we do make an exception for this then our language will be less orthogonal than it could be.
If we want to use more complicated expressions then i think we also should use something like this:
eax = ebc | ecx // mov eax, ebx // or eax, ecx
Colin
admin
Posts
928
Threads
49
Location
Bulgaria
Post #1495
2015-01-21 18:57:24 UTC
!= is for not equal.
eax != eax is eax = not eax
eax != ecx is eax = not ecx
Maybe I misunderstand your question.
program PE32_CUI 'Sample';
#include 'platform_def.zir';
#include 'console.zir';
ebx = 500;
ecx = 100;
ebx -= ecx;
print('ebx -= ecx: ', ebx, '\r\n');
ebx = 500;
ecx = 100;
ebx != ebx;
print('ebx != ebx: ', ebx, '\r\n');
ebx = 500;
ecx = 100;
ebx != ecx;
print('ebx != ecx: ', ebx, '\r\n');
wait_key();
ExitProcess(0);
Output:
ebx -= ecx: 400
ebx != ebx: 4294966795
ebx != ecx: 4294967195
Press any key to continue
!= and -= are not the same.
as for -eax, i missed that one, added now for next release.
0CodErr
member
Posts
201
Threads
37
Location
Unknown
Post #1500
2015-01-21 21:06:43 UTC
I mean that if we support more complex expressions then right variant is
eax = !ecx
or
eax = ~ecx
but not
eax != ecx