|
.globl main
.text
main : # execution starts here
li $t0, 1
lw $t1, numbers
lw $t2, factor
loop :
li $v0, 1 # print_int
move $a0, $t0
syscall
li $v0, 4 # print_string
la $a0, text1
syscall
li $v0, 1 # print_int
move $a0, $t2
syscall
mul $t3, $t0, $t2
li $v0, 4 # print_string
la $a0, text2
syscall
li $v0, 1 # print_int
move $a0, $t3
syscall
li $v0, 4 # print_string
la $a0, newline
syscall
add $t0, 1
ble $t0, $t1, loop
li $v0, 4 # print message
la $a0, finished
syscall
li $v0, 10
syscall # au revoir ...
## data segment
.data
factor : .word 2
numbers : .word 4
text1 : .asciiz " times "
text2 : .asciiz " is "
finished : .asciiz "Finished!\n"
newline : .asciiz "\n"
能看懂的请尽快跟我联系一下!任务酬劳是烤鸭一只!紧急,不是开玩笑的! |
|