set data in array in a native method

"Koen Swinters" <[email protected]> Thu, 20 May 2004 15:13:21 +0200
Newsgroups gmane.comp.hardware.microcontrollers.tini
Message-ID <001101c43e6c$39744dd0$0302a8c0@mobiel>
Hello,

Im trying to fill a Byte array in a native method with some data. But for
some reason the array stays empty when I check the array in java.
I've written some test code to see if I can change the data in a byte Array
in a native function(see code below).
Does some-one know what I'm doing wrong or how can I change the data in a
Array with a native methode and than give it back to my java program.

native code:

Native_Test:
        lcall NatLib_LoadJavaByteArray
        jz     NM3_PointerIsValid
        mov     R0,#0 ; return empty arry
        sjmp     NM3_Exit ;
NM3_PointerIsValid:
        mov     a, R0 ; check the array length
        orl     a, R1 ;
        orl     a, R2 ;
        orl     a, R3 ;
        jz     NM3_Exit
        mov     a,#'K'
        putx
        inc     dptr
        mov     a,#'L'
        putx
        inc     dptr
        mov     a,#'G'
        putx
        inc     dptr
        NM3_Exit:
        clr     a
        ret

java code:

irData = new byte[4];
Test(irData);
for (int i=0; i<4;i++)
{
    System.out.print(" " + irData[i]);
}

regards

Koen


_______________________________________________
TINI mailing list
TINI-6tN4nzCoH/[email protected]
To UNSUBSCRIBE, edit your profile, or see list archives:
http://lists.dalsemi.com/mailman/listinfo/tini