[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] How to do multi-line assembler macros?
From: |
E. Weddington |
Subject: |
Re: [avr-gcc-list] How to do multi-line assembler macros? |
Date: |
Tue, 9 Sep 2003 16:10:56 GMT |
> Hi,
>
> I'm writing some assembler routines where the use of C
#define macros
> would make my life a lot easier. I need to write a macro
of the form:
>
> lds r0, servo_0
> tst r0
> brne servos_reset_0_over_1
> cbi SERVO_0_PORT, SERVO_0_BIT
> rjmp servos_reset_0_over
> servos_reset_0_over_1:
> sbi SERVO_0_PORT, SERVO_0_BIT
>
> There are lots of servos, so I'd like to write a macro
like this:
>
> #define RESET_SERVO(servo) \
> lds r##servo, servo_##servo ;\
> tst r##servo ;\
> brne servos_reset_##servo##_over_1 ;\
> cbi SERVO_##servo##_PORT,
SERVO_##servo##_BIT; \
> rjmp servos_reset_##servo##_over; \
> servos_reset_##servo##_over_1: \
> sbi SERVO_##servo##_PORT,
SERVO_##servo##_BIT; \
> servos_reset_##servo##_over:
>
> To be used like so:
>
> RESET_SERVO(0)
> RESET_SERVO(1)
> ...
>
Dumb question: Any reason why you're doing this all in
assembly instead of C with macros that generate inline
assembly?
Thanks
Eric
- [avr-gcc-list] Handling interrupts in assembler - how?, (continued)
- [avr-gcc-list] Handling interrupts in assembler - how?, Michal Vanka, 2003/09/17
- Re: [avr-gcc-list] Handling interrupts in assembler - how?, Artur Lipowski, 2003/09/17
- Re: [avr-gcc-list] Handling interrupts in assembler - how?, Michal Vanka, 2003/09/17
- Re: [avr-gcc-list] Handling interrupts in assembler - how?, Artur Lipowski, 2003/09/17
- Re: [avr-gcc-list] Handling interrupts in assembler - how?, Michal Vanka, 2003/09/17
- Re: [avr-gcc-list] Handling interrupts in assembler - how?, Artur Lipowski, 2003/09/17
- Re: [avr-gcc-list] Handling interrupts in assembler - how?, Julius Luukko, 2003/09/17
[avr-gcc-list] How to do multi-line assembler macros?, Oleksandr Redchuk, 2003/09/09
Re: [avr-gcc-list] How to do multi-line assembler macros?,
E. Weddington <=
Re: [avr-gcc-list] How to do multi-line assembler macros?, E. Weddington, 2003/09/10
Re: [avr-gcc-list] How to do multi-line assembler macros?, E. Weddington, 2003/09/10