summaryrefslogtreecommitdiff
path: root/demo
diff options
context:
space:
mode:
Diffstat (limited to 'demo')
-rw-r--r--demo/hdr.s6
-rw-r--r--demo/include/agbx-demo.h38
-rw-r--r--demo/source/chgcol.c8
-rw-r--r--demo/source/chkkeys.c54
-rw-r--r--demo/source/initdat.c4
-rw-r--r--demo/source/initgfx.c26
-rw-r--r--demo/source/loop.c20
-rw-r--r--demo/source/main.c22
8 files changed, 89 insertions, 89 deletions
diff --git a/demo/hdr.s b/demo/hdr.s
index 4ea82d3..508ea2f 100644
--- a/demo/hdr.s
+++ b/demo/hdr.s
@@ -1,15 +1,15 @@
-.extern __agbx_init
+.extern __ax_init
@ AGB IMAGE HEADER
@ ... through the courtesy of <https://problemkaputt.de/gbatek-gba-cartridge-header.htm>.
@ Please read this thoroughly, as to make sure to cater it to your own program.
@ Image entry point (4)
-@ 32-bit ARM instruction that serves as the entry point of the image, which usually is a branch instruction. Must be "b __agbx_init" if agbx is used.
+@ 32-bit ARM instruction that serves as the entry point of the image, which usually is a branch instruction. Must be "b __ax_init" if agbx is used.
.ARM
.global _start
_start: @ We define this label to stop the linker from complaining
- b __agbx_init
+ b __ax_init
@ Nintendo logo (156)
@ Must be equal to the following memory sequence. The bootloader locks up if it determines that this is not the case.
diff --git a/demo/include/agbx-demo.h b/demo/include/agbx-demo.h
index 2dc2313..28d0846 100644
--- a/demo/include/agbx-demo.h
+++ b/demo/include/agbx-demo.h
@@ -1,33 +1,33 @@
-#if !defined(agbxd_hdr)
-#define agbxd_hdr
+#if !defined(axd_hdr)
+#define axd_hdr
-#include <agbx/bs.h>
+#include <ax/bs.h>
typedef struct {
- agbx_i8 x;
- agbx_i8 y;
-} agbxd_pos;
+ ax_i8 x;
+ ax_i8 y;
+} axd_pos;
typedef struct {
- agbx_i8 col;
- agbxd_pos pos;
- agbx_i8 prevcol;
- agbxd_pos prevpos;
- agbx_i20 vaddr;
-} agbxd_dat;
+ ax_i8 col;
+ axd_pos pos;
+ ax_i8 prevcol;
+ axd_pos prevpos;
+ ax_i20 vaddr;
+} axd_dat;
typedef struct {
bool done;
bool err;
bool drw;
bool mv;
-} agbxd_upd;
+} axd_upd;
-agbxd_upd agbxd_chkkeys(agbxd_dat * dat);
-void agbxd_chgcol( agbxd_dat * dat,agbx_i8 dir);
-void agbxd_drw( agbxd_dat * dat);
-void agbxd_initdat(agbxd_dat * dat);
-void agbxd_initgfx(void);
-bool agbxd_loop( agbxd_dat * dat);
+axd_upd axd_chkkeys(axd_dat * dat);
+void axd_chgcol( axd_dat * dat,ax_i8 dir);
+void axd_drw( axd_dat * dat);
+void axd_initdat(axd_dat * dat);
+void axd_initgfx(void);
+bool axd_loop( axd_dat * dat);
#endif
diff --git a/demo/source/chgcol.c b/demo/source/chgcol.c
index cbd653e..554c2d3 100644
--- a/demo/source/chgcol.c
+++ b/demo/source/chgcol.c
@@ -1,10 +1,10 @@
#include <agbx-demo.h>
-#include <agbx/gfx.h>
+#include <ax/gfx.h>
-void agbxd_chgcol(agbxd_dat * _dat,agbx_i8 const _dir) {
- constexpr agbx_i8 maxcol = 0x7u;
- agbx_i8 col = _dat->col;
+void axd_chgcol(axd_dat * _dat,ax_i8 const _dir) {
+ constexpr ax_i8 maxcol = 0x7u;
+ ax_i8 col = _dat->col;
if (!_dir) {
if (!col) {col = maxcol;}
else {--col;}
diff --git a/demo/source/chkkeys.c b/demo/source/chkkeys.c
index f117d09..394495c 100644
--- a/demo/source/chkkeys.c
+++ b/demo/source/chkkeys.c
@@ -1,64 +1,64 @@
#include <agbx-demo.h>
-#include <agbx/key.h>
-#include <agbx/gfx.h>
+#include <ax/key.h>
+#include <ax/gfx.h>
-#define agbxd_chk(_key) \
+#define axd_chk(_key) \
curkey = _key; \
- if (agbx_chkkey(keymap,_key))
+ if (ax_chkkey(keymap,_key))
-#define agbxd_wait() \
- while (agbx_chkkey(agbx_getkeymap(),curkey)) {}
+#define axd_wait() \
+ while (ax_chkkey(ax_getkeymap(),curkey)) {}
-agbxd_upd agbxd_chkkeys(agbxd_dat * _dat) {
- agbxd_upd upd = {};
- agbx_keymap const keymap = agbx_getkeymap();
- agbx_key curkey;
- agbxd_chk(agbx_key_sel) {
+axd_upd axd_chkkeys(axd_dat * _dat) {
+ axd_upd upd = {};
+ ax_keymap const keymap = ax_getkeymap();
+ ax_key curkey;
+ axd_chk(ax_key_sel) {
upd.done = true;
upd.err = true;
return upd;
}
- agbxd_chk(agbx_key_start) {
+ axd_chk(ax_key_start) {
upd.done = true;
return upd;
}
- agbxd_chk(agbx_key_l) {
- agbxd_chgcol(_dat,0x0u);
- agbxd_wait();
+ axd_chk(ax_key_l) {
+ axd_chgcol(_dat,0x0u);
+ axd_wait()
}
- agbxd_chk(agbx_key_r) {
- agbxd_chgcol(_dat,0x1u);
- agbxd_wait();
+ axd_chk(ax_key_r) {
+ axd_chgcol(_dat,0x1u);
+ axd_wait()
}
- agbxd_chk(agbx_key_pade) {
+ axd_chk(ax_key_pade) {
if (_dat->pos.x != 0xEFu) {
upd.mv = true;
++_dat->pos.x;
- agbxd_wait();
+ axd_wait()
}
}
- agbxd_chk(agbx_key_padn) {
+ axd_chk(ax_key_padn) {
if (_dat->pos.y != 0x0u) {
upd.mv = true;
--_dat->pos.y;
- agbxd_wait();
+ axd_wait()
}
}
- agbxd_chk(agbx_key_pads) {
+ axd_chk(ax_key_pads) {
if (_dat->pos.y != 0x9Fu) {
upd.mv = true;
++_dat->pos.y;
- agbxd_wait();
+ axd_wait()
}
}
- agbxd_chk(agbx_key_padw) {
+ axd_chk(ax_key_padw) {
if (_dat->pos.x != 0x0u) {
upd.mv = true;
--_dat->pos.x;
- agbxd_wait();
+ axd_wait()
}
}
- agbxd_chk(agbx_key_a) {upd.drw = true;}
+ axd_chk(ax_key_a) {upd.drw = true;}
return upd;
}
diff --git a/demo/source/initdat.c b/demo/source/initdat.c
index c9bb7af..86f0e6b 100644
--- a/demo/source/initdat.c
+++ b/demo/source/initdat.c
@@ -1,8 +1,8 @@
#include <agbx-demo.h>
-#include <agbx/gfx.h>
+#include <ax/gfx.h>
-void agbxd_initdat(agbxd_dat * const _dat) {
+void axd_initdat(axd_dat * const _dat) {
_dat->col = 0x2u;
_dat->pos.x = 0x0u;
_dat->pos.y = 0x0u;
diff --git a/demo/source/initgfx.c b/demo/source/initgfx.c
index 474d5cd..e2f75d4 100644
--- a/demo/source/initgfx.c
+++ b/demo/source/initgfx.c
@@ -1,17 +1,17 @@
#include <agbx-demo.h>
-#include <agbx/gfx.h>
+#include <ax/gfx.h>
-void agbxd_initgfx(void) {
- agbx_set10(0x500'0000u,0b0u);
- agbx_set10(0x500'0002u,0b111111111111111u);
- agbx_set10(0x500'0004u,0b11111u);
- agbx_set10(0x500'0006u,0b1111111111u);
- agbx_set10(0x500'0008u,0b1111100000u);
- agbx_set10(0x500'000Au,0b111111111100000u);
- agbx_set10(0x500'000Cu,0b111110000000000u);
- agbx_set10(0x500'000Eu,0b111110000011111u);
- agbx_set10(0x400'0000u,0x404u);
- agbx_clrscrn4(0x600'0000u,0x0u);
- agbx_clrscrn4(0x600'A000u,0x0u);
+void axd_initgfx(void) {
+ ax_set10(0x500'0000u,0b0u);
+ ax_set10(0x500'0002u,0b111111111111111u);
+ ax_set10(0x500'0004u,0b11111u);
+ ax_set10(0x500'0006u,0b1111111111u);
+ ax_set10(0x500'0008u,0b1111100000u);
+ ax_set10(0x500'000Au,0b111111111100000u);
+ ax_set10(0x500'000Cu,0b111110000000000u);
+ ax_set10(0x500'000Eu,0b111110000011111u);
+ ax_set10(0x400'0000u,0x404u);
+ ax_clrscrn4(0x600'0000u,0x0u);
+ ax_clrscrn4(0x600'A000u,0x0u);
}
diff --git a/demo/source/loop.c b/demo/source/loop.c
index 003ac61..e57cafb 100644
--- a/demo/source/loop.c
+++ b/demo/source/loop.c
@@ -1,28 +1,28 @@
#include <agbx-demo.h>
-#include <agbx/key.h>
-#include <agbx/gfx.h>
+#include <ax/key.h>
+#include <ax/gfx.h>
-bool agbxd_loop(agbxd_dat * const _dat) {
+bool axd_loop(axd_dat * const _dat) {
bool err = false;
_dat->prevcol = 0x0u;
- agbx_plot4(_dat->vaddr,_dat->pos.x,_dat->pos.y,0x1u);
+ ax_plot4(_dat->vaddr,_dat->pos.x,_dat->pos.y,0x1u);
for (;;) {
_dat->prevpos = _dat->pos;
- agbxd_upd const upd = agbxd_chkkeys(_dat);
+ axd_upd const upd = axd_chkkeys(_dat);
if (upd.done) {
err = upd.err;
break;
}
- agbx_vsync();
+ ax_vsync();
if (upd.drw) {
_dat->prevcol = _dat->col;
- if (upd.mv) {agbx_plot4(_dat->vaddr,_dat->pos.x,_dat->pos.y,_dat->col);}
+ if (upd.mv) {ax_plot4(_dat->vaddr,_dat->pos.x,_dat->pos.y,_dat->col);}
}
if (upd.mv) {
- agbx_plot4(_dat->vaddr,_dat->prevpos.x,_dat->prevpos.y,_dat->prevcol);
- _dat->prevcol = agbx_rd4(_dat->vaddr,_dat->pos.x,_dat->pos.y);
- agbx_plot4(_dat->vaddr,_dat->pos.x,_dat->pos.y,0x1u);
+ ax_plot4(_dat->vaddr,_dat->prevpos.x,_dat->prevpos.y,_dat->prevcol);
+ _dat->prevcol = ax_rd4(_dat->vaddr,_dat->pos.x,_dat->pos.y);
+ ax_plot4(_dat->vaddr,_dat->pos.x,_dat->pos.y,0x1u);
}
}
return err;
diff --git a/demo/source/main.c b/demo/source/main.c
index fe75179..4c838a6 100644
--- a/demo/source/main.c
+++ b/demo/source/main.c
@@ -1,18 +1,18 @@
#include <agbx-demo.h>
-#include <agbx/key.h>
-#include <agbx/gfx.h>
+#include <ax/key.h>
+#include <ax/gfx.h>
-agbx_err agbx_main(void) {
- agbxd_dat dat;
- agbxd_initdat(&dat);
- agbxd_initgfx();
- bool const err = agbxd_loop(&dat);
+ax_err ax_main(void) {
+ axd_dat dat;
+ axd_initdat(&dat);
+ axd_initgfx();
+ bool const err = axd_loop(&dat);
if (err) {
- for (agbx_i10 px = 0x0u;px != 0x9600u;++px) {
- agbx_setpx1(dat.vaddr,px,dat.col);
- agbxd_chgcol(&dat,0x1u);
+ for (ax_i10 px = 0x0u;px != 0x9600u;++px) {
+ ax_setpx1(dat.vaddr,px,dat.col);
+ axd_chgcol(&dat,0x1u);
}
}
- return err ? agbx_err_max : agbx_err_ok;
+ return err ? ax_err_max : ax_err_ok;
}