Register | Login
Forum Index > Bugs and Fixes > Wrong opcodes
Author Message
Pages: 1 2 3 4 5 6 7
0CodErr
Ziron Guru
(send private message)

Posts: 199
Topics: 37

Location:
[1659] - posted: 2015-02-10 16:42:59
This is for testing http://pastebin.com/W7Txw8ap
It contains commented part /* */, because it cannot be compiled
Operand size mismatch!
Code:
bt ax, imm


And also something wrong with test
Code:
test eax,0xc3f70012

instead of
Code:
 test ax


Also (this was not included in file above):
Code:
sbb ax, 0x1234

Result:
Code:
00000000  6683D834          sbb ax,byte +0x34


I reported only about some errors. Also there are similar errors. And better if you check all output.
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1663] - posted: 2015-02-11 01:11:18
I have rewrote test and bt(s/r) instruction handlers and solved both of those issues, I will take a look at sbb tomorrow.

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:
[1664] - posted: 2015-02-11 09:58:13
You wrote that Ziron now supported shld | shrd.
I have some tested. And it gave incorrect result.

This source: http://paste2.org/_wdDImHML
This result: http://paste2.org/_ed7CL5z7
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1666] - posted: 2015-02-11 13:21:02
My mistake, I missed a 16 bit check on one of the functions I rewrote. Thanks for fast report, it will be updated on next beta or release.

I have also fixed sbb, it was a problem with word based values being sometimes truncated into bytes.

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:
[1674] - posted: 2015-02-11 22:12:52
# Registers support very basic assignment expressions using + and - e.g. eax = edx + ecx - ebx;

Code:
program RAW_IMAGE 'test';

#set bits 32;

eax = dl + dh + dx;

Result:
Code:
00000000  0FB6C2            movzx eax,dl
00000003  03C6              add eax,esi
00000005  03C2              add eax,edx


But not every expression such as in your example so very basic.
And support such expressions can make parsing and code generation more complex.
I suggest to support only expressions which can be directly translated.

For example not so clear how translate this:
Code:
eax = ~ebx + ~ecx

even this
Code:
eax = ebx + eax

because not clear which value of eax we will add? Which was before calculations or after Code:
eax = ebx
?

But as for simple expressions that really good thing smile
for example:
Code:
eax = ebx | ecx
eax = ebx & ecx
eax = ebx ^ ecx
eax = ebx >> cl
eax = edx << cl
eax = ebx - ecx
eax = ebx + ecx
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1676] - posted: 2015-02-11 22:53:39
Yes I plan to only have very basic assignment expressions because of inefficient code generation without loss of registers.

Assignment expressions work from left to right.

so eax = eax + ebx + ecx - esi will go from left to right

Code:
eax = eax;
add eax, ebx
add eax, ecx
sub eax, esi


as for Code:
eax = dl + dh + dx;


I have added the appropriate error message. Thanks.

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:
[1680] - posted: 2015-02-12 20:32:25
Ok, how it would be in my example above?
Code:
eax = ebx + eax

This way:
Code:
mov eax, ebx
add eax, eax


And now compare some high level example:
Code:
a = b + a

Here in result 'a' really will be as sum of 'a + b'

While in our registers expression we get that 'eax' will be 'ebx * 2' but not 'ebx + eax'


Assignment expressions work from left to right.

What about operator precedence? As I know in constant expressions it does matter. And it may cause conflict with constant expressions and reg|mem expressions.

Yet example:
Code:
eax = ebx & ecx + edi - ebp | edx ^ esi

Code:
eax = -~-~ebx


Maybe better need to completely define in documentation which expressions are 'simple'. And if expression not simple then we just say 'error: expression too complex'
0CodErr
Ziron Guru
(send private message)

Posts: 199
Topics: 37

Location:
[1682] - posted: 2015-02-12 21:24:17
Again this http://pastebin.com/W7Txw8ap with some changes.
Add this: Code:
#set imm_roll on;

Change this: Code:
const imm   = imm16; // imm8;

And check result http://pastebin.com/8Vm0QEuK
Pages: 1 2 3 4 5 6 7
create new reply


Quick reply:

Message:



Currently Active Users:
There are currently 12 user(s) online. 0 member(s) and 12 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