summaryrefslogtreecommitdiff
path: root/agbx/source/gfx
diff options
context:
space:
mode:
Diffstat (limited to 'agbx/source/gfx')
-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
8 files changed, 67 insertions, 67 deletions
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;}