-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathJMP.cpp
More file actions
31 lines (27 loc) · 735 Bytes
/
JMP.cpp
File metadata and controls
31 lines (27 loc) · 735 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
#include "library.h"
#include "tools.h"
extern vector<string> vect;
extern string pc;
extern int pointer;
void jmp(string cmd[], int len)
{
if(len!=2)
cout<<"error : invalid no. of args"<<endl;
else
{
if(validAddress(cmd[1])==0 || cmd[1].size()>4 )
cout<<" error :"<<pc<<"invalid address"<<endl;
else
{
// cout<<"pointer "<<pointer<<endl;
//cout<<"cmd[1] "<<cmd[1]<<endl;
pointer=findIndex(cmd[1]);
if(pointer==-1)
{
cout<<"error : "<<pc<<"wrong address in jump"<<endl;
exit(0);
}
//}
}
}
}