Advertisement
fferum

asm4

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