Path: chuka.playstation.co.uk!news From: Andrew Partington Newsgroups: scee.yaroze.freetalk.english Subject: problems using MIPS asm with CW Date: Thu, 26 Jul 2001 12:50:26 +0100 Organization: PlayStation Net Yaroze (SCEE) Lines: 46 Message-ID: <3B600402.E34444AC@harbinger.com> NNTP-Posting-Host: manuk88.harbinger.co.uk Mime-Version: 1.0 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.7 [en] (WinNT; I) X-Accept-Language: en Hi all

I disassembled part of my project to find out how to call GsSortSprite using assembler, so I can try and speed up my map drawing routine.  Part of the code that was generated looked something like this in the disassembly listing:

lw        a2,activeBuffer(gp)                     - gets activebuffer from 64k GP segment which points at globals

...
lui         a1,hi(WorldOT)                        - Gets upper 16 bits of a 32-bit address, lower 16 bits are cleared
addiu    a1,lo(WorldOT)                        - put in the lower 16 bits of the address
...
...

However, if you have the exact same code in the compiler, e.g.

asm void myAsmRoutine()
{
    lw a2,activeBuffer(gp)
    ....
    lui         a1,hi(WorldOT)
    addiu    a1,lo(WorldOT)
    ...
    ...
}

The compiler complains about an illegal addressing mode for loading a2 from activeBuffer(gp), and also doesn't like the lo/hi keywords in the lui/addiu expressions (in this case I don't think it refers to the HI/LO registers on the multiply/divide unit, I think its refering to the upper and lower 16 bits of the address), removing them also gives an illegal addressing mode error (I think - i'm not sat in front of CW at the moment).  Which is strange, because that's exactly what the disassembler gave me!  Is there anything other than lui I can use to grab the address of a structure?  I remember browsing some MIPS tutorial on the web (might have been R2000 though) and there is an la instruction (which CW does recognise and compile) - could this load a full 32-bit address without having to add/or the lower 16 bits like with lui?

I know there are two updates to CW - a 14Mb one and a 3.5Mb one, but I have never installed the 14Mb update, does anyone know what that fixes?  I think the smaller one fixes some problems in the debugger, but i'm not sure??

Cheers

Andy