[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Global variables and ISRs ???
From: |
Joerg Wunsch |
Subject: |
Re: [avr-gcc-list] Global variables and ISRs ??? |
Date: |
Wed, 7 Sep 2005 11:54:59 +0200 (MET DST) |
Vincent Trouilliez <address@hidden> wrote:
> Oh, that's interesting... because as soon as I compile my small
> programs, I rush to check to have a look at the assembler output,
> ...
At the assembler output (filename.s), or at the disassembler output
(filename.lss)? I guess it's the latter.
> - at start-up, to initialize variables to zero... it won't write
> zero into them (immediate constant I mean), instead it will always
> copy R1 into the variable. Apparently R1 is kept cleared at all
> times and is used whenever a variable needs to be cleared.
That's epxlained in the (avr-libc-)FAQ, under register usage.
If you look at the assembler output rather than the disassembly
listing, you'd notice that r1 is internally called __zero_reg__.
> - everytime I want to increment a variable, instead of just using
> the "INC" or "DEC" instructions, it prefers to substract the
> complement... just as fast (one cycle), but boy not exactly as
> "readable"/clear as "INC" or "DEC", insn't it ?! :-/
Compiler output is not supposed to be human readable. ;-)
For the domain where these instructions are valid (r16 through r31),
they are more flexible than a simple INC or DEC, as e.g. a 2-step
increment could be handled as well. I guess that's why the compiler
has been taught to prefer these.
> - everytime I test if a variable is zero or not, it AND's it with
> itself... instead of just using the dedicated 'TST' instruction.
That's a disassembler issue, again. Look at the opcodes of both
instructions, TST d is nothing else but AND d,d.
--
J"org Wunsch Unix support engineer
address@hidden http://www.interface-systems.de/~j/
- Re: [avr-gcc-list] Global variables and ISRs ???, (continued)
- Re: [avr-gcc-list] Global variables and ISRs ???, David Brown, 2005/09/07
- Re: [avr-gcc-list] Global variables and ISRs ???, Joerg Wunsch, 2005/09/07
- Re: [avr-gcc-list] Global variables and ISRs ???, Vincent Trouilliez, 2005/09/07
- Re: [avr-gcc-list] Global variables and ISRs ???, Joerg Wunsch, 2005/09/07
- Re: [avr-gcc-list] Global variables and ISRs ???, Vincent Trouilliez, 2005/09/07
- Re: [avr-gcc-list] Global variables and ISRs ???, David Brown, 2005/09/08
- Re: [avr-gcc-list] Global variables and ISRs ???, David Brown, 2005/09/08
- Re: [avr-gcc-list] Global variables and ISRs ???, E. Weddington, 2005/09/08
- Re: [avr-gcc-list] Global variables and ISRs ???, Galen Seitz, 2005/09/07
- Re: [avr-gcc-list] Global variables and ISRs ???, ericw, 2005/09/07
- Re: [avr-gcc-list] Global variables and ISRs ???,
Joerg Wunsch <=
- Re: [avr-gcc-list] Global variables and ISRs ???, Vincent Trouilliez, 2005/09/07
- Re: [avr-gcc-list] Global variables and ISRs ???, Joerg Wunsch, 2005/09/07
- Re: [avr-gcc-list] Global variables and ISRs ???, Vincent Trouilliez, 2005/09/07
- Re: [avr-gcc-list] Global variables and ISRs ???, David Brown, 2005/09/07
- Re: [avr-gcc-list] Global variables and ISRs ???, Vincent Trouilliez, 2005/09/07
Re: [avr-gcc-list] Global variables and ISRs ???, Vincent Trouilliez, 2005/09/07