1How would you ADD $t0 to $t1 and make $t2 the sum?
Add $t2, $t0, $t1
2How would you ADD 5 to $t0 and make $t1 the sum?
Addi $t1, $t0, 5
3How would you MULTIPLY $t0 to $t1 and make $t2 the product?
Mul $t2, $t1, $t0
4How would you DIVIDE $t0 by $t1 and make $t2 the quotient?
div $t0, $t1
mflo $t2
5How would you DIVIDE $t0 by $t1 and make $t2 the remainder?
div $t0, $t1
mfhi $t2
6How do you exit a program?
li $v0, 10
syscall
7How would you print a string saved as str?
la $a0, str
li $v0, 4
syscall
8How would you load $t0 to $t1?
move $t1, $t0
9What does li $v0, 1 syscall do?
Prints an integer
10What does li $v0, 4 syscall do?
Prints a string
11What does li $v0, 5 syscall do?
Reads a user given integer
12Where is a user inputted integer stored?
$v0
13How do you section off a line to be a comment?
#(comment here)
14What would the code for declaring a string named str with text "Hello world" be?
str: .asciiz "Hello world"
15When declaring variables such as strings, words, and spaces, what needs to be before all of it?
.data
16When executing code such as printing or loading registers or looping, what needs to be before all of it?
.text
.globl main
main:
17How do you make a loop?
(name of loop):
j (name of loop)
18What would be the code for exiting a loop when $t0 is equal to $t1?
beq $1,$2, (exit loop name)
(exit loop name):
19What would be the code for exiting a loop when $t0 is equal to 0?
beqz $t0, (exit loop name)
(exit loop name):
20How would you copy from memory $t2 to register $t1?
lb $t1, 0($t0)
21How would you copy from register to memory?
sb $t1, 0($t0)