Register | Login
Forum Index > Bugs and Fixes > Wrong opcodes
Author Message
Pages: 1 2 3 4 5 6 7
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1518] - posted: 2015-01-25 17:06:29
Fixed this for next release, seems I forgot to update this part of the code. Thanks for report.

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:
[1523] - posted: 2015-01-26 14:04:52
This is one of my tests again:
Code:
program RAW_IMAGE 'test';

#set bits 32;

inline procedure with_gp_regs(;){
  $x = 0;
  $repeat $argc:
    do_action($arg[$x], gp_ax, gp_bx, gp_cx, gp_dx, gp_si, gp_di, gp_bp, gp_sp);
    $x = $x + 1;
  $end
}

inline procedure do_action(;){
  $max = $argc - 1;
  $x = 1;
  $repeat $max:
    $y = 1;
    $repeat $max:
      $arg[0] $arg[$x], $arg[$y];
      $y = $y + 1;
    $end
    $x = $x + 1;
  $end
}

with_gp_regs(adc, add, and, bsf, bsr, bt, btc,
             btr, bts, cmp, cmpxchg, or, sbb,
             sub, test, xadd, xchg, xor);

Seems that something wrong with this(only part of output):
Code:
; ......................................
000009DF  0FC1FD            xadd ebp,edi
000009E2  0FC1ED            xadd ebp,ebp
000009E5  0FC1E5            xadd ebp,esp
000009E8  0FC1C4            xadd esp,eax
000009EB  0FC1DC            xadd esp,ebx
000009EE  0FC1CC            xadd esp,ecx
000009F1  0FC1D4            xadd esp,edx
000009F4  0FC1F4            xadd esp,esi
000009F7  0FC1FC            xadd esp,edi
000009FA  0FC1EC            xadd esp,ebp
000009FD  0FC1E4            xadd esp,esp
00000A00  90                nop
00000A01  93                xchg eax,ebx
00000A02  91                xchg eax,ecx
00000A03  92                xchg eax,edx
00000A04  96                xchg eax,esi
00000A05  97                xchg eax,edi
00000A06  95                xchg eax,ebp
00000A07  94                xchg eax,esp
00000A08  93                xchg eax,ebx
00000A09  86DB              xchg bl,bl
00000A0B  86CB              xchg cl,bl
00000A0D  86D3              xchg dl,bl
00000A0F  86F3              xchg dh,bl
00000A11  86FB              xchg bh,bl
00000A13  86EB              xchg ch,bl
00000A15  86E3              xchg ah,bl
00000A17  91                xchg eax,ecx
00000A18  86D9              xchg bl,cl
00000A1A  86C9              xchg cl,cl
00000A1C  86D1              xchg dl,cl
00000A1E  86F1              xchg dh,cl
00000A20  86F9              xchg bh,cl
00000A22  86E9              xchg ch,cl
00000A24  86E1              xchg ah,cl
00000A26  92                xchg eax,edx
00000A27  86DA              xchg bl,dl
00000A29  86CA              xchg cl,dl
00000A2B  86D2              xchg dl,dl
; ......................................
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1524] - posted: 2015-01-26 19:58:49
Thanks for the report, I have fixed the xchg opcode 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:
[1542] - posted: 2015-01-29 17:19:06
About copying values of smaller size to a larger size.

Currently we can do:
Code:
eax = dl;
eax = dx;

or as
Code:
eax = [byte]dl;
eax = [word]dx;

seems this usable smile

But this not work with signed values:
Code:
eax = [sbyte]dl;
eax = [int16]dx;

Result:
Code:
00000006  0FB6C2            movzx eax,dl
0000000F  0FB7C2            movzx eax,dx


Also incorrect work(but with dword seems correct):
Code:
eax = dword[eax];
eax = word[eax];
eax = byte[eax];

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

eax = dword[eax + edx*2];
eax = word[eax + edx*2];
eax = byte[eax + edx*2];

eax = dword[eax + edx*4];
eax = word[eax + edx*4];
eax = byte[eax + edx*4];

eax = dword[eax + edx*8];
eax = word[eax + edx*8];
eax = byte[eax + edx*8];

eax = dword[eax + 0x100500];
eax = word[eax + 0x100500];
eax = byte[eax + 0x100500];

eax = dword[eax + edx + 0x100500];
eax = word[eax + edx + 0x100500];
eax = byte[eax + edx + 0x100500];

