You are reading a single comment by @JumJum and its replies. Click here to read the full conversation.
  • During my learningphase I created an ASM call which only returns one out of a row of parameters. Parameter are stored in reg and in stack.
    This is compiled with an external compiler (FASM), it will not run directly with the one in WebIDE.
    I still would like to work with Uint-arrays directly. I'm pretty sure this kind of data is stored in memory directly, at least this is what I would like to have :-) get.
    Would it be an option to have a function, something like adressOfData() which returns startadress in memory for Uint-Arrays ?

    thumb;
            cmp r0,#0       ;1st parameter is pointer to following args
            beq return      ;pointer to first arg which is in r0
            cmp r0,#1
            bgt isgt1
            mov r0,r1       ;2nd arg is in r1
            b return
    isgt1:  cmp r0,#2
            bgt isgt2
            mov r0,r2       ;3rd in r2
            b return
    isgt2:  cmp r0,#3
            bgt isgt3
            mov r0,r3       ;4th in r3
            b return
    isgt3:  sub r0,#4       ;since 5th arg is somewhere else
            lsl r0,r0,#2    ;data uses 4 bytes, so left shift by 2 is like multiplication by 4
            ldr r0,[sp,r0]  ;load from stack
    return: bx lr           ;return value is in r0 
    
About

Avatar for JumJum @JumJum started