summaryrefslogtreecommitdiff
path: root/agbx/source
diff options
context:
space:
mode:
Diffstat (limited to 'agbx/source')
-rw-r--r--agbx/source/algo/cp.c6
-rw-r--r--agbx/source/bs/done.c42
-rw-r--r--agbx/source/bs/get.s18
-rw-r--r--agbx/source/bs/set.s18
-rw-r--r--agbx/source/gfx/clrscrn.c22
-rw-r--r--agbx/source/gfx/flip.s14
-rw-r--r--agbx/source/gfx/getpx.s8
-rw-r--r--agbx/source/gfx/getvbnk.s14
-rw-r--r--agbx/source/gfx/plot.c22
-rw-r--r--agbx/source/gfx/rd.c22
-rw-r--r--agbx/source/gfx/setpx.c22
-rw-r--r--agbx/source/gfx/vsync.s10
-rw-r--r--agbx/source/key/getkeymap.s8
-rw-r--r--agbx/source/priv/init.s12
14 files changed, 119 insertions, 119 deletions
diff --git a/agbx/source/algo/cp.c b/agbx/source/algo/cp.c
index 651abd8..347b55d 100644
--- a/agbx/source/algo/cp.c
+++ b/agbx/source/algo/cp.c
@@ -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/.
*/
-#include <agbx/priv.h>
+#include <ax/priv.h>
-#include <agbx/algo.h>
+#include <ax/algo.h>
-void agbx_cp(void const * const _src,agbx_i20 const _num,void * const _dest) {
+void ax_cp(void const * const _src,ax_i20 const _num,void * const _dest) {
unsigned char const * src = _src;
unsigned char * dest = _dest;
unsigned char const * const aftersrc = src + _num;
diff --git a/agbx/source/bs/done.c b/agbx/source/bs/done.c
index 64130e3..e302244 100644
--- a/agbx/source/bs/done.c
+++ b/agbx/source/bs/done.c
@@ -4,38 +4,38 @@
If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
-#include <agbx/priv.h>
+#include <ax/priv.h>
-#include <agbx/gfx.h>
+#include <ax/gfx.h>
-void agbx_done(agbx_err const _err) {
- if (_err == agbx_err_ok) {
+void ax_done(ax_err const _err) {
+ if (_err == ax_err_ok) {
__asm__ (
"svc 0x3\n"
);
__builtin_unreachable();
}
/* Display the barcode-like error message: */
- agbx_set10(0x400'0000u,0x404u);
- agbx_set10(0x500'0000u,0x0u);
- agbx_set10(0x500'0002u,0b11111u);
- agbx_i8 err[0xBu];
- for (agbx_i8 pos = 0x0u;pos != 0x8u;++pos) {err[pos] = (agbx_i8)_err >> pos & 0x1u;}
+ ax_set10(0x400'0000u,0x404u);
+ ax_set10(0x500'0000u,0x0u);
+ ax_set10(0x500'0002u,0b11111u);
+ ax_i8 err[0xBu];
+ for (ax_i8 pos = 0x0u;pos != 0x8u;++pos) {err[pos] = (ax_i8)_err >> pos & 0x1u;}
err[0x8u] = 0x0u;
err[0x9u] = 0x1u;
err[0xAu] = 0x0u;
- for (agbx_i10 pos = 0x0u;pos != 0x9600u;pos += 0xF0u) {
- agbx_setpx1(0x600'0000u,pos, err[0x0u]);
- agbx_setpx1(0x600'0000u,pos + 0x1u,err[0x1u]);
- agbx_setpx1(0x600'0000u,pos + 0x2u,err[0x2u]);
- agbx_setpx1(0x600'0000u,pos + 0x3u,err[0x3u]);
- agbx_setpx1(0x600'0000u,pos + 0x4u,err[0x4u]);
- agbx_setpx1(0x600'0000u,pos + 0x5u,err[0x5u]);
- agbx_setpx1(0x600'0000u,pos + 0x6u,err[0x6u]);
- agbx_setpx1(0x600'0000u,pos + 0x7u,err[0x7u]);
- agbx_setpx1(0x600'0000u,pos + 0x8u,err[0x8u]);
- agbx_setpx1(0x600'0000u,pos + 0x9u,err[0x9u]);
- agbx_setpx1(0x600'0000u,pos + 0xAu,err[0xAu]);
+ for (ax_i10 pos = 0x0u;pos != 0x9600u;pos += 0xF0u) {
+ ax_setpx1(0x600'0000u,pos, err[0x0u]);
+ ax_setpx1(0x600'0000u,pos + 0x1u,err[0x1u]);
+ ax_setpx1(0x600'0000u,pos + 0x2u,err[0x2u]);
+ ax_setpx1(0x600'0000u,pos + 0x3u,err[0x3u]);
+ ax_setpx1(0x600'0000u,pos + 0x4u,err[0x4u]);
+ ax_setpx1(0x600'0000u,pos + 0x5u,err[0x5u]);
+ ax_setpx1(0x600'0000u,pos + 0x6u,err[0x6u]);
+ ax_setpx1(0x600'0000u,pos + 0x7u,err[0x7u]);
+ ax_setpx1(0x600'0000u,pos + 0x8u,err[0x8u]);
+ ax_setpx1(0x600'0000u,pos + 0x9u,err[0x9u]);
+ ax_setpx1(0x600'0000u,pos + 0xAu,err[0xAu]);
}
__asm__ (
"svc 0x2\n"
diff --git a/agbx/source/bs/get.s b/agbx/source/bs/get.s
index b827dec..7068aaf 100644
--- a/agbx/source/bs/get.s
+++ b/agbx/source/bs/get.s
@@ -7,15 +7,15 @@
.cpu arm7tdmi
.thumb
-.globl agbx_get10
-.globl agbx_get20
-.globl agbx_get8
+.globl ax_get10
+.globl ax_get20
+.globl ax_get8
.func
.thumb_func
-agbx_get10:
- ldrh r0,[r0] @ agbx_i10 val = *(agbx_i10 *)addr;
+ax_get10:
+ ldrh r0,[r0] @ ax_i10 val = *(ax_i10 *)addr;
bx lr @ return val;
.endfunc
@@ -23,8 +23,8 @@ agbx_get10:
.func
.thumb_func
-agbx_get20:
- ldr r0,[r0] @ agbx_i20 val = *(agbx_i20 *)addr;
+ax_get20:
+ ldr r0,[r0] @ ax_i20 val = *(ax_i20 *)addr;
bx lr @ return val;
.endfunc
@@ -32,8 +32,8 @@ agbx_get20:
.func
.thumb_func
-agbx_get8:
- ldrb r0,[r0] @ agbx_i8 val = *(agbx_i8 *)addr;
+ax_get8:
+ ldrb r0,[r0] @ ax_i8 val = *(ax_i8 *)addr;
bx lr @ return val;
.endfunc
diff --git a/agbx/source/bs/set.s b/agbx/source/bs/set.s
index 85e6372..18e7218 100644
--- a/agbx/source/bs/set.s
+++ b/agbx/source/bs/set.s
@@ -7,15 +7,15 @@
.cpu arm7tdmi
.thumb
-.globl agbx_set10
-.globl agbx_set20
-.globl agbx_set8
+.globl ax_set10
+.globl ax_set20
+.globl ax_set8
.func
.thumb_func
-agbx_set10:
- strh r1,[r0] @ *(agbx_i10 *)addr = val;
+ax_set10:
+ strh r1,[r0] @ *(ax_i10 *)addr = val;
bx lr @ return;
.endfunc
@@ -23,8 +23,8 @@ agbx_set10:
.func
.thumb_func
-agbx_set20:
- str r1,[r0] @ *(agbx_i20 *)addr = val;
+ax_set20:
+ str r1,[r0] @ *(ax_i20 *)addr = val;
bx lr @ return;
.endfunc
@@ -32,8 +32,8 @@ agbx_set20:
.func
.thumb_func
-agbx_set8:
- strb r1,[r0] @ *(agbx_i8 *)addr = val;
+ax_set8:
+ strb r1,[r0] @ *(ax_i8 *)addr = val;
bx lr @ return;
.endfunc
diff --git a/agbx/source/gfx/clrscrn.c b/agbx/source/gfx/clrscrn.c
index 157498c..997d825 100644
--- a/agbx/source/gfx/clrscrn.c
+++ b/agbx/source/gfx/clrscrn.c
@@ -4,21 +4,21 @@
If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
-#include <agbx/priv.h>
+#include <ax/priv.h>
-#include <agbx/gfx.h>
+#include <ax/gfx.h>
-void agbx_clrscrn3(agbx_i10 const _col) {
- agbx_i20 const val = _col | _col << 0x8u | _col << 0x10u | _col << 0x18u;
- for (agbx_i20 addr = 0x400'0000u;addr != 0x401'2C00u;addr += 0x4u) {agbx_set20(addr,val);}
+void ax_clrscrn3(ax_i10 const _col) {
+ ax_i20 const val = _col | _col << 0x8u | _col << 0x10u | _col << 0x18u;
+ for (ax_i20 addr = 0x400'0000u;addr != 0x401'2C00u;addr += 0x4u) {ax_set20(addr,val);}
}
-void agbx_clrscrn4(agbx_i20 const _vaddr,agbx_i8 const _col) {
- agbx_i20 const val = _col | _col << 0x8u | _col << 0x10u | _col << 0x18u;
- for (agbx_i20 addr = _vaddr;addr != _vaddr + 0x9600u;addr += 0x4u) {agbx_set20(addr,val);}
+void ax_clrscrn4(ax_i20 const _vaddr,ax_i8 const _col) {
+ ax_i20 const val = _col | _col << 0x8u | _col << 0x10u | _col << 0x18u;
+ for (ax_i20 addr = _vaddr;addr != _vaddr + 0x9600u;addr += 0x4u) {ax_set20(addr,val);}
}
-void agbx_clrscrn5(agbx_i20 const _vaddr,agbx_i10 const _col) {
- agbx_i20 const val = _col | _col << 0x10u;
- for (agbx_i20 addr = _vaddr;addr != _vaddr + 0xA000u;addr += 0x4u) {agbx_set20(addr,val);}
+void ax_clrscrn5(ax_i20 const _vaddr,ax_i10 const _col) {
+ ax_i20 const val = _col | _col << 0x10u;
+ for (ax_i20 addr = _vaddr;addr != _vaddr + 0xA000u;addr += 0x4u) {ax_set20(addr,val);}
}
diff --git a/agbx/source/gfx/flip.s b/agbx/source/gfx/flip.s
index 32171d1..95f59a6 100644
--- a/agbx/source/gfx/flip.s
+++ b/agbx/source/gfx/flip.s
@@ -7,27 +7,27 @@
.cpu arm7tdmi
.thumb
-.extern __agbx_getvbnk
+.extern __ax_getvbnk
-.globl agbx_flip
+.globl ax_flip
.func
.thumb_func
-agbx_flip:
+ax_flip:
@ Get the current value of dispcnt:
- ldr r0,.dispcntaddr @ agbx_i20 dispcntaddr = 0x4000000u;
- ldrh r1,[r0] @ agbx_i10 dispcnt = *(agbx_i10 *)dispcntaddr;
+ ldr r0,.dispcntaddr @ ax_i20 dispcntaddr = 0x4000000u;
+ ldrh r1,[r0] @ ax_i10 dispcnt = *(ax_i10 *)dispcntaddr;
@ XOR bit five:
movs r2,0b10000
eors r1,r2 @ dispcnt ^= 0b10000u;
@ Save dispcnt:
- strh r1,[r0] @ *(agbx_i10 *)dispcntaddr = dispcnt;
+ strh r1,[r0] @ *(ax_i10 *)dispcntaddr = dispcnt;
@ Get the address of the video bank:
- b __agbx_getvbnk @ agbx_i20 vaddr = __agbx_getvbnk();
+ b __ax_getvbnk @ ax_i20 vaddr = __ax_getvbnk();
bx lr @ return vaddr;
diff --git a/agbx/source/gfx/getpx.s b/agbx/source/gfx/getpx.s
index f5a976f..0bdcef4 100644
--- a/agbx/source/gfx/getpx.s
+++ b/agbx/source/gfx/getpx.s
@@ -7,13 +7,13 @@
.cpu arm7tdmi
.thumb
-.globl agbx_getpx1
-.globl agbx_getpx2
+.globl ax_getpx1
+.globl ax_getpx2
.func
.thumb_func
-agbx_getpx1:
+ax_getpx1:
adds r0,r1 @ Get the address of the pixel by adding the offset to the video address.
ldrh r0,[r0]
bx lr
@@ -23,7 +23,7 @@ agbx_getpx1:
.func
.thumb_func
-agbx_getpx2:
+ax_getpx2:
adds r0,r1 @ Get the address of the pixel by adding the offset to the video address.
adds r0,r1 @ Add the offset twice as each pixel takes up two bytes.
ldrh r0,[r0]
diff --git a/agbx/source/gfx/getvbnk.s b/agbx/source/gfx/getvbnk.s
index f2e22ae..1c6a64e 100644
--- a/agbx/source/gfx/getvbnk.s
+++ b/agbx/source/gfx/getvbnk.s
@@ -7,19 +7,19 @@
.cpu arm7tdmi
.thumb
-.globl __agbx_getvbnk
-.globl agbx_getvbnk
+.globl __ax_getvbnk
+.globl ax_getvbnk
.func
.thumb_func
-agbx_getvbnk:
+ax_getvbnk:
@ Get the current value of dispcnt:
- ldr r0,.dispcntaddr @ agbx_i20 dispcntaddr = 0x4000000u;
- ldrh r1,[r0] @ agbx_i10 dispcnt = *(agbx_i10 *)dispcntaddr;
+ ldr r0,.dispcntaddr @ ax_i20 dispcntaddr = 0x4000000u;
+ ldrh r1,[r0] @ ax_i10 dispcnt = *(ax_i10 *)dispcntaddr;
@ Get the address:
- b __agbx_getvbnk @ agbx_i20 vaddr = __agbx_getvbnk();
+ b __ax_getvbnk @ ax_i20 vaddr = __ax_getvbnk();
bx lr @ return vaddr;
@@ -28,7 +28,7 @@ agbx_getvbnk:
.func
.thumb_func
-__agbx_getvbnk: @ Takes the value of dispcnt in r1.
+__ax_getvbnk: @ Takes the value of dispcnt in r1.
@ Check if the fifth bit is set:
movs r0,0b10000
tst r1,r0
diff --git a/agbx/source/gfx/plot.c b/agbx/source/gfx/plot.c
index a19a2f1..f12c39b 100644
--- a/agbx/source/gfx/plot.c
+++ b/agbx/source/gfx/plot.c
@@ -4,21 +4,21 @@
If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
-#include <agbx/priv.h>
+#include <ax/priv.h>
-#include <agbx/gfx.h>
+#include <ax/gfx.h>
-void agbx_plot3(agbx_i8 const _x,agbx_i8 const _y,agbx_i10 const _col) {
- agbx_i10 const px = _y * 0xF0u + _x;
- __agbx_setpx2(0x600'0000u,px,_col)
+void ax_plot3(ax_i8 const _x,ax_i8 const _y,ax_i10 const _col) {
+ ax_i10 const px = _y * 0xF0u + _x;
+ __ax_setpx2(0x600'0000u,px,_col)
}
-void agbx_plot4(agbx_i20 const _vaddr,agbx_i8 const _x,agbx_i8 const _y,agbx_i8 const _col) {
- agbx_i10 const px = _y * 0xF0u + _x;
- agbx_setpx1(_vaddr,px,_col);
+void ax_plot4(ax_i20 const _vaddr,ax_i8 const _x,ax_i8 const _y,ax_i8 const _col) {
+ ax_i10 const px = _y * 0xF0u + _x;
+ ax_setpx1(_vaddr,px,_col);
}
-void agbx_plot5(agbx_i20 const _vaddr,agbx_i8 const _x,agbx_i8 const _y,agbx_i10 const _col) {
- agbx_i10 const px = _y * 0xA0u + _x;
- __agbx_setpx2(_vaddr,px,_col)
+void ax_plot5(ax_i20 const _vaddr,ax_i8 const _x,ax_i8 const _y,ax_i10 const _col) {
+ ax_i10 const px = _y * 0xA0u + _x;
+ __ax_setpx2(_vaddr,px,_col)
}
diff --git a/agbx/source/gfx/rd.c b/agbx/source/gfx/rd.c
index 94dd676..e53a3fe 100644
--- a/agbx/source/gfx/rd.c
+++ b/agbx/source/gfx/rd.c
@@ -4,21 +4,21 @@
If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
-#include <agbx/priv.h>
+#include <ax/priv.h>
-#include <agbx/gfx.h>
+#include <ax/gfx.h>
-agbx_i10 agbx_rd3(agbx_i8 const _x,agbx_i8 const _y) {
- agbx_i10 const px = _y * 0xF0u + _x;
- return agbx_getpx2(0x600'0000u,px);
+ax_i10 ax_rd3(ax_i8 const _x,ax_i8 const _y) {
+ ax_i10 const px = _y * 0xF0u + _x;
+ return ax_getpx2(0x600'0000u,px);
}
-agbx_i8 agbx_rd4(agbx_i20 const _vaddr,agbx_i8 const _x,agbx_i8 const _y) {
- agbx_i10 const px = _y * 0xF0u + _x;
- return agbx_getpx1(_vaddr,px);
+ax_i8 ax_rd4(ax_i20 const _vaddr,ax_i8 const _x,ax_i8 const _y) {
+ ax_i10 const px = _y * 0xF0u + _x;
+ return ax_getpx1(_vaddr,px);
}
-agbx_i10 agbx_rd5(agbx_i20 const _vaddr,agbx_i8 const _x,agbx_i8 const _y) {
- agbx_i10 const px = _y * 0xA0u + _x;
- return agbx_getpx2(_vaddr,px);
+ax_i10 ax_rd5(ax_i20 const _vaddr,ax_i8 const _x,ax_i8 const _y) {
+ ax_i10 const px = _y * 0xA0u + _x;
+ return ax_getpx2(_vaddr,px);
}
diff --git a/agbx/source/gfx/setpx.c b/agbx/source/gfx/setpx.c
index 322784e..c82c980 100644
--- a/agbx/source/gfx/setpx.c
+++ b/agbx/source/gfx/setpx.c
@@ -4,16 +4,16 @@
If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
-#include <agbx/priv.h>
+#include <ax/priv.h>
-#include <agbx/gfx.h>
+#include <ax/gfx.h>
-void agbx_setpx1(agbx_i20 const _vaddr,agbx_i10 const _px,agbx_i8 const _col) {
+void ax_setpx1(ax_i20 const _vaddr,ax_i10 const _px,ax_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. */
bool const odd = _px & 0x1u;
- agbx_i20 addr = _vaddr + _px - odd;
- agbx_i10 precol = __agbx_get10(addr);
- agbx_i10 col = _col;
+ ax_i20 addr = _vaddr + _px - odd;
+ ax_i10 precol = __ax_get10(addr);
+ ax_i10 col = _col;
if (odd) {
precol &= 0b11111111u;
col <<= 0x8u;
@@ -21,11 +21,11 @@ void agbx_setpx1(agbx_i20 const _vaddr,agbx_i10 const _px,agbx_i8 const _col) {
else {
precol &= 0b1111111100000000u;
}
- agbx_i10 const newcol = precol | col;
- __agbx_set10(addr,newcol);
+ ax_i10 const newcol = precol | col;
+ __ax_set10(addr,newcol);
}
-void agbx_setpx2(agbx_i20 const _vaddr,agbx_i10 const _px,agbx_i10 const _col) {
- agbx_i20 const addr = _vaddr + _px;
- __agbx_set10(addr,_col);
+void ax_setpx2(ax_i20 const _vaddr,ax_i10 const _px,ax_i10 const _col) {
+ ax_i20 const addr = _vaddr + _px;
+ __ax_set10(addr,_col);
}
diff --git a/agbx/source/gfx/vsync.s b/agbx/source/gfx/vsync.s
index 2e6ac3f..7ecd7fb 100644
--- a/agbx/source/gfx/vsync.s
+++ b/agbx/source/gfx/vsync.s
@@ -7,19 +7,19 @@
.cpu arm7tdmi
.thumb
-.globl agbx_vsync
+.globl ax_vsync
.func
.thumb_func
-agbx_vsync:
+ax_vsync:
@ Set the constants:
- ldr r0,.vcountaddr @ agbx_i20 vcountaddr = 0x4000006u;
- movs r1,0xA0 @ agbx_i20 numhline = 0xA0;
+ ldr r0,.vcountaddr @ ax_i20 vcountaddr = 0x4000006u;
+ movs r1,0xA0 @ ax_i20 numhline = 0xA0;
.loop:
@ Check the scanline counter:
- ldrh r2,[r0] @ agbx_i20 vcount = *(agbx_i10 *)vcountaddr;
+ ldrh r2,[r0] @ ax_i20 vcount = *(ax_i10 *)vcountaddr;
cmp r2,r1
beq .ret @ if (vcount == numhline) {goto ret;}
diff --git a/agbx/source/key/getkeymap.s b/agbx/source/key/getkeymap.s
index 38c6dbe..42bb611 100644
--- a/agbx/source/key/getkeymap.s
+++ b/agbx/source/key/getkeymap.s
@@ -7,15 +7,15 @@
.cpu arm7tdmi
.thumb
-.globl agbx_getkeymap
+.globl ax_getkeymap
.func
.thumb_func
-agbx_getkeymap:
+ax_getkeymap:
@ Load the keys:
- ldr r0,.addr @ agbx_i20 addr = 0x4000130u;
- ldrh r0,[r0] @ agbx_keymap keymap = *(agbx_i10 *)addr;
+ ldr r0,.addr @ ax_i20 addr = 0x4000130u;
+ ldrh r0,[r0] @ ax_keymap keymap = *(ax_i10 *)addr;
bx lr @ return keymap;
diff --git a/agbx/source/priv/init.s b/agbx/source/priv/init.s
index b9f1f45..49ada46 100644
--- a/agbx/source/priv/init.s
+++ b/agbx/source/priv/init.s
@@ -7,19 +7,19 @@
.cpu arm7tdmi
.thumb
-.extern agbx_done
-.extern agbx_main
+.extern ax_done
+.extern ax_main
-.globl __agbx_init
+.globl __ax_init
.func
.thumb_func
-__agbx_init:
+__ax_init:
@ Call main:
- bl agbx_main
+ bl ax_main
@ Call done:
- bl agbx_done @ The return value is already in r0, so there's no need to move it.
+ bl ax_done @ The return value is already in r0, so there's no need to move it.
.endfunc