-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSUI.cpp
More file actions
42 lines (36 loc) · 1.01 KB
/
SUI.cpp
File metadata and controls
42 lines (36 loc) · 1.01 KB
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
#include "library.h"
#include "tools.h"
extern string reg[7];
extern int flag[5];
void sui(string cmd[], int len)
{
if(len!=2)
cout<<"error : invalid no. of args"<<endl;
else
{
if(validData(cmd[1])==0 || cmd[1].size()>2)
cout<<"error : invalid data"<<endl;
else
{
int num1=hexToDec(reg[0]);
//cout<<num1<<endl;
int num2=hexToDec(cmd[1]);
//cout<<num2<<endl;
if(num1>=num2)
{
num1-=num2;
flag[4]=0;
}
else
{
flag[4]=1;
num1=num2-num1;
}
reg[0]=decToHex(num1);
reverse(reg[0].begin(),reg[0].end());
if(num1<16)
reg[0]="0"+reg[0];
flags();
}
}
}