I m trying to learn MIPS Assembly by learning MIPS Assembly Language Programming. In the book I have this code(extracted from the page 37 of the book):
.data
prompt: .asciiz "
Please Input a Value: "
bye: .asciiz "
Bye!"
.globl main
.text
main:
li $v0, 4
la $a0, prompt
syscall
li $v0, 5
syscall
beqz $v0, end
move $a0, $v0
li $v0, 1
syscall
b main
end:
li $v0, 4
la $a0, bye
syscall
li $v0, 10
syscall
I have a cross-compiled binutils targeted to mips-elf
, but when I ve tried to Assemble the code, I got some errors
ubuntu@eeepc:~/Desktop$ mips-elf-as test-mips.asm
test-mips.asm: Assembler messages:
test-mips.asm:8: Error: illegal operands li
test-mips.asm:9: Error: illegal operands la
test-mips.asm:12: Error: illegal operands li
test-mips.asm:14: Error: illegal operands beqz
test-mips.asm:15: Error: illegal operands move
test-mips.asm:16: Error: illegal operands li
test-mips.asm:22: Error: illegal operands li
test-mips.asm:23: Error: illegal operands la
test-mips.asm:26: Error: illegal operands li
ubuntu@eeepc:~/Desktop$
I m using x86 Ubuntu Hardy Herron to cross-compile to MIPS
What is wrong?