SHARE
TWEET

asembler3

a guest Oct 17th, 2019 80 in 263 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void CMultiplicationView::OnDraw(CDC* pDC)
  2. {
  3.     CMultiplicationDoc* pDoc = GetDocument();
  4.     ASSERT_VALID(pDoc);
  5.     if (!pDoc)
  6.         return;
  7.  
  8.     // TODO: add draw code for native data here
  9.  
  10.     CString str;
  11.  
  12.     // //ZAD1 zrealizuj y = a * b
  13.     //unsigned char a, b;
  14.     //unsigned short y;
  15.  
  16.     //a = 11;
  17.     //b = 8;
  18.     //y = 0;
  19.  
  20.     //unsigned char temp1 = a;
  21.     //unsigned char temp2 = b;
  22.  
  23.     ///*while (b != 0)
  24.     //{
  25.     //  if (b & 1) y += a;
  26.     //  a <<= 1;
  27.     //  b >>= 1;
  28.     //}*/
  29.  
  30.     //__asm {
  31.     //  mov al, a
  32.     //  mov ah, 0 // używamy od teraz ax
  33.     //  mov bl, b
  34.     //  mov cx, 0
  35.     // 
  36.     //  start:
  37.  
  38.     //  test bl, 1
  39.     //  JZ endif
  40.     //  add cx, ax
  41.     //  endif:
  42.     //  shl ax, 1
  43.     //  shr bl, 1 // tutaj flaga zero ustawi się, jeśli bl w wyniku shift right stanie się zerem
  44.     //  JNZ start
  45.  
  46.     //  mov y, cx
  47.  
  48.     //}
  49.  
  50.  
  51.     //ZAD2 zaimplementuj prostego ifa
  52.     unsigned char a, y;
  53.     a = 0x32;
  54.  
  55.  
  56.     __asm {
  57.         mov al, a
  58.         mov bl, 0
  59.  
  60.         sub al, 0x32
  61.         JZ endif
  62.         mov bl, 1
  63.         endif:
  64.         mov y, bl
  65.  
  66.     }
  67.  
  68.  
  69.  
  70.     str.Format(L"Wartość wej: %d, y = %d", a, y);
  71.     pDC->TextOutW(10, 10, str);
  72.  
  73.  
  74.  
  75.  
  76. }
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