Конкатенация строк и чисел с плавающей точкой в ​​сборке MIPS (MARS) - PullRequest
0 голосов
/ 05 июля 2018

Я только что нашел решение для объединения строк в сборке MIPS (на MARS), о котором я сообщаю код здесь:

# String concatenate
.text

# Copy first string to result buffer
la $a0, str1
la $a1, result
jal strcopier
nop

# Concatenate second string on result buffer
la $a0, str2
or $a1, $v0, $zero
jal strcopier
nop
j finish
nop

# String copier function
strcopier:
or $t0, $a0, $zero # Source
or $t1, $a1, $zero # Destination

loop:
lb $t2, 0($t0)
beq $t2, $zero, end
addiu $t0, $t0, 1
sb $t2, 0($t1)
addiu $t1, $t1, 1
b loop
nop

end:
or $v0, $t1, $zero # Return last position on result buffer
jr $ra
nop

finish:
j finish
nop

.data
str1:
.asciiz "Hello "
str2:
.asciiz "world"
result:
.space 200

Но мой вопрос: как насчет конкатенации числа с плавающей запятой между двумя строками?

Спасибо заранее.

...