summaryrefslogtreecommitdiff
path: root/agbx
diff options
context:
space:
mode:
Diffstat (limited to 'agbx')
-rw-r--r--agbx/GNUmakefile2
-rw-r--r--agbx/include/ax/algo.h14
-rw-r--r--agbx/include/ax/bs.h7
-rw-r--r--agbx/include/ax/gfx.h10
-rw-r--r--agbx/include/ax/key.h2
-rw-r--r--agbx/source/priv/init.s4
6 files changed, 13 insertions, 26 deletions
diff --git a/agbx/GNUmakefile b/agbx/GNUmakefile
index 33db079..211f5a5 100644
--- a/agbx/GNUmakefile
+++ b/agbx/GNUmakefile
@@ -32,7 +32,7 @@ CFLAGS := \
-nostdlib \
-std=c2x
-CXXFLAGS := \
+CXXFLAGS := \
-Iinclude \
-Iinclude-private \
-Ofast \
diff --git a/agbx/include/ax/algo.h b/agbx/include/ax/algo.h
deleted file mode 100644
index 8ea344c..0000000
--- a/agbx/include/ax/algo.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- Copyright 2022 Gabriel Jensen.
- This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
- If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>.
-*/
-
-#if !defined(__ax_hdr_algo)
-#define __ax_hdr_algo
-
-#include <ax/bs.h>
-
-void ax_cp(void const * src,ax_i02 num,void * dest);
-
-#endif
diff --git a/agbx/include/ax/bs.h b/agbx/include/ax/bs.h
index 88c632a..0bcfbd7 100644
--- a/agbx/include/ax/bs.h
+++ b/agbx/include/ax/bs.h
@@ -32,12 +32,7 @@ typedef enum {
ax_err_max = 0xFFu,
} ax_err;
-constexpr ax_i04 ax_ver = 0x8u;
-
-constexpr ax_i8 ax_scrnw3 = 0xF0u;
-constexpr ax_i8 ax_scrnw5 = 0xA0u;
-constexpr ax_i8 ax_scrnh3 = 0xA0u;
-constexpr ax_i8 ax_scrnh5 = 0x80u;
+constexpr ax_i04 ax_ver = 0x9u;
[[noreturn]] void ax_done(ax_err err);
diff --git a/agbx/include/ax/gfx.h b/agbx/include/ax/gfx.h
index d9fa1b7..56405f1 100644
--- a/agbx/include/ax/gfx.h
+++ b/agbx/include/ax/gfx.h
@@ -13,8 +13,14 @@
extern "C" {
#endif
-#define ax_coord3(_x,_y) ((ax_i01)_y * ax_scrnw3 + (ax_i01)_x)
-#define ax_coord5(_x,_y) ((ax_i01)_y * ax_scrnw5 + (ax_i01)_x)
+constexpr ax_i8 ax_scrnw3 = 0xF0u;
+constexpr ax_i8 ax_scrnw5 = 0xA0u;
+constexpr ax_i8 ax_scrnh3 = 0xA0u;
+constexpr ax_i8 ax_scrnh5 = 0x80u;
+
+#define ax_coord(_scrnw,_x,_y) ((ax_i01)((ax_i01)(_y) * (ax_i01)(_scrnw) + (ax_i01)(_x)))
+
+#define ax_col(_r,_g,_b) ((ax_i01)(((ax_i01)(_r) | (ax_i01)(_g) << 0x5u | (ax_i01)(_b) << 0xAu) & 0b000000111111111111111))
ax_i02 ax_flip( void);
ax_i02 ax_getvbnk(void);
diff --git a/agbx/include/ax/key.h b/agbx/include/ax/key.h
index 3cff7d6..88d6250 100644
--- a/agbx/include/ax/key.h
+++ b/agbx/include/ax/key.h
@@ -26,7 +26,7 @@ typedef struct {
ax_i01 _keys;
} ax_keymap;
-#define ax_chkkey(_map,_key) (!(bool)(_map._keys >> (ax_i01)_key & 0x1u))
+#define ax_chkkey(_map,_key) (!(bool)((_map)._keys >> (ax_i01)(_key) & 0x1u))
ax_keymap ax_getkeymap(void);
diff --git a/agbx/source/priv/init.s b/agbx/source/priv/init.s
index 1c32c4e..718638d 100644
--- a/agbx/source/priv/init.s
+++ b/agbx/source/priv/init.s
@@ -8,7 +8,7 @@
.thumb
.extern ax_done
-.extern ax_main
+.extern ax_start
.globl __ax_init
@@ -17,7 +17,7 @@
__ax_init:
@ Call main:
- bl ax_main
+ bl ax_start
@ Call done:
bl ax_done @ The return value is already in r0, so there's no need to move it.