forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

assembly help

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 Development
View previous topic :: View next topic  
Author Message
JorDy



Joined: 11 Dec 2005
Posts: 121

PostPosted: Sun May 07, 2006 9:55 am    Post subject: assembly help Reply with quote

the compiler keeps returning these errors wheni try to compile my functions.s
file with my main c file
functions.s:
Code:

#include "r5900_regs.h"
       
.set noreorder

.text

   .global notarealfnc
   .ent   notarealfnc
notarealfnc:
   lw   v0,   0x00(t0)
   addiu   v0, v0   4
   sw   v0,    _addr
   jr   ra
   nop
   .end notarealfnc

ive defined my function in the c source as "extern void notarealfnc(void);" but the compiler throws out these errors, the only command it likes is a nop:
Code:
   $ make
   ee-as -G0  functions.s -o functions.o
   functions.s: Assembler messages:
   functions.s:0: Warning: end of file not at end of a line; newline inserted
   functions.s:10: Error: illegal operands `lw v0,0x00(t0)'
   functions.s:11: Error: illegal operands `addiu v0,v0 4'
   functions.s:12: Error: illegal operands `sw v0,_addr'
   functions.s:13: Error: illegal operands `jr ra'
   make: *** [functions.o] Error 1


thnx in advance
Back to top
View user's profile Send private message
jbit
Site Admin


Joined: 28 May 2005
Posts: 293
Location: København, Danmark

PostPosted: Sun May 07, 2006 7:50 pm    Post subject: Reply with quote

Unless I'm forgetting something, gas (ee-as) can't use "#include", since it doesn't invoke the CPP (C Preprocessor), ".include" does work though.

You can of course use ee-gcc to compile a .S or .s file though, if you want to use CPP directives. (hint: r5900_regs.h probably requires you do this)

Hope this helps.
Back to top
View user's profile Send private message Visit poster's website
Saotome



Joined: 03 Apr 2004
Posts: 182

PostPosted: Sun May 07, 2006 8:44 pm    Post subject: Reply with quote

...and if that doesn't work (I'm not saying that it shouldn't)
you could try to put a "$" before the register names (i.e. "addiu $t0,$t0,1"), thats how I solved the problem ;)
_________________
infj
Back to top
View user's profile Send private message
JorDy



Joined: 11 Dec 2005
Posts: 121

PostPosted: Sun May 07, 2006 10:13 pm    Post subject: Reply with quote

thanks alot guys the $ did help but my addiu also didnt like me using register names for some reason so i had to use the register numbers
Back to top
View user's profile Send private message
ooPo
Site Admin


Joined: 17 Jan 2004
Posts: 2032
Location: Canada

PostPosted: Mon May 08, 2006 2:54 pm    Post subject: Reply with quote

Quote:
> I tried to #include the .h file in the assembley file and feed it to
> the c preprocessor. The output had the #include file data in it, so
> 'as' choked.

Use gcc to preprocess the assembly, like so:

gcc -c foo.S

Both .S and .s are assembler. By convention, .S is assembly source that
needs to be preprocessed. Otherwise, gcc doesn't care.

http://sourceware.org/ml/crossgcc/1997/msg00002.html

There's also an include file in ps2sdk somewhere that maps the register numbers to register names.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group