A
A
Alexey Mairin2018-02-27 10:55:14
assembler
Alexey Mairin, 2018-02-27 10:55:14

What does operand size conflict mean in Assembler?

Task: there are 2 arrays, you need to form 3 of the maximum numbers among these 2
Here is my code, but it writes a conflict in the size of the operands. Actually, maybe some tips, what I did wrong? And am I doing the right thing at all?

int firstArray[10], secondArray[10], maxArray[10],res1[10];

Start = clock();
  _asm finit
    _asm {
      pusha
      xor esi,esi
      xor ecx,ecx
      loop1:
      mov ax, firstArray[esi]
      mov bx, secondArray[esi]
      cmp ax,bx
      jg a1
      cmp ax,bx
      jl a2
        a1:mov maxArray[esi],ax
        a2:mov maxArray[esi],bx
      add esi,2
      sub cnt,1
      jnz loop1
      popa
        
  }
  __asm fwait

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2018-02-27
@m_avrina

If yours is not an ancient Pascal, and int is 32 bits, then the registers must also be 32-bit
. Second, the algorithm does not correspond to the task. Of the two arrays, the maximum number will be 2, and you have an index for iteration and one for the maximum numbers.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question