-
Notifications
You must be signed in to change notification settings - Fork 0
/
PharmacyManagementMars.asm
304 lines (275 loc) · 5.65 KB
/
PharmacyManagementMars.asm
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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
.data
string1: .asciiz ">>>>>>>>>>>>>>>WELCOME TO MY PHARMACY<<<<<<<<<<<<<<<<<\n "
string2: .asciiz "Medincine list:\n"
string3: .asciiz "------------Medicine name-------Strength--------Price--\n"
string4: .asciiz "1)\t\tRigix\t\t40mg\t\tRs 67\n"
string5: .asciiz "2)\t\tRisek\t\t20mg\t\tRs 25\n"
string6: .asciiz "3)\t\tZertech\t\t50mg\t\tRs 150\n"
string7: .asciiz "4)\t\tFlagyle\t\t10mg\t\tRs 100\n"
string8: .asciiz "5)\t\tAmoxile\t\t40mg\t\tRs 60\n"
string9: .asciiz "6)\t\tBrufeene\t25mg\t\tRs 20\n"
string10: .asciiz "7) Exit\n"
string11: .asciiz "Select Your Option:"
op1: .asciiz "YOU SELECTED Rigix. How many you want?:"
op2: .asciiz "YOU SELECTED Risek. How many do you want?:"
op3: .asciiz "YOU SELECTED Zertech. How many do you want?:"
op4: .asciiz "YOU SELECTED Flagyle. How many do you want?"
op5: .asciiz "YOU SELECTED Amoxile. How many do you want?"
op6: .asciiz "YOU SELECTED Brufeene. How many do you want?"
cname: .asciiz "Enter name:"
bill: .asciiz "Your Bill Is: Rs."
ppcounter: .asciiz "\nPlease Pay It At Counter To Receive Your Medicine "
choice: .byte #for user input of choice
cust: .space 60 #for user input of customer name
.text
err:
li $v0, 4
la $a0, string1
syscall
li $v0, 4
la $a0, string2
syscall
li $v0, 4
la $a0, string3
syscall
li $v0, 4
la $a0, string4
syscall
li $v0, 4
la $a0, string5
syscall
li $v0, 4
la $a0, string6
syscall
li $v0, 4
la $a0, string7
syscall
li $v0, 4
la $a0, string8
syscall
li $v0, 4
la $a0, string9
syscall
li $v0, 4
la $a0, string10
syscall
li $v0, 4
la $a0, string11
syscall
li $v0,5 #take in input
syscall
move $t0,$v0
li $t1, 1
li $t2,2
li $t3,3
li $t4,4
li $t5,5
li $t6,6
li $t7,7
blt $t0,$t1,err
beq $t0,$t1,o1 # if input is equals to 1 go to o1 (option 1)
beq $t0,$t2,o2
beq $t0,$t3,o3
beq $t0,$t4,o4
beq $t0,$t5,o5
beq $t0,$t6,o6
beq $t0,$t7,end
bgt $t0,$t7,err
syscall
o1:
li $v0, 4 #HOW MANY YOU WANT?
la $a0, op1
syscall
li $v0,5 #take in input medicine count
syscall
move $t0,$v0
li $t1,67
mul $t2,$t0,$t1 #multiplying user input with 67
li $v0, 4 #Asking user input
la $a0, cname
syscall
li $v0,8 #take in input
la $a0, cust #load byte space into address
li $a1, 60 # allot the byte space for string
move $t3,$a0 #save string to t0
syscall
la $a0, cust #reload byte space to primary address
move $a0,$t3 # primary address = t0 address (load pointer)
li $v0,4 # print string
syscall
li $v0, 4
la $a0, bill
syscall
li $v0, 1
move $a0,$t2
syscall
li $v0, 4
la $a0, ppcounter
syscall
li $v0, 10
syscall
o2: #option 2
li $v0, 4 #HOW MANY YOU WANT?
la $a0, op2
syscall
li $v0,5 #take in input medicine count
syscall
move $t0,$v0
li $t1,25
mul $t2,$t0,$t1 #multiplying user input with 67
li $v0, 4 #Asking user input
la $a0, cname
syscall
li $v0,8 #take in input
la $a0, cust #load byte space into address
li $a1, 60 # allot the byte space for string
move $t3,$a0 #save string to t0
syscall
la $a0, cust #reload byte space to primary address
move $a0,$t3 # primary address = t0 address (load pointer)
li $v0,4 # print string
syscall
li $v0, 4
la $a0, bill
syscall
li $v0, 1
move $a0,$t2
syscall
li $v0, 4
la $a0, ppcounter
syscall
li $v0, 10
syscall
o3:
li $v0, 4 #HOW MANY YOU WANT?
la $a0, op3
syscall
li $v0,5 #take in input medicine count
syscall
move $t0,$v0
li $t1,150
mul $t2,$t0,$t1 #multiplying user input with 67
li $v0, 4 #Asking user input
la $a0, cname
syscall
li $v0,8 #take in input
la $a0, cust #load byte space into address
li $a1, 60 # allot the byte space for string
move $t3,$a0 #save string to t0
syscall
la $a0, cust #reload byte space to primary address
move $a0,$t3 # primary address = t0 address (load pointer)
li $v0,4 # print string
syscall
li $v0, 4
la $a0, bill
syscall
li $v0, 1
move $a0,$t2
syscall
li $v0, 4
la $a0, ppcounter
syscall
li $v0, 10
syscall
o4:
li $v0, 4 #HOW MANY YOU WANT?
la $a0, op4
syscall
li $v0,5 #take in input medicine count
syscall
move $t0,$v0
li $t1,100
mul $t2,$t0,$t1 #multiplying user input with 67
li $v0, 4 #Asking user input
la $a0, cname
syscall
li $v0,8 #take in input
la $a0, cust #load byte space into address
li $a1, 60 # allot the byte space for string
move $t3,$a0 #save string to t0
syscall
la $a0, cust #reload byte space to primary address
move $a0,$t3 # primary address = t0 address (load pointer)
li $v0,4 # print string
syscall
li $v0, 4
la $a0, bill
syscall
li $v0, 1
move $a0,$t2
syscall
li $v0, 4
la $a0, ppcounter
syscall
li $v0, 10
syscall
o5:
li $v0, 4 #HOW MANY YOU WANT?
la $a0, op5
syscall
li $v0,5 #take in input medicine count
syscall
move $t0,$v0
li $t1,60
mul $t2,$t0,$t1 #multiplying user input with 67
li $v0, 4 #Asking user input
la $a0, cname
syscall
li $v0,8 #take in input
la $a0, cust #load byte space into address
li $a1, 60 # allot the byte space for string
move $t3,$a0 #save string to t0
syscall
la $a0, cust #reload byte space to primary address
move $a0,$t3 # primary address = t0 address (load pointer)
li $v0,4 # print string
syscall
li $v0, 4
la $a0, bill
syscall
li $v0, 1
move $a0,$t2
syscall
li $v0, 4
la $a0, ppcounter
syscall
li $v0, 10
syscall
o6:
li $v0, 4 #HOW MANY YOU WANT?
la $a0, op6
syscall
li $v0,5 #take in input medicine count
syscall
move $t0,$v0
li $t1,20
mul $t2,$t0,$t1 #multiplying user input with 67
li $v0, 4 #Asking user input
la $a0, cname
syscall
li $v0,8 #take in input
la $a0, cust #load byte space into address
li $a1, 60 # allot the byte space for string
move $t3,$a0 #save string to t0
syscall
la $a0, cust #reload byte space to primary address
move $a0,$t3 # primary address = t0 address (load pointer)
li $v0,4 # print string
syscall
li $v0, 4
la $a0, bill
syscall
li $v0, 1
move $a0,$t2
syscall
li $v0, 4
la $a0, ppcounter
syscall
li $v0, 10
syscall
# ----------------------
# Terminate the program
end:
li $v0, 10
syscall