-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIsaFileReader.java
48 lines (34 loc) · 1.22 KB
/
IsaFileReader.java
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
44
45
46
47
48
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
public class IsaFileReader {
static int progr[] = new int[32];
public static void main(String[] args) throws FileNotFoundException, IOException {
try {
FileInputStream reader = new FileInputStream(new File("C:\\Users\\gthom\\Downloads\\cae-lab-master\\cae-lab-master\\finasgmt\\tests\\task1\\shift.bin"));
int byt;
int j = 0;
int offset = 0;
int i = 0;
while ((byt = reader.read()) != -1) {
System.out.println(Integer.toHexString(byt));
progr[j] |= (byt << offset);
System.out.println(Integer.toHexString(progr[j]));
offset += 8;
i += 1;
if(i >= 4){
j += 1;
i = 0;
offset = 0;
}
}
reader.close();
} catch (IOException ex) {
ex.printStackTrace();
}
for (int i = 0; i < progr.length; ++i) {
System.out.print( Integer.toHexString(progr[i]) + " ");
}
}
}