SHARE
TWEET

ASK_ZAD7

olgierd Dec 10th, 2018 (edited) 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Zadanie 7: Napisz kod w asemblerze odpowiadaj─ůcy poni┼╝szemu fragmentowi kodu w C.
  2. //Y = a*b
  3. unsigned char a = 0x03;
  4.     unsigned char b = 0x02;
  5.     unsigned short wynik;
  6.     _asm {
  7.         mov cl, a;
  8.         mov ch, 0x0;
  9.         mov bl, b;
  10.         mov ax, 0x0;
  11.     poczatek:
  12.         test bl, 0x1;
  13.         jz skok_przez_sume;
  14.         add ax, cx;
  15.     skok_przez_sume:
  16.         shl cx, 0x1;
  17.         shr bl, 0x1;
  18.         jnz poczatek;
  19.  
  20.         mov wynik, ax;
  21.     }
  22.     printf("%d * %d = %d", a, b, wynik);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top