Assembly Study Guild

21 flashcardsby Justin
Study these flashcardsFree · spaced repetition · iPhone, Android, Mac & web

All cards

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

j (name of loop)
18
What would be the code for exiting a loop when $t0 is equal to $t1?
beq $1,$2, (exit loop name)

(exit loop name):
19
What would be the code for exiting a loop when $t0 is equal to 0?
beqz $t0, (exit loop name) (exit loop name):
20
How would you copy from memory $t2 to register $t1?
lb $t1, 0($t0)
21
How would you copy from register to memory?
sb $t1, 0($t0)
Study all 21 cards for free