Advertisement
fferum

asm3

May 30th, 2020
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.35 KB | None | 0 0
  1. //второй вариант
  2. #include <stdio.h>
  3. #include <locale.h>
  4. #include <cstdlib>
  5. int main()
  6. {
  7.     setlocale(LC_ALL, "Russian");
  8.     int d1, result2;
  9.     short int result1, w1, result4, w2;
  10.     char b1, result3;
  11.     printf("Введите число для ССЛ:");
  12.     scanf_s("%hd", &w1);
  13.     printf("Введите число для ЦСП(8)П:");
  14.     scanf_s("%hd", &w2);
  15.     printf("Введите число для AДП:");
  16.     scanf_s("%d", &d1);
  17.     printf("Введите число для ЦБЛ:");
  18.     scanf_s("%hhd", &b1);
  19.     _asm
  20.     {
  21.         //ССЛ(2)
  22.         mov ax, w1
  23.         shl ax, 2
  24.         mov result1, ax
  25.         //АДП(3)
  26.         mov ax, word ptr d1
  27.         mov bx, word ptr d1 + 2
  28.         mov cx, 3
  29.         m1:
  30.         clc
  31.             rcr bx, 1
  32.             rcr ax, 1
  33.             loop m1
  34.             mov word ptr result2, ax
  35.             mov word ptr result2 + 2, bx
  36.             //ЦБЛ(4)
  37.             mov al, b1
  38.             rol al, 4
  39.             mov result3, al
  40.             //ЦСП(5)П
  41.             mov ax, w2
  42.             mov bx, 5
  43.             m2:
  44.         rcr ax, 1
  45.             loop m2
  46.             mov result4, ax
  47.     }
  48.     printf("CCЛ:%d\n", result1);
  49.     printf("АДП:%d\n", result2);
  50.     printf("ЦБЛ:%hhd\n", result3);
  51.     printf("ЦСП(8)П:%hd\n", result4);
  52.  
  53.     return 0;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement