Z
Z
ZIK12017-11-15 17:46:10
assembler
ZIK1, 2017-11-15 17:46:10

Are the assignments done correctly?

Good day, I need to check 3 tasks, thanks in advance
1) • present a negative number in the direct code, the number must correspond to the brigade number * 10;
• translate this number into an additional code;
• make sure that the received negative number code is correct in the debugger mode.

#include "stdafx.h"
#include <iostream>
using namespace std;


int main()
{
  int A, B;
  B = -0x5A;
  _asm MOV EBX, B;
  _asm MOV EAX, 0;
  _asm MOV AL, BL;
  _asm NOT AL;
  _asm INC EAX;
  _asm MOV ECX, 0xFFFFFF80;
  _asm OR EAX, ECX;
  _asm NOT EAX;
  _asm ADD EAX, ECX;
  _asm INC AL;
  _asm MOV EBX, EAX;
  system("pause");
  return 0;
}

2) Declare 3 variables. Using assembler commands, send data from the 1st variable to the second, from the 2nd to the 3rd.
#include "stdafx.h"


int _tmain(int argc, _TCHAR* argv[])
{int A = 1;
int B = 2;
int C = 3;
_asm {
    mov EAX,A;
          mov B,EAX;
    MOV EAX,C;
    MOV EAX,B;
}

}

3) transfer data from one variable to another using absolute addressing.
#include "stdafx.h"


int _tmain(int argc, _TCHAR* argv[])
{
  int A;
  int B;
  A = 1;
  B = 7;
  _asm MOV EAX, A;
  void *pB = &B;
  _asm MOV EBX, pB;
  _asm MOV[EBX], EAX;
    return 0;
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jcmvbkbc, 2017-11-16
@jcmvbkbc

2 - no. From the second to the third is not forwarded.
3 - no. Indirect addressing is used.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question