Мне нужно создать калькулятор, который принимает данные от пользователя. Первое число с плавающей запятой будет взято в степень второго числа с плавающей запятой.
У меня есть две программы, одна из которых рассчитывает показатели целых чисел, а другая может умножать числа с плавающей запятой. Я попытался по сути смешать их вместе.
.data
welcome: .asciiz "Floating Point Exponential Calculator\n\n"
prompt1: .asciiz "Enter the first floating point number: "
prompt2: .asciiz "\nEnter the second floating point number: "
result: .asciiz "\nThe result is: "
newline: .asciiz "\n\n"
float1: .float 0.0
float2: .float 0.0
.text
.globl main
main:
li $v0, 4 #calls print_string code 4
la $a0, welcome #pointer to string
syscall
li $v0, 4 #calls print_string code 4
la $a0, prompt1 #pointer to string
syscall
#get first amount from user
li $v0, 6 #call read_float code 6
syscall
s.s $f0, float1 #store the input
li $v0, 4 #calls print_string code 4
la $a0, prompt2 #pointer to string
syscall
#get second amount from user
li $v0, 6 #call read_float code 6
syscall
s.s $f0, float2 #store the input
la $a0, float1 #loads address of float1
l.s $f0, 0($a0) #a0 --> float1
la $a1, float2 #loads address of float2
l.s $f1, 0($a1) #a1 --> float2
#prints resulting amount
li $v0, 4 #calls print_string code 4
la $a0, result #pointer to string
syscall
jal exponential
li $v0, 2 #calls print_float code 2
l.s $f12, float1 #print multiplied float
syscall
#continual loop
li $v0, 4 #calls print_string code 4
la $a0, newline #pointer to string
syscall
j main
exponential:
addi $sp, $sp, -4
s.s $t0, 4($sp)
move $t0, $zero
li $v0, 1
loop:
c.eq.s $t0, float2
bc1t end
mul.s $v0, $v0, float1
addi $t0, $t0, 1
j loop
end:
# Restore $t0 and the stack
l.s $t0, 4($sp)
addi $sp, $sp, 4
jr $ra
Я получаю:
синтаксическая ошибка в строке 68 c.eq.s $ t0, float2
Буду признателен за любую помощь в правильной работе этой вещи, заранее спасибо!