This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

asm c variable to a assembler register

hi i start a new try.
i am looking for a solution that uVision4 accept to put Variables(Parameters) of c-Code in to Asssembler Registers.

A reference to the "C166 User's Guide - Reference ASM" helped my not because this(my) problem isnot treated!

------------------------------------------------------------------------------------


_inline int vf_control( int offset, int slew, int anglespeed)
{
        int retvalue;

#pragma asm     ( @w1=offset, @w2=slew, @w3=anglespeed, @4,@5 )


        mov     MCW,#0600H

        mov     @5,ZEROS

        CoMUL   @w2,@w3

        CoSHL   #8

        CoADD   @5, @w1

        CoSTORE @4,MAS

#pragma endasm (retvalue = @4 )
        return retvalue;
}

Parents
  • A small problem ;-) i hope so...

    CoSTORE [@w4],MAS

    transform to

    CoSTORE [rw4],MAS

    don't work, Keil uVision4 don't know this syntax "rw4" for a word regiester.

    _inline int inv_park_trans(int i_d,int i_q,int phi,int *o_b)
    {
    int retvalue;
    
    # pragma asm(@w1 = i_d,@w2 = i_q,@w3 = phi, @w4 = o_b , @5, @7, @9, @8)
    
            mov     @7,MCW
            mov     MCW,#0600h
        shr     @w3,#6
        shl     @w3,#1
        EXTS    #SEG (_sincostab),#2
        mov     @9,[@w3 + #SOF(_sincostab+512)]
        mov     @8,[@w3 + #SOF(_sincostab)]
        CoMUL   @w1,@9
        CoMAC-  @w2,@8
            CoASHR  #2
        CoSTORE @5,MAS
        CoMUL   @w1,@8
        CoMAC   @w2,@9
            CoASHR  #2
        CoSTORE     [@w4],MAS
            mov     MCW,@7
    
    #pragma endasm(retvalue = @5 )
    
    return retvalue;
    
    }
    

Reply
  • A small problem ;-) i hope so...

    CoSTORE [@w4],MAS

    transform to

    CoSTORE [rw4],MAS

    don't work, Keil uVision4 don't know this syntax "rw4" for a word regiester.

    _inline int inv_park_trans(int i_d,int i_q,int phi,int *o_b)
    {
    int retvalue;
    
    # pragma asm(@w1 = i_d,@w2 = i_q,@w3 = phi, @w4 = o_b , @5, @7, @9, @8)
    
            mov     @7,MCW
            mov     MCW,#0600h
        shr     @w3,#6
        shl     @w3,#1
        EXTS    #SEG (_sincostab),#2
        mov     @9,[@w3 + #SOF(_sincostab+512)]
        mov     @8,[@w3 + #SOF(_sincostab)]
        CoMUL   @w1,@9
        CoMAC-  @w2,@8
            CoASHR  #2
        CoSTORE @5,MAS
        CoMUL   @w1,@8
        CoMAC   @w2,@9
            CoASHR  #2
        CoSTORE     [@w4],MAS
            mov     MCW,@7
    
    #pragma endasm(retvalue = @5 )
    
    return retvalue;
    
    }
    

Children