Splitting out headers
[uccvend-snackrom.git] / ROM2 / asm.h
diff --git a/ROM2/asm.h b/ROM2/asm.h
new file mode 100644 (file)
index 0000000..0c9b7fa
--- /dev/null
@@ -0,0 +1,27 @@
+#ifndef _ASM_H_
+#define _ASM_H_
+
+#include "types.h"
+
+/* these would be inline functions, but gcc won't believe that mask is a constant
+ * when passed as a parameter
+ */
+#define bset(addr, mask) \
+       asm volatile (       \
+               "ldx %0\n"       \
+               "bset 00,x,%1"   \
+               :                          /* outputs */ \
+               : "p" (addr), "i" (mask)   /* inputs */  \
+               : "x"                      /* altered registers */ \
+               );
+
+#define bclr(addr, mask) \
+       asm volatile (       \
+               "ldx %0\n"       \
+               "bclr 00,x,%1"   \
+               :                          /* outputs */ \
+               : "p" (addr), "i" (mask)   /* inputs */  \
+               : "x"                      /* altered registers */ \
+               );
+
+#endif /* _ASM_H_ */

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