This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Query On assembly

Hi,

I am writing an C code and need to write the same code in assembly.

I have two buffers. src and dest. both buffers are charatcer buffers.

i need to load there buffers using assembly  how can i do it

my src buffer has ten elemnts

 void(char *src,char *dst)

{

BYTE a,b;
    int i;

    b=10;

    for(i=0;i<=10;i++)
    {
        a=*src++;

        a=a+b;

        *dst++= b;
    }

}

 

How can this be done.

 

chaps555

 

  • I am not sure exactly what you are asking for, assuming this is for the C64x+ DSP, are you asking for an assembly equivalent of the C function you have there or are you asking how to interface some other assembly code to the C code you have there?

    For the former, one option would be to build the C code and view the resulting disassembly, as long as the optimization is disabled this should give you some idea of the assembly that could be used to implement the C code in assembly.

    For the latter you probably want to look through section 7.5 of SPRU187o, as this goes into details of interfacing between C and assembly statements and gives you all of your options.

  • hi,

    yes i need to know how can i access elements in my memry using assembly.

     

    chaps555

  • chaps555 said:
    yes i need to know how can i access elements in my memry using assembly.

    My assembly is a bit rusty, but you can do something as simple as

     mvkh a0, 0x80000000
     mvkl a0, 0x00001000
     mvkh a1, 0x12345678
     mvkl a1, 0x12345678
     stw *a0, a1
    This should load register a0 with address 0x80001000 and register a1 with a value of 0x12345678. Then the STW instruction will move the value 0x12345678 into address 0x80001000. All of these instructions are covered in the C6000 Assembly Language User Guide.

    *edit* fixed a typo

  • Thanks I was looking for something like this.

    chaps[:D]