-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreadingText.asm
More file actions
194 lines (154 loc) · 2.95 KB
/
Copy pathreadingText.asm
File metadata and controls
194 lines (154 loc) · 2.95 KB
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
#This program reads in a string from the user and displays it back out
.data
#messages to display
myMessage0: .asciiz "Please enter your name: "
myMessage1: .asciiz "Hello, "
#variable to store user input, data type: .space
#need to specify how many characters user is allowed to enter
userInput: .space 20
madLib1: .asciiz "\nColor: "
madLib2: .asciiz "Superlative: "
madLib3: .asciiz "Adjective: "
madLib4: .asciiz "Body Part: "
madLib5: .asciiz "Noun: "
madLib6: .asciiz "Animal: "
ml1Input: .space 20
ml2Input: .space 20
ml3Input: .space 20
ml4Input: .space 20
ml5Input: .space 20
ml6Input: .space 20
#final madlib output
mad1: .asciiz "\nThe "
mad2: .asciiz "Dragon is the "
mad3: .asciiz "Dragon of all."
mad4: .asciiz " It has "
mad5: .asciiz "and a "
mad6: .asciiz "shaped like a "
.text
main:
#display user prompt to enter name
li $v0, 4
la $a0, myMessage0
syscall
#get user input as text----------------------------------
li $v0, 8 #system signal for reading text: 8
#passing argument to system call
la $a0, userInput
#telling system max length of string to be entered
li $a1, 20
syscall
#display message1
li $v0, 4 #system signal to display text: 4
la $a0, myMessage1
syscall
#display userInput
li $v0, 4
la $a0, userInput
syscall
#Madlib game-----------------------------------------------
#Display madLib1
li $v0, 4
la $a0, madLib1
syscall
#get ml1Input
li $v0, 8
la $a0, ml1Input
li $a1, 20
syscall
#Display madLib2
li $v0, 4
la $a0, madLib2
syscall
#get ml2Input
li $v0, 8
la $a0, ml2Input
li $a1, 20
syscall
#Display madLib3
li $v0, 4
la $a0, madLib3
syscall
#get ml3Input
li $v0, 8
la $a0, ml3Input
li $a1, 20
syscall
#Display madLib14
li $v0, 4
la $a0, madLib4
syscall
#get ml4Input
li $v0, 8
la $a0, ml4Input
li $a1, 20
syscall
#Display madLib5
li $v0, 4
la $a0, madLib5
syscall
#get ml5Input
li $v0, 8
la $a0, ml5Input
li $a1, 20
syscall
#Display madLib6
li $v0, 4
la $a0, madLib6
syscall
#get ml6Input
li $v0, 8
la $a0, ml6Input
li $a1, 20
syscall
#display mad1
li $v0, 4
la $a0, mad1
syscall
#display ml1Input
li $v0, 4
la $a0, ml1Input
syscall
#display mad2
li $v0, 4
la $a0, mad2
syscall
#display ml2Input
li $v0, 4
la $a0, ml2Input
syscall
#display mad3
li $v0, 4
la $a0, mad3
syscall
#display mad4
li $v0, 4
la $a0, mad4
syscall
#display ml3Input
li $v0, 4
la $a0, ml3Input
syscall
#display ml4Input
li $v0, 4
la $a0, ml4Input
syscall
#display mad5
li $v0, 4
la $a0, mad5
syscall
#display ml5Input
li $v0, 4
la $a0, ml5Input
syscall
#display mad6
li $v0, 4
la $a0, mad6
syscall
#display ml6Input
li $v0, 4
la $a0, ml6Input
syscall
#End of the main function
li $v0, 10 #system signal for ending main function
syscall