-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AM-pa1 #7
base: master
Are you sure you want to change the base?
AM-pa1 #7
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# COMP3410 Program Template | ||
# Author: Aaron Marshall | ||
# Assignment: PA[1] part 3 | ||
# Date: 2/10/14 | ||
#adds odd 1-15 | ||
.text | ||
|
||
li $s0, 1 #1 | ||
addi $s1, $s0, 2 #3 | ||
loop: | ||
add $s0, $s1, $s0 # s0 + s1 | ||
addi $s1, $s1, 2 #s1+2 | ||
ble $s1, 15, loop # starts loop if <= 15 | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. -6 Instructions require that you store partial sum in memory and retrieve it each time you add a number to it. |
||
add $a0,$zero, $s0 #prints final answer | ||
li $v0, 1 | ||
syscall | ||
|
||
li $v0, 10 #exits | ||
syscall |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# COMP3410 Program Template | ||
# Author: Aaron Marshall | ||
# Assignment: PA[1] part 2 | ||
# Date: 2/10/14 | ||
# takes two inputted number and adds, subs, and mults | ||
.data | ||
input: .asciiz "Input two integers.\n" | ||
subtext: .asciiz "\nSubtracting......\n" | ||
addtext: .asciiz "\nAdding...........\n" | ||
multitext: .asciiz "\nMultiplying......\n" | ||
goodbye: .asciiz "\nBye..............\n" | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. -4 Instructions require a printed introduction including name, title, and purpose of program |
||
.text | ||
la $a0, input #output of input text | ||
li $v0, 4 | ||
syscall | ||
|
||
li $v0, 5 #it wants a number | ||
syscall | ||
add $s0, $zero, $v0 #adds number to register | ||
|
||
li $v0, 5 #get the second number | ||
syscall | ||
add $s1, $zero, $v0 #adds sec. to register | ||
|
||
la $a0, addtext #prints the addtext | ||
li $v0, 4 | ||
syscall | ||
|
||
add $s2, $s0, $s1 # does the math then prints the result | ||
add $a0, $s2, $zero | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. -8 Instructions require that your calculations be stored in memory and retrieved from memory for printing. |
||
li $v0, 1 | ||
syscall | ||
|
||
la $a0, subtext #prints the subtext | ||
li $v0, 4 | ||
syscall | ||
|
||
sub $s3, $s0, $s1 #does subtraction and prints answer | ||
add $a0, $s3, $zero | ||
li $v0, 1 | ||
syscall | ||
|
||
la $a0, multitext #prints multitext | ||
li $v0, 4 | ||
syscall | ||
|
||
mul $s4, $s0, $s1 #multiplies and prints answer | ||
add $a0, $s4, $zero | ||
li $v0, 1 | ||
syscall | ||
|
||
la $a0, goodbye #prints the bye message | ||
li $v0, 4 | ||
syscall | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. -4 Instructions require a printed concluding message. |
||
li $v0, 10 #exits | ||
syscall |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job, program works well under all test cases.