Ich schreibe ein Programm mit MIPS MARS-Assembly, das verschiedene mathematische Berechnungen durchführt, und ich habe Probleme zu verstehen, warum meine String-Werte im .data-Abschnitt als Block am Anfang des Programms statt einzelner Zeilen ausgedruckt werden. Ich habe auch Probleme damit, die Werte neben der korrekten Aussage auszudrucken.Warum werden in MIPS MARS meine verschiedenen Zeilen in einem Block anstatt in einzelnen Zeilen ausgedruckt?
.data
NL: .asciiz "\n" #NL=new line varible kinda name
addition: .ascii "The value of a + b = \n"
subtraction: .ascii "The value of a - b = \n "
prob_3: .ascii "The value of (a + b) - 8 = \n"
prob_4: .ascii "The value of (a + b) - (c + d) = \n"
prob_5: .ascii "The value of ((a + b) + (d - c) + 17 = \n"
.text
li $s0, 8
li $s1, 8
li $s2, 16
li $s3, 8
la $a0, addition
li $v0, 4
syscall
add $t1, $s0, $s1
li $v0, 1
add $a0, $t1, $zero
syscall
la $a0, NL
li $v0, 4
syscall
la $a0, subtraction
li $v0, 4
syscall
sub $t2, $s0, $s1
li $v0, 1
sub $a0, $t2, $zero
syscall
la $a0, NL
li $v0, 4
syscall
la $a0, prob_3
li $v0, 4
syscall
subi $t3, $t1, 8
li $v0, 1
sub $a0, $t3, $zero
syscall
la $a0, NL
li $v0, 4
syscall
la $a0, prob_4
li $v0, 4
syscall
add $t4, $s2, $s3
sub $t5, $t1, $t4
li $v0, 1
sub $a0, $t5, $zero
syscall
la $a0, NL
li $v0, 4
syscall
la $a0, prob_5
li $v0, 4
syscall
sub $t6, $s3, $s2
add $t7, $t1, $t6
addi $t8, $t7, 17
li $v0, 1
add $a0, $t8, $zero
syscall
Die Ergebnisse Ich erhalte:
The value of a + b =
The value of a - b =
The value of (a + b) - 8 =
The value of (a + b) - (c + d) =
The value of ((a + b) + (d - c) + 17 =
16
The value of a - b =
The value of (a + b) - 8 =
The value of (a + b) - (c + d) =
The value of ((a + b) + (d - c) + 17 =
0
The value of (a + b) - 8 =
The value of (a + b) - (c + d) =
The value of ((a + b) + (d - c) + 17 =
8
The value of (a + b) - (c + d) =
The value of ((a + b) + (d - c) + 17 =
-8
The value of ((a + b) + (d - c) + 17 =
25
und die Ergebnisse i zu erhalten bin versucht:
The value of a + b = 16
The value of a - b = 0
The value of (a + b) - 8 = 8
The value of (a + b) - (c + d) = -8
The value of ((a + b) + (d - c) + 17 = 25
Kann mir jemand helfen, dies herauszufinden?
Vielen Dank, dass alot geholfen! –