[sdiy] Organisation of tasks in synth's main uP
Noah Vawter
nvawter at media.mit.edu
Tue Nov 23 17:50:42 CET 2010
pro-question time: in assembly, I rely heavily on the overflow bit
being set to detect wrap-around, e.g. in 8-bit registers. But these
days I program mainly in C and I can't figure out how to access that
overflow bit.
I have gone so far as to use 7-bit numbers and treat the MSB as an
overflow, but does anyone know how to read the CPU's overflow bit from
C?
thank you,
-N
On Nov 23, 2010, at 8:54 AM, Olivier Gillet wrote:
>> Most compilers aimed at embedded systems, including GCC, usually have
>> some way to place native assembler instructions in your C code
>> ("inline assembler") and have the compiler sort out all the other
>> stuff (function prologue and epilogue, etc) for you. However I
>> don't
>> generally recommend it for large functions (it tends to block any
>> optimisations in that function, same with longjmp/setjmp) so best to
>> hide it away in utility functions.
>
> Same experience here... I found that avr-gcc did the "right" register
> allocation in code surrounding inlined assembly only when the assembly
> code was kept small and didn't touch too many variables. So it seems
> better (and also good from a readability and code reuse point of view)
> to keep in C the "glue" between small inlined assembly functions.
> _______________________________________________
> Synth-diy mailing list
> Synth-diy at dropmix.xs4all.nl
> http://dropmix.xs4all.nl/mailman/listinfo/synth-diy
>
More information about the Synth-diy
mailing list