eax = dword[eax + edx*2 + 0x100500];
eax = word[eax + edx*2 + 0x100500];
eax = byte[eax + edx*2 + 0x100500];

eax = dword[eax + edx*4 + 0x100500];
eax = word[eax + edx*4 + 0x100500];
eax = byte[eax + edx*4 + 0x100500];

eax = dword[eax + edx*8 + 0x100500];
eax = word[eax + edx*8 + 0x100500];
eax = byte[eax + edx*8 + 0x100500];

Result:
Code:
00000012  8B00              mov eax,[eax]
00000014  8B00              mov eax,[eax]
00000016  8B00              mov eax,[eax]
00000018  8B0410            mov eax,[eax+edx]
0000001B  8B0410            mov eax,[eax+edx]
0000001E  8B0410            mov eax,[eax+edx]
00000021  8B0450            mov eax,[eax+edx*2]
00000024  8B0450            mov eax,[eax+edx*2]
00000027  8B0450            mov eax,[eax+edx*2]
0000002A  8B0490            mov eax,[eax+edx*4]
0000002D  8B0490            mov eax,[eax+edx*4]
00000030  8B0490            mov eax,[eax+edx*4]
00000033  8B04D0            mov eax,[eax+edx*8]
00000036  8B04D0            mov eax,[eax+edx*8]
00000039  8B04D0            mov eax,[eax+edx*8]
0000003C  8B8000051000      mov eax,[eax+0x100500]
00000042  8B8000051000      mov eax,[eax+0x100500]
00000048  8B8000051000      mov eax,[eax+0x100500]
0000004E  8B841000051000    mov eax,[eax+edx+0x100500]
00000055  8B841000051000    mov eax,[eax+edx+0x100500]
0000005C  8B841000051000    mov eax,[eax+edx+0x100500]
00000063  8B845000051000    mov eax,[eax+edx*2+0x100500]
0000006A  8B845000051000    mov eax,[eax+edx*2+0x100500]
00000071  8B845000051000    mov eax,[eax+edx*2+0x100500]
00000078  8B849000051000    mov eax,[eax+edx*4+0x100500]
0000007F  8B849000051000    mov eax,[eax+edx*4+0x100500]
00000086  8B849000051000    mov eax,[eax+edx*4+0x100500]
0000008D  8B84D000051000    mov eax,[eax+edx*8+0x100500]
00000094  8B84D000051000    mov eax,[eax+edx*8+0x100500]
0000009B  8B84D000051000    mov eax,[eax+edx*8+0x100500]


Also suggest to add int8 type as signed byte type.
0CodErr
Ziron Guru
(send private message)

Posts: 199
Topics: 37

Location:
[1551] - posted: 2015-01-30 12:51:53
Currently in documentation
written
pointer 4 0 .. 4294967295

Seems it actually platform dependant.

But anyway strange result:
Code:
program RAW_IMAGE 'test';
#set bits 16;
pointer p16 = 0x123456789ABCDEF0; p16;  
#set bits 32;
pointer p32 = 0x123456789ABCDEF0; p32;  
#set bits 64;
pointer p64 = 0x123456789ABCDEF0; p64;  

Code:
F0 DE 00 00 E0 0C F2 00 F0 DE BC 9A E0 0C F2 00 F0 DE BC 9A 78 56 34 12

I am repeat again that was no warnings about number does not fit in type range(i.e. 0x123456789ABCDEF0 does not fit in 16, 32 bits).
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1552] - posted: 2015-01-30 15:23:38
no warnings about number does not fit in type range


This is an intended behaviour.

For example:

Code:
byte a;

a = 255;   // a = 255
a = 256;   // a = 0
a = 257;   // a = 1

// etc


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:
[1553] - posted: 2015-01-30 15:48:14
This is an intended behaviour.
I think that may cause some problems.
For example, let define some macro which use byte constants. Also somewhere define constants that used in macro which fits in byte. And forget about this macro. After some time we just change values of our constants to values which at now NOT fits in byte. Macro may work wrong. But no warnings. And we will look up where error too long.
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1563] - posted: 2015-01-31 00:27:38
OK, I have changed the default behaviour and added a new directive "imm_roll".

e.g.

Code:
byte a;

#set imm_roll true;
a = 257;   // a = 1

#set imm_roll false; //the default value
a = 257;   // error


Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
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