-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathsampleprogram.txt
79 lines (68 loc) · 1.27 KB
/
sampleprogram.txt
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
input.txt
_________________________________________
var f, n;
procedure fact;
var ans1;
begin
ans1:=n;
n:= n-1;
if n = 0 then f := 1;
if n > 0 then call fact;
f:=f*ans1;
end;
begin
n:=3;
call fact;
write f;
end.
________________________________________
LAout.txt
_______________________________________
29 2 f 17 2 n 18 30 2 fact 18 29 2 ans1 18 21 2 ans1 20 2 n 18 2 n 20 2 n 5 3 4 18 23 2 n 9 3 5 24 2 f 20 3 6 18 23 2 n 13 3 7 24 27 2 fact 18 2 f 20 2 f 6 2 ans1 18 22 18 21 2 n 20 3 8 18 27 2 fact 18 31 2 f 18 22 19
_______________________________________
code.txt
______________________________________
7 0 0 15
7 0 0 2
6 0 0 5
3 0 0 3
4 0 0 2
3 0 0 3
1 1 0 4
14 0 0 1
4 0 0 3
3 0 0 3
1 1 0 5
19 0 0 1
8 0 0 15
1 1 0 6
4 1 0 2
6 0 0 6
11 0 0 3
______________________________________
output.txt
______________________________________
Interpreted Assembly Language
Line OP R L M
0 jmp 0 0 15
1 jmp 0 0 2
2 inc 0 0 5
3 lod 0 0 3
4 sto 0 -1 2
5 lod 0 0 3
6 lit 1 0 4
7 sub 0 0 1
8 sto 0 0 3
9 lod 0 0 3
10 lit 1 0 5
11 eql 0 0 1
12 jpc 0 0 15
13 lit 1 0 6
14 sto 1 0 2
15 inc 0 0 6
16 sio 0 0 3
Execution of Program:
Initial Values pc bp sp
0 jmp 0 0 15 15 1 4 0 0 0 0
15 inc 0 0 6 16 1 10 0 0 0 0 0 0 0 0 0 0
16 sio 0 0 3 17 1 10 0 0 0 0 0 0 0 0 0 0