Code error - why?
I wrote a SAMPLE CODE - Hello.S to work for a cross-assembler mips-linux-as - but this is giving me an error message:
".data
quest: .asciiz "Hello World!"
.text
_start:
la $a0, quest
li $v0, 4
syscall "
The error messages are:
" Hello.S line 5: illegal operands 'la'
Hello.S line 6: illegal operands 'li'"
Can anyone help? What is wrong?
Signature · 6 lines
__________________________________________________________ Sign-up for your own FREE Personalized E-mail at Mail.com http://www.mail.com/?sr=signup Save up to $160 by signing up for NetZero Platinum Internet service. http://www.netzero.net/?refcd=N2P0602NEP8
Drop the $ on the registers?
Regards,
Brad
----- Original Message -----
From: "Balakrishnan Ananthanarayanan" <[email protected]>
To: <[email protected]>; <[email protected]>; <[email protected]>
Sent: Monday, June 17, 2002 5:48 AM
Subject: Code error - why?
Quoted 1 line
I wrote a SAMPLE CODE -
Hello.Sto work for a cross-assembler
mips-linux-as - but this is giving me an error message:
Quoted 13 lines
".data quest: .asciiz "Hello World!" .text _start: la $a0, quest li $v0, 4 syscall "The error messages are:
"Hello.Sline 5: illegal operands 'la'
Hello.Sline 6: illegal operands 'li'"Can anyone help? What is wrong?
After preprocessing, the assembler needs to see $<number> as register specifiers, so typically your choices are to do either:
#define a0 $4 // See include/asm-mips/regdef.h for these #define v0 $2
...
la a0, quest li v0, 4
Or to just use the register numbers, e.g.
la $4, quest li $2, 4
-Justin
Quoted 23 lines
----- Original Message -----
From: "Balakrishnan Ananthanarayanan" <[email protected]>
To: <[email protected]>; <[email protected]>; <[email protected]>
Sent: Monday, June 17, 2002 5:48 AM
Subject: Code error - why?Quoted 1 line
I wrote a SAMPLE CODE -
Hello.Sto work for a cross-assemblermips-linux-as - but this is giving me an error message:
Quoted 13 lines
".data quest: .asciiz "Hello World!" .text _start: la $a0, quest li $v0, 4 syscall "The error messages are:
"Hello.Sline 5: illegal operands 'la'
Hello.Sline 6: illegal operands 'li'"Can anyone help? What is wrong?
Quoted 10 lines · Justin Carlson
After preprocessing, the assembler needs to see $<number> as register specifiers, so typically your choices are to do either:
#define a0 $4 // See
include/asm-mips/regdef.hfor these #define v0 $2...
la a0, quest li v0, 4
Well, the usual choice is to put "#include <asm/regdef.h>" instead of
copying definitions.
Signature · 3 lines
+ Maciej W. Rozycki, Technical University of Gdansk, Poland + +--------------------------------------------------------------+ + e-mail: [email protected], PGP key available +
Quoted 10 lines · Balakrishnan Ananthanarayanan
I wrote a SAMPLE CODE -
Hello.Sto work for a cross-assembler mips-linux-as - but this is giving me an error message:".data quest: .asciiz "Hello World!" .text _start: la $a0, quest li $v0, 4 syscall "
Quoted 6 lines
The error messages are:
"Hello.Sline 5: illegal operands 'la'
Hello.Sline 6: illegal operands 'li'"Can anyone help? What is wrong?
$a0 and $v0 are what's probably giving you grief. Are you relying on the assembler to know these symbols or are you including a file that defines them.
Just to be sure, try replacing $a0 with $4 and $v0 with $2 and see if the code builds.
Signature · 4 lines
------------------------------------------------- Justin Wojdacki [email protected] (408) 350-5032 Communications Processors Group -- Analog Devices
Balakrishnan Ananthanarayanan wrote:
[snip]
Quoted 9 lines
la $a0, quest
li $v0, 4
syscall "The error messages are:
"Hello.Sline 5: illegal operands 'la'
Hello.Sline 6: illegal operands 'li'"Can anyone help? What is wrong?
The register names are wrong. The software names, if defined in some assembler header, are 'a0' and 'v0', while the assembler recognized hardware names are '$4' and '$2'.
Thiemo