-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAddNumber.asm
More file actions
55 lines (40 loc) · 776 Bytes
/
AddNumber.asm
File metadata and controls
55 lines (40 loc) · 776 Bytes
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
.data
message: .asciiz "Enter first number want to add: "
message2: .asciiz "Enter second number want to add: "
message3: .asciiz "Sum of the given two numbers are: "
.text
main:
#first message
li $v0, 4
la $a0, message
syscall
#ask first number from user
li $v0, 5
syscall
#first number moved to $a1
move $a1, $v0
#print message2
li $v0, 4
la $a0, message2
syscall
#ask second number from user
li $v0, 5
syscall
#second number moved to $a2
move $a2, $v0
jal addTwoNumbers
#Print message3
li $v0, 4
la $a0, message3
syscall
move $t1, $v1
#print sum
li $v0, 1
move $a0, $t1
syscall
#end of main procedure
li $v0, 10
syscall
addTwoNumbers:
add $v1, $a2, $a1
jr $ra