summaryrefslogtreecommitdiff
path: root/agbx/include
diff options
context:
space:
mode:
Diffstat (limited to 'agbx/include')
-rw-r--r--agbx/include/agbx/bs.h42
-rw-r--r--agbx/include/agbx/gfx.h53
-rw-r--r--agbx/include/agbx/key.h33
-rw-r--r--agbx/include/ax/algo.h (renamed from agbx/include/agbx/algo.h)8
-rw-r--r--agbx/include/ax/bs.h42
-rw-r--r--agbx/include/ax/gfx.h38
-rw-r--r--agbx/include/ax/key.h33
7 files changed, 117 insertions, 132 deletions
diff --git a/agbx/include/agbx/bs.h b/agbx/include/agbx/bs.h
deleted file mode 100644
index 7d38d73..0000000
--- a/agbx/include/agbx/bs.h
+++ /dev/null
@@ -1,42 +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(__agbx_hdr_bs)
-#define __agbx_hdr_bs
-
-/* C23 compatibility: */
-#define constexpr static const
-#define typeof __typeof__
-
-typedef unsigned short agbx_i10;
-typedef unsigned int agbx_i20;
-typedef unsigned long long agbx_i40;
-typedef unsigned char agbx_i8;
-
-typedef enum {
- agbx_err_ok = 0x0u,
- agbx_err_badaddr,
- agbx_err_badalgn,
- agbx_err_badcol,
- agbx_err_badmd,
- agbx_err_pos2big,
- agbx_err_px2big,
- agbx_err_max = 0xFFu,
-} agbx_err;
-
-constexpr agbx_i40 agbx_ver = 0x4u;
-
-[[noreturn]] void agbx_done(agbx_err err);
-
-[[nodiscard]] agbx_i10 agbx_get10(agbx_i20 addr);
-[[nodiscard]] agbx_i20 agbx_get20(agbx_i20 addr);
-[[nodiscard]] agbx_i8 agbx_get8( agbx_i20 addr);
-
-void agbx_set10(agbx_i20 addr,agbx_i10 val);
-void agbx_set20(agbx_i20 addr,agbx_i20 val);
-void agbx_set8( agbx_i20 addr,agbx_i8 val);
-
-#endif
diff --git a/agbx/include/agbx/gfx.h b/agbx/include/agbx/gfx.h
deleted file mode 100644
index 07e74e6..0000000
--- a/agbx/include/agbx/gfx.h
+++ /dev/null
@@ -1,53 +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(__agbx_hdr_gfx)
-#define __agbx_hdr_gfx
-
-#include <agbx/bs.h>
-
-agbx_i20 agbx_flip( void);
-agbx_i20 agbx_getvbnk(void);
-void agbx_vsync( void);
-
-void agbx_setpx1(agbx_i20 vaddr,agbx_i10 px,agbx_i8 col);
-void agbx_setpx2(agbx_i20 vaddr,agbx_i10 px,agbx_i10 col);
-
-agbx_i8 agbx_getpx1(agbx_i20 vaddr,agbx_i10 px);
-agbx_i10 agbx_getpx2(agbx_i20 vaddr,agbx_i10 px);
-
-void agbx_clrscrn3(agbx_i10 col);
-void agbx_clrscrn4(agbx_i20 vaddr,agbx_i8 col);
-void agbx_clrscrn5(agbx_i20 vaddr,agbx_i10 col);
-
-void agbx_plot3(agbx_i8 x, agbx_i8 y,agbx_i10 col);
-void agbx_plot4(agbx_i20 vaddr,agbx_i8 x,agbx_i8 y, agbx_i8 col);
-void agbx_plot5(agbx_i20 vaddr,agbx_i8 x,agbx_i8 y, agbx_i10 col);
-
-agbx_i10 agbx_rd3(agbx_i8 x, agbx_i8 y);
-agbx_i8 agbx_rd4(agbx_i20 vaddr,agbx_i8 x,agbx_i8 y);
-agbx_i10 agbx_rd5(agbx_i20 vaddr,agbx_i8 x,agbx_i8 y);
-
-void agbx_cir3(agbx_i8 x, agbx_i8 y,agbx_i8 r);
-void agbx_cir4(agbx_i20 vaddr,agbx_i8 x,agbx_i8 y,agbx_i8 r);
-void agbx_cir5(agbx_i20 vaddr,agbx_i8 x,agbx_i8 y,agbx_i8 r);
-
-#if false
-void agbx_setpx1(agbx_i20 const _vaddr,agbx_i10 const _px,agbx_i8 const _col) {
- /* We can only write halfwords to VRAM, so we need to load the adjacent pixel value and combine it into a halfword. */
- agbx_i20 const addr = _vaddr + _px - (_px & 0x1u) * 0x1u;
- agbx_i10 col;
- if (_px & 0x1u) {col = (agbx_i10)agbx_get8(addr) | (agbx_i10)_col << 0x8u;}
- else {col = (agbx_i10)agbx_get8(addr + 0x1u) << 0x8u | (agbx_i10)_col;}
- __agbx_set10(addr,col);
-}
-
-void agbx_setpx2(agbx_i20 const _vaddr,agbx_i10 const _px,agbx_i10 const _col) {
- __agbx_setpx2(_vaddr,_px,_col)
-}
-#endif
-
-#endif
diff --git a/agbx/include/agbx/key.h b/agbx/include/agbx/key.h
deleted file mode 100644
index 973dd90..0000000
--- a/agbx/include/agbx/key.h
+++ /dev/null
@@ -1,33 +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(__agbx_hdr_key)
-#define __agbx_hdr_key
-
-#include <agbx/bs.h>
-
-typedef enum {
- agbx_key_a = 0x0u,
- agbx_key_b = 0x1u,
- agbx_key_l = 0x9u,
- agbx_key_pade = 0x4u,
- agbx_key_padn = 0x6u,
- agbx_key_pads = 0x7u,
- agbx_key_padw = 0x5u,
- agbx_key_r = 0x8u,
- agbx_key_sel = 0x2u,
- agbx_key_start = 0x3u,
-} agbx_key;
-
-typedef struct {
- agbx_i10 _keys;
-} agbx_keymap;
-
-#define agbx_chkkey(_map,_key) (!(bool)(_map._keys >> (agbx_i10)_key & 0x1u))
-
-agbx_keymap agbx_getkeymap(void);
-
-#endif
diff --git a/agbx/include/agbx/algo.h b/agbx/include/ax/algo.h
index c117e97..e7c7549 100644
--- a/agbx/include/agbx/algo.h
+++ b/agbx/include/ax/algo.h
@@ -4,11 +4,11 @@
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(__agbx_hdr_algo)
-#define __agbx_hdr_algo
+#if !defined(__ax_hdr_algo)
+#define __ax_hdr_algo
-#include <agbx/bs.h>
+#include <ax/bs.h>
-void agbx_cp(void const * src,agbx_i20 num,void * dest);
+void ax_cp(void const * src,ax_i20 num,void * dest);
#endif
diff --git a/agbx/include/ax/bs.h b/agbx/include/ax/bs.h
new file mode 100644
index 0000000..9fb851a
--- /dev/null
+++ b/agbx/include/ax/bs.h
@@ -0,0 +1,42 @@
+/*
+ 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_bs)
+#define __ax_hdr_bs
+
+/* C23 compatibility: */
+#define constexpr static const
+#define typeof __typeof__
+
+typedef unsigned short ax_i10;
+typedef unsigned int ax_i20;
+typedef unsigned long long ax_i40;
+typedef unsigned char ax_i8;
+
+typedef enum {
+ ax_err_ok = 0x0u,
+ ax_err_badaddr,
+ ax_err_badalgn,
+ ax_err_badcol,
+ ax_err_badmd,
+ ax_err_pos2big,
+ ax_err_px2big,
+ ax_err_max = 0xFFu,
+} ax_err;
+
+constexpr ax_i40 ax_ver = 0x6u;
+
+[[noreturn]] void ax_done(ax_err err);
+
+[[nodiscard]] ax_i10 ax_get10(ax_i20 addr);
+[[nodiscard]] ax_i20 ax_get20(ax_i20 addr);
+[[nodiscard]] ax_i8 ax_get8( ax_i20 addr);
+
+void ax_set10(ax_i20 addr,ax_i10 val);
+void ax_set20(ax_i20 addr,ax_i20 val);
+void ax_set8( ax_i20 addr,ax_i8 val);
+
+#endif
diff --git a/agbx/include/ax/gfx.h b/agbx/include/ax/gfx.h
new file mode 100644
index 0000000..d534806
--- /dev/null
+++ b/agbx/include/ax/gfx.h
@@ -0,0 +1,38 @@
+/*
+ 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_gfx)
+#define __ax_hdr_gfx
+
+#include <ax/bs.h>
+
+ax_i20 ax_flip( void);
+ax_i20 ax_getvbnk(void);
+void ax_vsync( void);
+
+void ax_setpx1(ax_i20 vaddr,ax_i10 px,ax_i8 col);
+void ax_setpx2(ax_i20 vaddr,ax_i10 px,ax_i10 col);
+
+ax_i8 ax_getpx1(ax_i20 vaddr,ax_i10 px);
+ax_i10 ax_getpx2(ax_i20 vaddr,ax_i10 px);
+
+void ax_clrscrn3(ax_i10 col);
+void ax_clrscrn4(ax_i20 vaddr,ax_i8 col);
+void ax_clrscrn5(ax_i20 vaddr,ax_i10 col);
+
+void ax_plot3(ax_i8 x, ax_i8 y,ax_i10 col);
+void ax_plot4(ax_i20 vaddr,ax_i8 x,ax_i8 y, ax_i8 col);
+void ax_plot5(ax_i20 vaddr,ax_i8 x,ax_i8 y, ax_i10 col);
+
+ax_i10 ax_rd3(ax_i8 x, ax_i8 y);
+ax_i8 ax_rd4(ax_i20 vaddr,ax_i8 x,ax_i8 y);
+ax_i10 ax_rd5(ax_i20 vaddr,ax_i8 x,ax_i8 y);
+
+void ax_cir3(ax_i8 x, ax_i8 y,ax_i8 r);
+void ax_cir4(ax_i20 vaddr,ax_i8 x,ax_i8 y,ax_i8 r);
+void ax_cir5(ax_i20 vaddr,ax_i8 x,ax_i8 y,ax_i8 r);
+
+#endif
diff --git a/agbx/include/ax/key.h b/agbx/include/ax/key.h
new file mode 100644
index 0000000..76517f7
--- /dev/null
+++ b/agbx/include/ax/key.h
@@ -0,0 +1,33 @@
+/*
+ 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_key)
+#define __ax_hdr_key
+
+#include <ax/bs.h>
+
+typedef enum {
+ ax_key_a = 0x0u,
+ ax_key_b = 0x1u,
+ ax_key_l = 0x9u,
+ ax_key_pade = 0x4u,
+ ax_key_padn = 0x6u,
+ ax_key_pads = 0x7u,
+ ax_key_padw = 0x5u,
+ ax_key_r = 0x8u,
+ ax_key_sel = 0x2u,
+ ax_key_start = 0x3u,
+} ax_key;
+
+typedef struct {
+ ax_i10 _keys;
+} ax_keymap;
+
+#define ax_chkkey(_map,_key) (!(bool)(_map._keys >> (ax_i10)_key & 0x1u))
+
+ax_keymap ax_getkeymap(void);
+
+#endif