Register | Login
Forum Index > Requests and Feedback > Augmented assignment
Author Message
Pages: 1 2 3 4
0CodErr
Ziron Guru
(send private message)

Posts: 199
Topics: 37

Location:
[1476] Augmented assignment - posted: 2015-01-17 13:48:14
Currently supported: Code:
eax += ebx;
eax -= ebx;
eax++;
eax--;
eax >> 0; eax << 1; eax >> 2; // ... etc


And yet not supported: Code:
eax << cl;
eax &= ebx;
eax |= ebx;
eax ^= ebx;
~eax; 
-eax;


Also pay attention that in const expression someone could write:
Code:
const MY_CONST = -~0x12345678;
or Code:
const MY_CONST = ~-0x12345678;
or even Code:
const MY_CONST = -~-~-~-~0x12345678;

Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1479] - posted: 2015-01-17 14:26:35
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.

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1483] - posted: 2015-01-20 21:13:29
OK, i have implemented the following:

Code:
  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.

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
0CodErr
Ziron Guru
(send private message)

Posts: 199
Topics: 37

Location:
[1485] - posted: 2015-01-20 21:44:47
Just a suggestion. Because Ziron-- similar to C-like language, perhaps it would be better to keep close to the ะก syntax.
http://en.wikipedia.org/wiki/Bitwise_operations_in_C#Bitwise_NOT_.22.7E.22_.2F_one.27s_complement_.28unary.29
http://en.wikipedia.org/wiki/Bitwise_operations_in_C#Logical_equivalents
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1488] - posted: 2015-01-20 21:52:17
I never planned for Ziron to resemble C, but I am happy to add ~ as an additional not operator.

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
0CodErr
Ziron Guru
(send private message)

Posts: 199
Topics: 37

Location:
[1494] - posted: 2015-01-21 14:04:11
Why we should pay attention to this?

You write
Code:
eax != ecx;  // mov eax, ecx; not eax

This is something more complicated than others.

In the first post I suggested the Code:
-eax
it's like Code:
neg eax
.

If we do like Code:
eax != ecx
then we get Code:
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:
Code:
eax = ebc | ecx // mov eax, ebx // or eax, ecx
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1495] - posted: 2015-01-21 18:57:24
!= is for not equal.

eax != eax is eax = not eax
eax != ecx is eax = not ecx

Maybe I misunderstand your question.

Code:
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: Code:
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.

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
0CodErr
Ziron Guru
(send private message)

Posts: 199
Topics: 37

Location:
[1500] - posted: 2015-01-21 21:06:43
I mean that if we support more complex expressions then right variant is
Code:
eax = !ecx

or
Code:
eax = ~ecx

but not
Code:
eax != ecx

Pages: 1 2 3 4
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 1046, January 28, 2022, 2:08 pm.


Statistics:
Threads: 225 | Posts: 1848 | Members: 51 | Active Members: 51
Welcome to our newest member, yecate
const Copyright = '2011-2024 © OverHertz Ltd. All rights reserved.';
Web development by OverHertz Ltd