Advertisement
Guest User

Untitled

a guest
Oct 18th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.92 KB | None | 0 0
  1. // ConsoleApplication3.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <stdio.h>
  6.  
  7. int main()
  8. {
  9.     unsigned char a = 7;
  10.     unsigned char b = 6;
  11.     unsigned char y = 255;
  12.     /*_asm //konstrukcja IF
  13.     {
  14.     mov cl, 0
  15.     mov al, a
  16.     sub al, 7
  17.     jnz Bartek
  18.     mov cl, 1
  19.     Bartek: mov y, cl
  20.     } */
  21.  
  22.     //printf("y = %X\n", y);
  23.  
  24.     /*y = y & 0xFE;
  25.     a = a & 0x01;
  26.     y = a | y; */
  27.  
  28.     /*int licz = 0;
  29.     if (y &0x01)
  30.         licz++;
  31.     if (y & 0x02)
  32.         licz++;
  33.     if (y & 0x04)
  34.         licz++;
  35.     if (y & 0x08)
  36.         licz++;
  37.     if (y & 0x10)
  38.         licz++;
  39.     if (y & 0x20)
  40.         licz++;
  41.     if (y & 0x40)
  42.         licz++;
  43.     if (y & 0x80)
  44.         licz++; */
  45.     int licz = 0;
  46.     _asm {
  47.         mov cl, 0
  48.         mov al, a
  49.         test al, 0x01
  50.         jz endif
  51.         add cl, 1
  52.         endif:
  53.         test al, 0x02
  54.         jz endif
  55.         add cl, 1
  56.         endif:
  57.         test al, 0x04
  58.         jz endif
  59.         add cl, 1
  60.         test al, 0x08
  61.     }
  62.  
  63.  
  64.     printf("Wynik = %d", licz);
  65.     getchar();
  66.  
  67.     return 0;
  68.  
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement