Review: Assembly Language Example 1
.text
.align 2
main:
subu $29, $29, 32
sw $31, 20($29)
sd $4, 32($29)
sw $0, 24($29)
sw $0, 28($29)
loop:
lw $14, 28($29)
mul $15, $14, $14
lw $24, 24($29)
addu $25, $24, $15
sw $25, 24($29)
addu $8, $14, 1
sw $8, 28($29)
ble $8, 100, loop
la $4, str
lw $5, 24($29)
jal cout
move $2, $0
lw $31, 20($29)
addu $29, $29, 32
jr $31
.data
.align 0
str:
.asciiz “The answer is ”
Previous slide
Next slide
Back to first slide
View graphic version