-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathflags.cpp
More file actions
43 lines (39 loc) · 788 Bytes
/
flags.cpp
File metadata and controls
43 lines (39 loc) · 788 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "library.h"
#include "tools.h"
extern string reg[7];
extern int flag[5];
void flags()
{
string data=reg[0];
int i,binary[8],dec;
int parity=0;
dec=hexToDec(data);
//cout<<"a "<<reg[0]<<endl;
//cout<<"flag dec "<<dec<<endl;
if(dec==0) //ZERO
flag[1]=1;
else
flag[1]=0;
for(i=7;i>=0;i--)
{
if(dec>0)
{
binary[i]=dec%2;
dec/=2;
if(binary[i]==1)
parity++;
}
else
{
binary[i]=0;
}
//cout<<binary[i];
}
//cout<<endl;
if(parity%2==0)
parity=1;
else
parity=0;
flag[0]=binary[0]; // SIGN
flag[3]=parity; //PARITY
}