Reworking of the assembly
[uccvend-snackrom.git] / ROM2 / asm.h
1 #ifndef _ASM_H_
2 #define _ASM_H_
3
4 #include "types.h"
5
6 /* The "g" below really should be an "i", but gcc doesn't believe that it will
7  * always be an immediate value. Using "g" makes the compiler be quiet, but 
8  * the assembler will fail if the value is not an immediate.
9  */
10 extern inline void bset(void* addr, u8 mask) {
11         asm volatile (
12                 "ldx %0\n"
13                 "bset 00,x,%1"
14                 :                          /* outputs */
15                 : "p" (addr), "g" (mask)   /* inputs */
16                 : "x"                      /* altered registers */
17                 );
18 }
19
20 extern inline void bclr(void* addr, u8 mask) {
21         asm volatile (
22                 "ldx %0\n"
23                 "bclr 00,x,%1"
24                 :                          /* outputs */
25                 : "p" (addr), "g" (mask)   /* inputs */
26                 : "x"                      /* altered registers */
27                 );
28 }
29
30 #endif /* _ASM_H_ */

UCC git Repository :: git.ucc.asn.au