Skip to content
Low-level programming · Higher-level thinking
Login Register
Forum / Bugs and Fixes

Wrong opcodes

A community discussion post from the original code:zIRON forum.

Replies

0CodErr member
Posts
201
Threads
37
Location
Unknown

Ok, I will test again :) Are you checked all result output when you tested?

0CodErr member
Posts
201
Threads
37
Location
Unknown

A bit smaller sample:

program RAW_IMAGE 'test';
#set bits 32;
adc bx, 0x1234

Result:

00000000  81                db 0x81
00000001  D3                db 0xd3
00000002  3412              xor al,0x12
Colin admin
Posts
928
Threads
49
Location
Bulgaria

I found what is most likely the issue, not sure why it is an intermittant problem, maybe from something else I have changed, but it should be working for next release correctly.

Thanks for the help.

0CodErr member
Posts
201
Threads
37
Location
Unknown

Seems currently this error not occurs, it good :)

But this is interesting why you didn't immediate replicate the bug?

I have a similar example but it much bigger.

Only source file has more than 2500 lines of code.

And i do no want do to post each of line apart because you can compile code and get all of lines yourself.

If you're not going to check all the output file then error will remain in Ziron.

So you should to really verify completely all.

Or also check better source code.

Colin admin
Posts
928
Threads
49
Location
Bulgaria

Actually i tried the whole code you posted and I did not get the bug, I am uncertain as to why the bug was not replicated. So I assume it had something to do with something else I have fixed, but what I found was a likely possible fix for this potential problem (which has not occurred yet for me)

If it reappears, please let me know, but hopefully this issue is solved.

0CodErr member
Posts
201
Threads
37
Location
Unknown
I have a similar example but it much bigger. Only source file has more than 2500 lines of code.

Ok, this is it: http://www.paste.to/8aPVCdue

Web page with disassembled code is too big (20 megabytes)

Better if you will compile and disassemble code yourself. Then result of plain text will be (2.73 megabytes).

But anyway :) big result page: bigpaste.com/4p8fww04

Possible bugs:

  • in some cases instead of right instruction we get 'add' instruction (example: cmp byte[0x12345678],0x12; // add byte ...)
  • in some cases instead of 'word' we get 'dword' (example: rcr word[edx],0x12; // rcr dword...)
  • unnecessary dispacement '+0x0' added (example: rol dword[esi + esi*4],0x12; // ...+0x0 ...)
  • some instructions can be coded with short variant(example: xor word [edx + eax + 0x12345678], 0x12; // can be coded: 6683B4027856341212)

Of course, i will not post all lines apart with description of each. Just compile and check yourself. Maybe also there is some bugs about which i did not wrote.

And I think that we should not rush with the adding of new features. Because many of the asm instructions still is not supported. And better at first to implement the primitive stuff and then more complex.

0CodErr member
Posts
201
Threads
37
Location
Unknown
I have added error when referencing the assignment operand for now.

How about

eax = ecx + dword[eax];

?

It still compiles.

Also problem

byte [eax + edx] = byte [eax];

Result:

00000000  50                push eax
00000001  8A00              mov al,[eax]
00000003  880410            mov [eax+edx],al
00000006  58                pop eax

There is after

mov al,[eax]

we get 'eax' currupted for next action.

Colin admin
Posts
928
Threads
49
Location
Bulgaria

All of the above mentioned are fixed for next release, I will check through the link you sent after I finish up with the rest of reported issues. Thanks.