[SOLVED] [MIPS] undefined reference $a3

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
ne0h
Posts: 386
Joined: Thu Feb 21, 2008 2:15 am

[SOLVED] [MIPS] undefined reference $a3

Post by ne0h »

I'm getting some errors with this:

Code: Select all

.globl _start
.set noreorder
.ent _start

set_k1:
    li      $k1, 0

loop:
    nop
    j   loop
    nop

check_mem:
    addi    $a3, $a3, 1
    lw      $a2, $a3($a1)
    beq     $a2, $a0, check_mem
    nop

check_saved:
    lw      $a2, $a3($a1)
    beq     $a2, $a0, loop
    nop
    break

_start:
    li      $a0, 0x00000000
    li      $a1, 0x88000000
    li      $a3, -1

    j       check_mem
    nop

    sw      $a0, $a3($a1)
    
    j       check_saved
    nop
    
    

    

.set reorder
.end _start
Sorry, I'm trying to learn mips...
The error log:
main.o: In function `check_mem':
: undefined reference to `$a3'
main.o: In function `check_mem':
: undefined reference to `$a3'
main.o: In function `check_saved':
: undefined reference to `$a3'
main.o: In function `check_saved':
: undefined reference to `$a3'
main.o: In function `_start':
: undefined reference to `$a3'
main.o:: more undefined references to `$a3' follow
make: *** [build_asm] Error 1
Last edited by ne0h on Sun Jan 11, 2009 2:50 am, edited 1 time in total.
hlide
Posts: 739
Joined: Sun Sep 10, 2006 2:31 am

Post by hlide »

no wonder... just have a look on a MIPS assembly instructions manual : there are something wrong in :

Code: Select all

lw      $a2, $a3($a1)

Code: Select all

sw      $a0, $a3($a1)
I'm letting you to guess what is wrong as an exercise.
ne0h
Posts: 386
Joined: Thu Feb 21, 2008 2:15 am

Post by ne0h »

mmm,

Code: Select all

lw      $a2, $a3($a1)
this will load a word on a2 at address (a3 + a1), what's wrong?
hlide
Posts: 739
Joined: Sun Sep 10, 2006 2:31 am

Post by hlide »

such an instruction doesn't exist...
NoEffex
Posts: 106
Joined: Thu Nov 27, 2008 6:48 am

Post by NoEffex »

addu $t9, $a3, $a1
lw $a2, 0x0000($t9)
Last edited by NoEffex on Tue Jan 13, 2009 8:41 am, edited 2 times in total.
Programming with:
Geany + Latest PSPSDK from svn
ne0h
Posts: 386
Joined: Thu Feb 21, 2008 2:15 am

Post by ne0h »

I can't figure out where is my problem!
if is possible I want to know why I cannot do what I've done...
Thanks
ab5000
Posts: 74
Joined: Tue May 06, 2008 2:37 am

Post by ab5000 »

ne0h wrote:mmm,

Code: Select all

lw      $a2, $a3($a1)
this will load a word on a2 at address (a3 + a1), what's wrong?
take a look there: http://www.mrc.uidaho.edu/mrc/people/jf ... IPSir.html
ne0h
Posts: 386
Joined: Thu Feb 21, 2008 2:15 am

Post by ne0h »

Ok, I've understand, thanks
Post Reply