Re: Hi everybody. Programming in assembler

David Brown <[email protected]>
Newsgroups gmane.comp.hardware.texas-instruments.msp430.gcc.user
Message-ID <[email protected]>
On 01/04/13 02:32, [email protected] wrote:
> David
>
> I am a beginer with assembler. After writing programme in C to
> msp430, i want to start writing in assembler.
>
> Why assembler ? To learn, to test.

Fair enough.  While it is almost always "better" to program in C (more 
portable, faster to develop, more reliable, and often smaller and faster 
code in the end), it is great to be able to program in assembly - it is 
the best way to really get to know the processor you are using, and you 
can write better C code when you understand how the generated assembly 
will work.

A key tool here is to get the compiler to generate assembly listing 
files from your C code (using flags such as "-Wa,-adchls" when 
compiling) so that you can see the assembly generated by the compiler.

>
> In assembler, you have "bis", "bic" you don't have in C.

Yes, you can do that in C - statements such as "PORTD |= 0x04" or "PORTD 
&= ~0x0800" will generate "bis" and "bic" instructions.  (A weird thing 
about msp430 programming is that you can have more than one name for the 
same instruction - a "bis" is just an "or", for example.)  There are not 
actually many cases where you can write noticeably smaller or faster 
real-world code in assembly than in C - the compiler is quite good at 
getting the best out of the chip.

mvh.,

David


>
> Thanks to everybody who answer me.
>
>
> --- your message ------ On 30/03/13 21:37, [email protected]
> wrote:
>> Hi everybody.
>>
>> I have an lanchpad and i use mspgcc to program it in C. Today, i
>> want to program in assembler. Not inlinig but writing programs in
>> assembler using the C-processor include files.
>>
>> First, i read mspgcc's  web site .
>>
>> http://mspgcc.sourceforge.net/manual/x1522.html don't work on my
>> computer.
>>
>> Second, i ask google. But i don't find this information.
>>
>> So , can i program msp430 in assembler with mspgcc ? How to ?
>>
>> Do you have a pointer to an "howto" or "step by step" ?
>>
>> Sorry if i miss something.
>>
>> Thanks in advance.
>>
>> php5all
>>
>
> It might be helpful if you explain what you are trying to do - that
> way you can get better answers.  Typical reasons include "I want to
> learn more", "I want my code to go faster", and "I want to do
> something that can't be done in C".  In each case, the best course of
> action could be different.
>
> mvh.,
>
> David
>
>
> ------------------------------------------------------------------------------
>
>
Own the Future-Intel&reg; Level Up Game Demo Contest 2013
> Rise to greatness in Intel's independent game demo contest. Compete
> for recognition, cash, and the chance to get your game on Steam. $5K
> grand prize plus 10 genre and skill prizes. Submit your demo by
> 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
>


------------------------------------------------------------------------------
Own the Future-Intel&reg; Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game 
on Steam. $5K grand prize plus 10 genre and skill prizes. 
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.