fferum

артем лох4

May 31st, 2020
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.67 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <iostream>
  3.  
  4. int main()
  5. {
  6.     char result, result2;
  7.     printf("(b2*w4+d2)-w1*(w2/b1+d1/w3)");
  8.     _asm {
  9.         //1- b2*w4
  10.         Multiplication b2, w4
  11.         //2- (1+d2)
  12.         Addition mw1, d2 //храниться в cw1
  13.         //3- w2/b1
  14.         Division w2, b1
  15.         //4- d1/w3
  16.         Division2 d1, w3
  17.         //5- (3+4)
  18.         Addition2 dw1, result
  19.         //6- w1*5
  20.         Multiplication w1, result2
  21.         //7- (2-6)
  22.         Subtraction cw1, result2
  23.  
  24.  
  25.         _add macro
  26.         pop ax
  27.         pop bx
  28.         add ax, bx
  29.         push ax
  30.         endm
  31.  
  32.         _sub macro
  33.         pop ax
  34.         pop bx
  35.         sub ax, bx
  36.         push ax
  37.         endm
  38.  
  39.         _div macro
  40.         pop ax
  41.         cwd
  42.         pop bx
  43.         div bx
  44.         push ax
  45.         endm
  46.  
  47.         _mul macro
  48.         pop ax
  49.         pop bx
  50.         mul bx
  51.         push ax
  52.         endm
  53.  
  54.         Addition macro cw1, cw2
  55.         push cw1
  56.         push cw2
  57.         _add
  58.         pop cw1
  59.         endm
  60.  
  61.         Addition2 macro cw1, cw2
  62.         push cw1
  63.         push cw2
  64.         _add
  65.         pop result2
  66.         endm
  67.  
  68.         Subtraction macro rw, sw
  69.         push sw
  70.         push rw
  71.         _sub
  72.         pop rw
  73.         endm
  74.  
  75.         Division macro dw1, dw2
  76.         push dw2
  77.         push dw1
  78.         _div
  79.         pop dw1
  80.         endm
  81.  
  82.         Division2 macro dw1, dw2
  83.         push dw2
  84.         push dw1
  85.         _div
  86.         pop result
  87.         endm
  88.        
  89.         Multiplication macro mw1, mw2
  90.         push mw2
  91.         push mw1
  92.         _mul
  93.         pop mw1
  94.         endm
  95.        
  96.     }
  97.     return 0;
  98. }
Add Comment
Please, Sign In to add comment