-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIMT2019030_MAIN.java
More file actions
28 lines (24 loc) · 845 Bytes
/
IMT2019030_MAIN.java
File metadata and controls
28 lines (24 loc) · 845 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
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
public class IMT2019030_MAIN {
public static void main(String[] args)
throws IOException {
//Create a new IAS machine
IASMachine IAS=new IASMachine();
//Read assembly code from a text file
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream("input.txt")));
//Store it in Main memory of IAS machine
try {
String line;
while ((line = br.readLine()) != null) {
IAS.memory.m.set(Integer.parseInt(line.split(" ")[0],2),new BitsArray(line.split(" ")[1]));
}
} finally {
br.close();
}
//Execute
IAS.execute();
}
}