summaryrefslogtreecommitdiff
path: root/agbx/include-private
diff options
context:
space:
mode:
Diffstat (limited to 'agbx/include-private')
-rw-r--r--agbx/include-private/agbx/priv.h33
1 files changed, 9 insertions, 24 deletions
diff --git a/agbx/include-private/agbx/priv.h b/agbx/include-private/agbx/priv.h
index 3f55813..1534ff3 100644
--- a/agbx/include-private/agbx/priv.h
+++ b/agbx/include-private/agbx/priv.h
@@ -9,32 +9,17 @@
#include <agbx/bs.h>
-#define __agbx_set10(_addr,_val) { \
- __asm__ ( \
- "strh %1,[%0]" \
- : \
- : "r" (_addr),"r" (_val) \
- : "memory" \
- ); \
-}
+#define __agbx_get10(_addr) (*(agbx_i10 volatile *)_addr)
-#define __agbx_set20(_addr,_val) { \
- __asm__ ( \
- "str %1,[%0]" \
- : \
- : "r" (_addr),"r" (_val) \
- : "memory" \
- ); \
-}
+#define __agbx_get20(_addr) (*(agbx_i20 volatile *)_addr)
-#define __agbx_set8(_addr,_val) { \
- __asm__ ( \
- "strb %1,[%0]" \
- : \
- : "r" (_addr),"r" (_val) \
- : "memory" \
- ); \
-}
+#define __agbx_get8(_addr) (*(agbx_i8 volatile *)_addr)
+
+#define __agbx_set10(_addr,_val) ((void)(*(agbx_i10 volatile *)_addr = _val))
+
+#define __agbx_set20(_addr,_val) ((void)(*(agbx_i20 volatile *)_addr = _val))
+
+#define __agbx_set8(_addr,_val) ((void)(*(agbx_i8 volatile *)_addr = _val))
#define __agbx_setpx2(_vaddr,_px,_col) { \
agbx_i20 const addr = _vaddr + _px * 0x2u; /* We multiply it by two as each pixel takes up two bytes. */ \