-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMain.jack
55 lines (39 loc) · 1.13 KB
/
Main.jack
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
49
50
51
52
53
54
55
class Main {
function void main() {
var Array a, b, c;
var int inM, instruction, reset;
var int i,d;
let inM = Keyboard.readInt("Enter the value of inM: ");
let instruction = Keyboard.readInt("Enter the value of instruction: ");
let reset = Keyboard.readInt("Enter the value of reset: ");
do Output.println();
do Output.printString("The Value of outM is: ");
let a = CPU.o1(inM,instruction,reset);
let i = 0;
while(i < 16){
do Output.printInt(a[i]);
let i = i + 1;
}
do Output.println();
do Output.printString("The Value of writeM is: ");
let d = CPU.o2(inM, instruction, reset);
do Output.printInt(d);
do Output.println();
do Output.printString("The Value of addressM is: ");
let b = CPU.addressm(inM, instruction, reset);
let i = 0;
while(i < 16){
do Output.printInt(b[i]);
let i = i + 1;
}
do Output.println();
do Output.printString("The Value of pc is: ");
let c = CPU.o3(inM, instruction, reset);
let i = 0;
while(i < 16){
do Output.printInt(c[i]);
let i = i + 1;
}
return;
}
}