EvgeniiKraaaaaaaav

ASM_C_logic-and

May 3rd, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.79 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <stdio.h>
  3. #include <locale.h>
  4. #include <cstdlib>
  5. int main()
  6. {
  7.     setlocale(LC_ALL, "Russian");
  8.     int a;
  9.     printf("This program calculet high byte words logically added to the low byte, written in reverse order.:\n");
  10.     printf("Enter value A:\n");
  11.     scanf_s("%i", &a);
  12.     _asm
  13.     {
  14.    
  15.         mov eax, a
  16.         mov cx, 8
  17.         mov bl, 1
  18.         xor dx, dx
  19.  
  20.         reverse :
  21.  
  22.         shr ax, 1
  23.         jnc escc
  24.  
  25.         add cx, -1
  26.         shl bl, cl
  27.         add dl, bl
  28.  
  29.         mov bl, 1
  30.         add cx, 1
  31.  
  32.  
  33.         escc:
  34.  
  35.         loop reverse
  36.  
  37.         mov eax, a
  38.         mov cl, 8
  39.         shr ax, cl
  40.         and ax, dx
  41.         mov a,eax
  42.     }
  43.     printf("Result on Asm: %i\n", a);
  44.     system("pause");
  45.     return 0;
  46. }
Add Comment
Please, Sign In to add comment