-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 72d3daa
Showing
18 changed files
with
1,160 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
.data | ||
string1: .asciiz "Enter a number:" | ||
string2: .asciiz "Enter the secon number:" | ||
string3: .asciiz "Sum:" | ||
endLine: .asciiz "\n" | ||
|
||
.text | ||
main: | ||
|
||
li $v0 , 4 #print string1 | ||
la $a0 , string1 | ||
syscall | ||
|
||
li $v0 , 5 #read integer | ||
syscall | ||
|
||
move $t0,$v0 #Girdiğimiz integer değeri temporary(geçici) değere akttardık. | ||
|
||
li $v0 , 4 | ||
la $a0 , endLine #Boşluk vermek için. | ||
syscall | ||
|
||
li $v0 , 4 | ||
la $a0 , string2 | ||
syscall | ||
|
||
li $v0 , 5 | ||
syscall | ||
|
||
move $t1,$v0 | ||
|
||
li $v0 , 4 | ||
la $a0 , string3 | ||
syscall | ||
|
||
add $t2,$t1,$t0 #İki tane yazdığımız integer değerleri toplayıp $t2 temporary değere aktardık.s | ||
li $v0, 1 #print integer | ||
move $a0, $t2 #Temporary değeri a0 a aktardık. | ||
syscall | ||
|
||
|
||
li $v0, 10 #exit | ||
syscall | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
.data | ||
string1: .asciiz "Enter a number:" | ||
string2: .asciiz "Sum of digits = " # | ||
string3: .asciiz "Original number = " # | ||
endLine: .asciiz "\n" | ||
|
||
.text | ||
|
||
sumFunc: | ||
add $v0,$a0,$a1 # (int a0,int a1) | ||
|
||
jr $ra | ||
|
||
main: | ||
|
||
li $v0,4 | ||
la $a0,string1 | ||
syscall | ||
|
||
li $v0,5 | ||
syscall | ||
move $t0,$v0 | ||
|
||
li $v0,4 | ||
la $a0,string1 | ||
syscall | ||
|
||
li $v0,5 | ||
syscall | ||
move $t1,$v0 | ||
|
||
move $a0,$t0 | ||
move $a1,$t1 | ||
jal sumFunc | ||
move $t2,$v0 # t2 = sumFunc(a0,a1) | ||
|
||
li $v0,1 | ||
move $a0,$t2 | ||
syscall # Result | ||
|
||
|
||
|
||
|
||
li $v0,10 | ||
syscall |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
.data | ||
string1: .asciiz "Enter a number :" | ||
endLine: .asciiz "\n" | ||
string2: .asciiz "Addition : " | ||
string3: .asciiz "Dividition : " | ||
string4: .asciiz "Remainder : " | ||
string5: .asciiz "Multiplication : " | ||
|
||
.text | ||
main: | ||
|
||
li $v0,4 | ||
la $a0,string1 | ||
syscall | ||
|
||
li $v0,5 | ||
syscall | ||
move $t0,$v0 | ||
|
||
li $v0,4 | ||
la $a0,endLine | ||
syscall | ||
|
||
li $v0,4 | ||
la $a0,string1 | ||
syscall | ||
|
||
li $v0,5 | ||
syscall | ||
move $t1,$v0 | ||
|
||
|
||
beq $t0,$t1, Addition | ||
j Dividition | ||
|
||
Addition: | ||
|
||
li $v0,4 | ||
la $a0,string2 | ||
syscall | ||
|
||
add $t2,$t1,$t0 | ||
move $a0,$t2 | ||
|
||
li $v0,1 | ||
syscall | ||
j exit | ||
|
||
Dividition: | ||
|
||
li $v0,4 | ||
la $a0,string3 | ||
syscall | ||
|
||
div $t0,$t1 | ||
mflo $a0 | ||
li $v0,1 | ||
syscall | ||
|
||
li $v0,4 | ||
la $a0,endLine | ||
syscall | ||
|
||
li $v0,4 | ||
la $a0,string4 | ||
syscall | ||
|
||
mfhi $a0 | ||
li $v0,1 | ||
syscall | ||
|
||
li $v0,4 | ||
la $a0,endLine | ||
syscall | ||
|
||
|
||
li $v0,4 | ||
la $a0,string5 | ||
|
||
|
||
mul $t2,$t1,$t0 | ||
syscall | ||
move $a0,$t2 | ||
li $v0,1 | ||
syscall | ||
j exit | ||
|
||
|
||
exit: | ||
li $v0,10 | ||
syscall |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
.data | ||
|
||
string1: .asciiz "For add press 1, For sub press 2, For div press 3, For mult press 4,For remaminder press 5: " | ||
string2: .asciiz "Enter a number: " | ||
endLine: .asciiz "\n" | ||
addition: .asciiz "Addition : " | ||
subtraction: .asciiz "subtraction : " | ||
dividition: .asciiz "dividition : " | ||
multplication: .asciiz "multplication : " | ||
remainder: .asciiz "Remainder is: " | ||
|
||
.text | ||
main: | ||
|
||
li $v0,4 | ||
la $a0,string2 | ||
syscall | ||
|
||
li $v0,5 | ||
syscall | ||
move $t0,$v0 | ||
|
||
li $v0,4 | ||
la $a0,string2 | ||
syscall | ||
|
||
li $v0,5 | ||
syscall | ||
move $t1,$v0 | ||
|
||
li $v0,4 | ||
la $a0,endLine | ||
syscall | ||
|
||
li $v0,4 | ||
la $a0,string1 | ||
syscall | ||
|
||
li $v0,4 | ||
la $a0,endLine | ||
syscall | ||
|
||
li $v0,5 | ||
syscall | ||
move $t2,$v0 | ||
|
||
beq $t2,1,Addition | ||
beq $t2,2,Subtraction | ||
beq $t2,3,Dividition | ||
beq $t2,4,Multplication | ||
beq $t2,5,Remainder | ||
|
||
Addition: | ||
|
||
li $v0,4 | ||
la $a0,addition | ||
syscall | ||
|
||
li $v0,4 | ||
la $a0,endLine | ||
syscall | ||
|
||
add $t3,$t0,$t1 | ||
move $a0,$t3 | ||
|
||
li $v0,1 | ||
syscall | ||
j Exit | ||
|
||
Subtraction: | ||
|
||
li $v0,4 | ||
la $a0,subtraction | ||
syscall | ||
|
||
sub $t3,$t0,$t1 | ||
move $a0,$t3 | ||
|
||
li $v0,1 | ||
syscall | ||
j Exit | ||
|
||
Dividition: | ||
|
||
li $v0,4 | ||
la $a0,dividition | ||
syscall | ||
|
||
div $t0,$t1 | ||
mflo $a0 | ||
li $v0,1 | ||
syscall | ||
|
||
|
||
j Exit | ||
|
||
Multplication: | ||
|
||
li $v0,4 | ||
la $a0,multplication | ||
syscall | ||
|
||
mul $t3,$t0,$t1 | ||
move $a0,$t3 | ||
|
||
li $v0,1 | ||
syscall | ||
j Exit | ||
|
||
Remainder: | ||
|
||
li $v0,4 | ||
la $a0,remainder | ||
syscall | ||
|
||
|
||
rem $t3,$t0,$t1 | ||
move $a0,$t3 | ||
li $v0,1 | ||
syscall | ||
j Exit | ||
|
||
Exit: | ||
|
||
li $v0,10 | ||
syscall | ||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
.data | ||
|
||
endLine: .asciiz "\n" | ||
c: .asciiz "c:" | ||
a: .asciiz "a:" | ||
A: .word 3, 4, 5 | ||
|
||
.text | ||
main: | ||
li $s0,1 # a | ||
li $s1,4 # b | ||
add $s0,$s0,$s1 #a = a + b | ||
|
||
la $s3,A # address | ||
lw $t2,8($s3) # A[2] | ||
|
||
sub $t3,$s0,$s1 | ||
add $t2,$t2,$t3 | ||
sw $t2,4($s3) | ||
|
||
while: | ||
beq $s0,1,endWhile | ||
add $s2,$s0,$s1 | ||
sub $s0,1 | ||
li $v0,4 | ||
la $a0,c | ||
syscall | ||
li $v0,1 | ||
move $a0,$s2 | ||
syscall | ||
li $v0,4 | ||
la $a0,endLine | ||
syscall | ||
li $v0,4 | ||
la $a0,a | ||
syscall | ||
li $v0,1 | ||
move $a0,$s0 | ||
syscall | ||
li $v0,4 | ||
la $a0,endLine | ||
syscall | ||
j while | ||
endWhile: | ||
|
||
li $v0, 10 | ||
syscall | ||
|
||
|
||
|
||
|
||
|
||
|
Oops, something went wrong.