-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLab3c.s
107 lines (94 loc) · 2.18 KB
/
Lab3c.s
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/* DO NOT MODIFY THIS --------------------------------------------*/
.text
.global Display
.extern iprintf
.extern cr
.extern value
.extern getstring
/*----------------------------------------------------------------*/
/******************************************************************/
/* General Information ********************************************/
/* File Name: Lab3c.s **************************************/
/* Names of Students: _________________ and ____________________ **/
/* Date: _________________ **/
/* General Description: **/
/* **/
/******************************************************************/
Display:
/*Write your program here******************************************/
lea -12(%sp),%sp
movem.l %d5/%a2-%a3, (%sp)
move.l 20(%sp), %d5
pea Entries
jsr iprintf
addq.l #4, %sp
move.l 20(%sp), -(%sp)
jsr value
addq.l #4, %sp
jsr cr
displayloop:
move.l (%a2)+, -(%sp)
jsr value
addq.l #4, %sp
jsr cr
sub.l #1, %d5
bne displayloop
pea Min
jsr iprintf
addq.l #4, %sp
move.l (%a3), -(%sp)
jsr value
addq.l #4, %sp
jsr cr
pea Max
jsr iprintf
addq.l #4, %sp
move.l 4(%a3), -(%sp)
jsr value
addq.l #4, %sp
jsr cr
pea Mean
jsr iprintf
addq.l #4, %sp
move.l 8(%a3), -(%sp)
jsr value
addq.l #4, %sp
jsr cr
pea Divisible1
jsr iprintf
addq.l #4, %sp
move.l 24(%sp), -(%sp)
jsr value
addq.l #4, %sp
pea Divisible2
jsr iprintf
addq.l #4, %sp
move.l %d2, -(%sp)
jsr value
addq.l #4, %sp
jsr cr
pea Exit
jsr iprintf
addq.l #4, %sp
jsr cr
movem.l (%sp), %d5/%a2-%a3
lea 12(%sp),%sp
rts
/*End of Subroutine **************************************************/
.data
/*All Strings placed here **************************************************/
Entries:
.string "The number of entries was: "
Min:
.string "Min number= "
Max:
.string "Max number= "
Mean:
.string "Mean number= "
Divisible1:
.string "There are "
Divisible2:
.string " number(s) divisible by "
Exit:
.string "Program Ended."
/*End of Strings **************************************************/