Page 1 of 1

Assembler ebx,ecx registers do not work?

Posted: Mon May 18, 2015 10:31 am
by KG_is_back
Following code (while loop) works fine when eax is used, but crashes if any other register is used (in this example ebx). It also crashes if one of mentioned registers is in any way involved in counting loop index.

Code: Select all

streamout out;
float F1=1;
push ebx;

mov ebx,32;
loopjmp:
sub ebx,32;
jl finish;

//this code doesn't matter (it only counts loop length)
   movaps xmm0,out;
   addps xmm0,F1;
   movaps out,xmm0;

jmp loopjmp;
finish:

pop ebx;

is this a bug? or am I doing something wrong?

even following code crashes:

Code: Select all

streamout out;
float F1=1;
push ebx;

mov eax,32;
mov ebx,eax;
loopjmp:
mov eax,ebx;
sub eax,32;
jl finish;
mov ebx,eax;
//this code doesn't matter (it only counts loop length)
   movaps xmm0,out;
   addps xmm0,F1;
   movaps out,xmm0;

jmp loopjmp;
finish:

pop ebx;

it seems to me that "mov" instructions are buggy...

Re: Assembler ebx,ecx registers do not work?

Posted: Mon May 18, 2015 8:12 pm
by martinvicanek
Confirmed. Even an ASM hop will crash if you replace eax by ebx:

This works:

Code: Select all

streamout dummy;
float F1=1;
mov eax,ecx; and eax,7; cmp eax,0; jnz end0;
movaps xmm0,dummy;
addps xmm0,F1;
movaps dummy,xmm0;
end0:

This crashes:

Code: Select all

streamout dummy;
float F1=1;
mov ebx,ecx; and ebx,7; cmp ebx,0; jnz end0;
movaps xmm0,dummy;
addps xmm0,F1;
movaps dummy,xmm0;
end0:

Re: Assembler ebx,ecx registers do not work?

Posted: Mon May 18, 2015 8:31 pm
by KG_is_back
I think I know what the issue is:
You can also now use ebx, ecx and edx in the following opcodes:

add reg, reg
add reg, var
sub reg, reg


there is no "sub reg, integer"

Re: Assembler ebx,ecx registers do not work?

Posted: Mon May 18, 2015 9:12 pm
by MyCo
The e-registers support is very chaotic... thought Malc would sort it out, but it got worse. eg. "sub reg,int" only works with eax, while "add reg,int" works only with eax and ebx, and "and reg,int" works with eax,ebx,ecx but not edx... and so on... you basically have to check if the opcode output has something in it for every instruction.

In the latest version, "add/sub reg,reg" also support edx, edi and ebp... although you can't push/pop them for rescuing content... and the opcode output for ebp and edi are the same, so they are obviously wrong.

It's such a mess...

Re: Assembler ebx,ecx registers do not work?

Posted: Tue Jun 09, 2015 11:31 am
by Tronic
psrld
Work for you?

Re: Assembler ebx,ecx registers do not work?

Posted: Tue Jun 09, 2015 9:54 pm
by martinvicanek
nope

Re: Assembler ebx,ecx registers do not work?

Posted: Tue Jun 09, 2015 10:43 pm
by Tronic
grrr :x