summaryrefslogtreecommitdiff
path: root/agbx
diff options
context:
space:
mode:
Diffstat (limited to 'agbx')
-rw-r--r--agbx/GNUmakefile64
-rw-r--r--agbx/include-private/ax/priv.h12
-rw-r--r--agbx/include/ax/algo.h4
-rw-r--r--agbx/include/ax/bs.h23
-rw-r--r--agbx/include/ax/gfx.h40
-rw-r--r--agbx/include/ax/key.h6
-rw-r--r--agbx/source/algo/cp.c4
-rw-r--r--agbx/source/bs/done.c4
-rw-r--r--agbx/source/bs/get.s6
-rw-r--r--agbx/source/bs/set.s6
-rw-r--r--agbx/source/gfx/clrscrn.c20
-rw-r--r--agbx/source/gfx/flip.s10
-rw-r--r--agbx/source/gfx/getpx.s2
-rw-r--r--agbx/source/gfx/getvbnk.s8
-rw-r--r--agbx/source/gfx/plot.c14
-rw-r--r--agbx/source/gfx/plottex.c36
-rw-r--r--agbx/source/gfx/rd.c14
-rw-r--r--agbx/source/gfx/setpx.c18
-rw-r--r--agbx/source/gfx/vsync.s8
-rw-r--r--agbx/source/key/getkeymap.s6
-rw-r--r--agbx/source/priv/init.s2
21 files changed, 175 insertions, 132 deletions
diff --git a/agbx/GNUmakefile b/agbx/GNUmakefile
index f32c914..c2e1ae7 100644
--- a/agbx/GNUmakefile
+++ b/agbx/GNUmakefile
@@ -1,6 +1,6 @@
# 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 a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>.
# TOOLS
@@ -11,44 +11,48 @@ OBJCOPY := arm-none-eabi-objcopy
# TOOL FLAGS
-CFLAGS := \
- -Iinclude \
- -Iinclude-private \
- -Ofast \
- -Wall \
- -Wextra \
- -Wpedantic \
- -ffreestanding \
- -fno-builtin \
+CFLAGS := \
+ -Iinclude \
+ -Iinclude-private \
+ -Ofast \
+ -Wall \
+ -Wextra \
+ -Wpedantic \
+ -ffreestanding \
+ -fno-builtin \
-fno-strict-aliasing \
- -mcpu=arm7tdmi \
- -mthumb \
- -mtune=arm7tdmi \
- -nostdlib \
+ -fshort-enums \
+ -mcpu=arm7tdmi \
+ -mthumb \
+ -mtune=arm7tdmi \
+ -nostdlib \
-std=c2x
# HEADERS
-HDRS := \
- include/ax/bs.h \
- include/ax/gfx.h \
+HDRS := \
+ include/ax/algo.h \
+ include/ax/bs.h \
+ include/ax/gfx.h \
+ include/ax/key.h \
include-private/ax/priv.h
# BINARIES
-OBJS := \
- source/algo/cp.o \
- source/bs/done.o \
- source/bs/get.o \
- source/bs/set.o \
- source/gfx/clrscrn.o \
- source/gfx/flip.o \
- source/gfx/getpx.o \
- source/gfx/getvbnk.o \
- source/gfx/plot.o \
- source/gfx/rd.o \
- source/gfx/setpx.o \
- source/gfx/vsync.o \
+OBJS := \
+ source/algo/cp.o \
+ source/bs/done.o \
+ source/bs/get.o \
+ source/bs/set.o \
+ source/gfx/clrscrn.o \
+ source/gfx/flip.o \
+ source/gfx/getpx.o \
+ source/gfx/getvbnk.o \
+ source/gfx/plot.o \
+ source/gfx/plottex.o \
+ source/gfx/rd.o \
+ source/gfx/setpx.o \
+ source/gfx/vsync.o \
source/key/getkeymap.o \
source/priv/init.o
diff --git a/agbx/include-private/ax/priv.h b/agbx/include-private/ax/priv.h
index fdbf18b..382a7ee 100644
--- a/agbx/include-private/ax/priv.h
+++ b/agbx/include-private/ax/priv.h
@@ -1,7 +1,7 @@
/*
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 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_priv)
@@ -9,20 +9,20 @@
#include <ax/bs.h>
-#define __ax_get10(_addr) (*(ax_i10 volatile *)_addr)
+#define __ax_get10(_addr) (*(ax_i01 volatile *)_addr)
-#define __ax_get20(_addr) (*(ax_i20 volatile *)_addr)
+#define __ax_get20(_addr) (*(ax_i02 volatile *)_addr)
#define __ax_get8(_addr) (*(ax_i8 volatile *)_addr)
-#define __ax_set10(_addr,_val) ((void)(*(ax_i10 volatile *)_addr = _val))
+#define __ax_set10(_addr,_val) ((void)(*(ax_i01 volatile *)_addr = _val))
-#define __ax_set20(_addr,_val) ((void)(*(ax_i20 volatile *)_addr = _val))
+#define __ax_set20(_addr,_val) ((void)(*(ax_i02 volatile *)_addr = _val))
#define __ax_set8(_addr,_val) ((void)(*(ax_i8 volatile *)_addr = _val))
#define __ax_setpx2(_vaddr,_px,_col) { \
- ax_i20 const addr = _vaddr + _px * 0x2u; /* We multiply it by two as each pixel takes up two bytes. */ \
+ ax_i02 const addr = _vaddr + _px * 0x2u; /* We multiply it by two as each pixel takes up two bytes. */ \
__ax_set10(addr,_col); \
}
diff --git a/agbx/include/ax/algo.h b/agbx/include/ax/algo.h
index e7c7549..8ea344c 100644
--- a/agbx/include/ax/algo.h
+++ b/agbx/include/ax/algo.h
@@ -1,7 +1,7 @@
/*
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 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)
@@ -9,6 +9,6 @@
#include <ax/bs.h>
-void ax_cp(void const * src,ax_i20 num,void * dest);
+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 9fb851a..9f27d8f 100644
--- a/agbx/include/ax/bs.h
+++ b/agbx/include/ax/bs.h
@@ -1,7 +1,7 @@
/*
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 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)
@@ -9,11 +9,10 @@
/* 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 short ax_i01;
+typedef unsigned int ax_i02;
+typedef unsigned long long ax_i04;
typedef unsigned char ax_i8;
typedef enum {
@@ -27,16 +26,16 @@ typedef enum {
ax_err_max = 0xFFu,
} ax_err;
-constexpr ax_i40 ax_ver = 0x6u;
+constexpr ax_i04 ax_ver = 0x7u;
[[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);
+[[nodiscard]] ax_i01 ax_get10(ax_i02 addr);
+[[nodiscard]] ax_i02 ax_get20(ax_i02 addr);
+[[nodiscard]] ax_i8 ax_get8( ax_i02 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);
+void ax_set10(ax_i02 addr,ax_i01 val);
+void ax_set20(ax_i02 addr,ax_i02 val);
+void ax_set8( ax_i02 addr,ax_i8 val);
#endif
diff --git a/agbx/include/ax/gfx.h b/agbx/include/ax/gfx.h
index d534806..b3830d6 100644
--- a/agbx/include/ax/gfx.h
+++ b/agbx/include/ax/gfx.h
@@ -1,7 +1,7 @@
/*
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 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)
@@ -9,30 +9,34 @@
#include <ax/bs.h>
-ax_i20 ax_flip( void);
-ax_i20 ax_getvbnk(void);
+ax_i02 ax_flip( void);
+ax_i02 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);
+void ax_setpx1(ax_i02 vaddr,ax_i01 px,ax_i8 col);
+void ax_setpx2(ax_i02 vaddr,ax_i01 px,ax_i01 col);
-ax_i8 ax_getpx1(ax_i20 vaddr,ax_i10 px);
-ax_i10 ax_getpx2(ax_i20 vaddr,ax_i10 px);
+ax_i8 ax_getpx1(ax_i02 vaddr,ax_i01 px);
+ax_i01 ax_getpx2(ax_i02 vaddr,ax_i01 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_clrscrn3(ax_i01 col);
+void ax_clrscrn4(ax_i02 vaddr,ax_i8 col);
+void ax_clrscrn5(ax_i02 vaddr,ax_i01 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);
+void ax_plot3(ax_i8 x, ax_i8 y,ax_i01 col);
+void ax_plot4(ax_i02 vaddr,ax_i8 x,ax_i8 y, ax_i8 col);
+void ax_plot5(ax_i02 vaddr,ax_i8 x,ax_i8 y, ax_i01 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_plottex3(ax_i01 const * tex, ax_i8 x, ax_i8 y,ax_i8 w,ax_i8 h);
+void ax_plottex4(ax_i02 vaddr,ax_i8 const * tex,ax_i8 x,ax_i8 y,ax_i8 w,ax_i8 h);
+void ax_plottex5(ax_i02 vaddr,ax_i01 const * tex,ax_i8 x,ax_i8 y,ax_i8 w,ax_i8 h);
+
+ax_i01 ax_rd3(ax_i8 x, ax_i8 y);
+ax_i8 ax_rd4(ax_i02 vaddr,ax_i8 x,ax_i8 y);
+ax_i01 ax_rd5(ax_i02 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);
+void ax_cir4(ax_i02 vaddr,ax_i8 x,ax_i8 y,ax_i8 r);
+void ax_cir5(ax_i02 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
index 76517f7..3cff7d6 100644
--- a/agbx/include/ax/key.h
+++ b/agbx/include/ax/key.h
@@ -1,7 +1,7 @@
/*
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 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)
@@ -23,10 +23,10 @@ typedef enum {
} ax_key;
typedef struct {
- ax_i10 _keys;
+ ax_i01 _keys;
} ax_keymap;
-#define ax_chkkey(_map,_key) (!(bool)(_map._keys >> (ax_i10)_key & 0x1u))
+#define ax_chkkey(_map,_key) (!(bool)(_map._keys >> (ax_i01)_key & 0x1u))
ax_keymap ax_getkeymap(void);
diff --git a/agbx/source/algo/cp.c b/agbx/source/algo/cp.c
index 347b55d..0eb506c 100644
--- a/agbx/source/algo/cp.c
+++ b/agbx/source/algo/cp.c
@@ -1,14 +1,14 @@
/*
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 a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>.
*/
#include <ax/priv.h>
#include <ax/algo.h>
-void ax_cp(void const * const _src,ax_i20 const _num,void * const _dest) {
+void ax_cp(void const * const _src,ax_i02 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 e302244..0bb0a3c 100644
--- a/agbx/source/bs/done.c
+++ b/agbx/source/bs/done.c
@@ -1,7 +1,7 @@
/*
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 a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>.
*/
#include <ax/priv.h>
@@ -24,7 +24,7 @@ void ax_done(ax_err const _err) {
err[0x8u] = 0x0u;
err[0x9u] = 0x1u;
err[0xAu] = 0x0u;
- for (ax_i10 pos = 0x0u;pos != 0x9600u;pos += 0xF0u) {
+ for (ax_i01 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]);
diff --git a/agbx/source/bs/get.s b/agbx/source/bs/get.s
index 7068aaf..a936f73 100644
--- a/agbx/source/bs/get.s
+++ b/agbx/source/bs/get.s
@@ -1,6 +1,6 @@
@ 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 a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>.
.syntax unified
@@ -15,7 +15,7 @@
.thumb_func
ax_get10:
- ldrh r0,[r0] @ ax_i10 val = *(ax_i10 *)addr;
+ ldrh r0,[r0] @ ax_i01 val = *(ax_i01 *)addr;
bx lr @ return val;
.endfunc
@@ -24,7 +24,7 @@ ax_get10:
.thumb_func
ax_get20:
- ldr r0,[r0] @ ax_i20 val = *(ax_i20 *)addr;
+ ldr r0,[r0] @ ax_i02 val = *(ax_i02 *)addr;
bx lr @ return val;
.endfunc
diff --git a/agbx/source/bs/set.s b/agbx/source/bs/set.s
index 18e7218..1719be6 100644
--- a/agbx/source/bs/set.s
+++ b/agbx/source/bs/set.s
@@ -1,6 +1,6 @@
@ 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 a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>.
.syntax unified
@@ -15,7 +15,7 @@
.thumb_func
ax_set10:
- strh r1,[r0] @ *(ax_i10 *)addr = val;
+ strh r1,[r0] @ *(ax_i01 *)addr = val;
bx lr @ return;
.endfunc
@@ -24,7 +24,7 @@ ax_set10:
.thumb_func
ax_set20:
- str r1,[r0] @ *(ax_i20 *)addr = val;
+ str r1,[r0] @ *(ax_i02 *)addr = val;
bx lr @ return;
.endfunc
diff --git a/agbx/source/gfx/clrscrn.c b/agbx/source/gfx/clrscrn.c
index 997d825..cd9a7b3 100644
--- a/agbx/source/gfx/clrscrn.c
+++ b/agbx/source/gfx/clrscrn.c
@@ -1,24 +1,24 @@
/*
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 a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>.
*/
#include <ax/priv.h>
#include <ax/gfx.h>
-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 ax_clrscrn3(ax_i01 const _col) {
+ ax_i02 const val = (ax_i02)_col | (ax_i02)_col << 0x10u;
+ for (ax_i02 addr = 0x600'0000u;addr != 0x601'2C00u;addr += 0x4u) {__ax_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 ax_clrscrn4(ax_i02 const _vaddr,ax_i8 const _col) {
+ ax_i02 const val = (ax_i02)_col | (ax_i02)_col << 0x8u | (ax_i02)_col << 0x10u | (ax_i02)_col << 0x18u;
+ for (ax_i02 addr = _vaddr;addr != _vaddr + 0x9600u;addr += 0x4u) {__ax_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);}
+void ax_clrscrn5(ax_i02 const _vaddr,ax_i01 const _col) {
+ ax_i02 const val = (ax_i02)_col | (ax_i02)_col << 0x10u;
+ for (ax_i02 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 95f59a6..887377d 100644
--- a/agbx/source/gfx/flip.s
+++ b/agbx/source/gfx/flip.s
@@ -1,6 +1,6 @@
@ 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 a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>.
.syntax unified
@@ -16,18 +16,18 @@
ax_flip:
@ Get the current value of dispcnt:
- ldr r0,.dispcntaddr @ ax_i20 dispcntaddr = 0x4000000u;
- ldrh r1,[r0] @ ax_i10 dispcnt = *(ax_i10 *)dispcntaddr;
+ ldr r0,.dispcntaddr @ ax_i02 dispcntaddr = 0x4000000u;
+ ldrh r1,[r0] @ ax_i01 dispcnt = *(ax_i01 *)dispcntaddr;
@ XOR bit five:
movs r2,0b10000
eors r1,r2 @ dispcnt ^= 0b10000u;
@ Save dispcnt:
- strh r1,[r0] @ *(ax_i10 *)dispcntaddr = dispcnt;
+ strh r1,[r0] @ *(ax_i01 *)dispcntaddr = dispcnt;
@ Get the address of the video bank:
- b __ax_getvbnk @ ax_i20 vaddr = __ax_getvbnk();
+ b __ax_getvbnk @ ax_i02 vaddr = __ax_getvbnk();
bx lr @ return vaddr;
diff --git a/agbx/source/gfx/getpx.s b/agbx/source/gfx/getpx.s
index 0bdcef4..1db82a8 100644
--- a/agbx/source/gfx/getpx.s
+++ b/agbx/source/gfx/getpx.s
@@ -1,6 +1,6 @@
@ 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 a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>.
.syntax unified
diff --git a/agbx/source/gfx/getvbnk.s b/agbx/source/gfx/getvbnk.s
index 1c6a64e..d3dcbcf 100644
--- a/agbx/source/gfx/getvbnk.s
+++ b/agbx/source/gfx/getvbnk.s
@@ -1,6 +1,6 @@
@ 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 a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>.
.syntax unified
@@ -15,11 +15,11 @@
ax_getvbnk:
@ Get the current value of dispcnt:
- ldr r0,.dispcntaddr @ ax_i20 dispcntaddr = 0x4000000u;
- ldrh r1,[r0] @ ax_i10 dispcnt = *(ax_i10 *)dispcntaddr;
+ ldr r0,.dispcntaddr @ ax_i02 dispcntaddr = 0x4000000u;
+ ldrh r1,[r0] @ ax_i01 dispcnt = *(ax_i01 *)dispcntaddr;
@ Get the address:
- b __ax_getvbnk @ ax_i20 vaddr = __ax_getvbnk();
+ b __ax_getvbnk @ ax_i02 vaddr = __ax_getvbnk();
bx lr @ return vaddr;
diff --git a/agbx/source/gfx/plot.c b/agbx/source/gfx/plot.c
index f12c39b..a100208 100644
--- a/agbx/source/gfx/plot.c
+++ b/agbx/source/gfx/plot.c
@@ -1,24 +1,24 @@
/*
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 a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>.
*/
#include <ax/priv.h>
#include <ax/gfx.h>
-void ax_plot3(ax_i8 const _x,ax_i8 const _y,ax_i10 const _col) {
- ax_i10 const px = _y * 0xF0u + _x;
+void ax_plot3(ax_i8 const _x,ax_i8 const _y,ax_i01 const _col) {
+ ax_i01 const px = _y * 0xF0u + _x;
__ax_setpx2(0x600'0000u,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;
+void ax_plot4(ax_i02 const _vaddr,ax_i8 const _x,ax_i8 const _y,ax_i8 const _col) {
+ ax_i01 const px = _y * 0xF0u + _x;
ax_setpx1(_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;
+void ax_plot5(ax_i02 const _vaddr,ax_i8 const _x,ax_i8 const _y,ax_i01 const _col) {
+ ax_i01 const px = _y * 0xA0u + _x;
__ax_setpx2(_vaddr,px,_col)
}
diff --git a/agbx/source/gfx/plottex.c b/agbx/source/gfx/plottex.c
new file mode 100644
index 0000000..2165c52
--- /dev/null
+++ b/agbx/source/gfx/plottex.c
@@ -0,0 +1,36 @@
+/*
+ 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>.
+*/
+
+#include <ax/priv.h>
+
+#include <ax/gfx.h>
+
+void ax_plottex3(ax_i01 const * const _tex,ax_i8 const _x,ax_i8 const _y,ax_i8 const _w,ax_i8 const _h) {
+ ax_i01 const * texpos = _tex;
+ for (ax_i8 y = _y;y != _y + _h;++y) {
+ for (ax_i8 x = _x;x != _x + _w;++x) {
+ ax_plot3(x,y,*(texpos++));
+ }
+ }
+}
+
+void ax_plottex4(ax_i02 const _vaddr,ax_i8 const * const _tex,ax_i8 const _x,ax_i8 const _y,ax_i8 const _w,ax_i8 const _h) {
+ ax_i8 const * texpos = _tex;
+ for (ax_i8 y = _y;y != _y + _h;++y) {
+ for (ax_i8 x = _x;x != _x + _w;++x) {
+ ax_plot4(_vaddr,x,y,*(texpos++));
+ }
+ }
+}
+
+void ax_plottex5(ax_i02 const _vaddr,ax_i01 const * const _tex,ax_i8 const _x,ax_i8 const _y,ax_i8 const _w,ax_i8 const _h) {
+ ax_i01 const * texpos = _tex;
+ for (ax_i8 y = _y;y != _y + _h;++y) {
+ for (ax_i8 x = _x;x != _x + _w;++x) {
+ ax_plot5(_vaddr,x,y,*(texpos++));
+ }
+ }
+}
diff --git a/agbx/source/gfx/rd.c b/agbx/source/gfx/rd.c
index e53a3fe..aba36b1 100644
--- a/agbx/source/gfx/rd.c
+++ b/agbx/source/gfx/rd.c
@@ -1,24 +1,24 @@
/*
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 a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>.
*/
#include <ax/priv.h>
#include <ax/gfx.h>
-ax_i10 ax_rd3(ax_i8 const _x,ax_i8 const _y) {
- ax_i10 const px = _y * 0xF0u + _x;
+ax_i01 ax_rd3(ax_i8 const _x,ax_i8 const _y) {
+ ax_i01 const px = _y * 0xF0u + _x;
return ax_getpx2(0x600'0000u,px);
}
-ax_i8 ax_rd4(ax_i20 const _vaddr,ax_i8 const _x,ax_i8 const _y) {
- ax_i10 const px = _y * 0xF0u + _x;
+ax_i8 ax_rd4(ax_i02 const _vaddr,ax_i8 const _x,ax_i8 const _y) {
+ ax_i01 const px = _y * 0xF0u + _x;
return ax_getpx1(_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;
+ax_i01 ax_rd5(ax_i02 const _vaddr,ax_i8 const _x,ax_i8 const _y) {
+ ax_i01 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 c82c980..7110d02 100644
--- a/agbx/source/gfx/setpx.c
+++ b/agbx/source/gfx/setpx.c
@@ -1,19 +1,19 @@
/*
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 a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>.
*/
#include <ax/priv.h>
#include <ax/gfx.h>
-void ax_setpx1(ax_i20 const _vaddr,ax_i10 const _px,ax_i8 const _col) {
+void ax_setpx1(ax_i02 const _vaddr,ax_i01 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;
- ax_i20 addr = _vaddr + _px - odd;
- ax_i10 precol = __ax_get10(addr);
- ax_i10 col = _col;
+ bool const odd = _px & 0x1u;
+ ax_i02 addr = _vaddr + _px - odd;
+ ax_i01 precol = __ax_get10(addr);
+ ax_i01 col = _col;
if (odd) {
precol &= 0b11111111u;
col <<= 0x8u;
@@ -21,11 +21,11 @@ void ax_setpx1(ax_i20 const _vaddr,ax_i10 const _px,ax_i8 const _col) {
else {
precol &= 0b1111111100000000u;
}
- ax_i10 const newcol = precol | col;
+ ax_i01 const newcol = precol | col;
__ax_set10(addr,newcol);
}
-void ax_setpx2(ax_i20 const _vaddr,ax_i10 const _px,ax_i10 const _col) {
- ax_i20 const addr = _vaddr + _px;
+void ax_setpx2(ax_i02 const _vaddr,ax_i01 const _px,ax_i01 const _col) {
+ ax_i02 const addr = _vaddr + _px;
__ax_set10(addr,_col);
}
diff --git a/agbx/source/gfx/vsync.s b/agbx/source/gfx/vsync.s
index 7ecd7fb..e16724f 100644
--- a/agbx/source/gfx/vsync.s
+++ b/agbx/source/gfx/vsync.s
@@ -1,6 +1,6 @@
@ 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 a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>.
.syntax unified
@@ -14,12 +14,12 @@
ax_vsync:
@ Set the constants:
- ldr r0,.vcountaddr @ ax_i20 vcountaddr = 0x4000006u;
- movs r1,0xA0 @ ax_i20 numhline = 0xA0;
+ ldr r0,.vcountaddr @ ax_i02 vcountaddr = 0x4000006u;
+ movs r1,0xA0 @ ax_i02 numhline = 0xA0;
.loop:
@ Check the scanline counter:
- ldrh r2,[r0] @ ax_i20 vcount = *(ax_i10 *)vcountaddr;
+ ldrh r2,[r0] @ ax_i02 vcount = *(ax_i01 *)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 42bb611..2751c9f 100644
--- a/agbx/source/key/getkeymap.s
+++ b/agbx/source/key/getkeymap.s
@@ -1,6 +1,6 @@
@ 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 a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>.
.syntax unified
@@ -14,8 +14,8 @@
ax_getkeymap:
@ Load the keys:
- ldr r0,.addr @ ax_i20 addr = 0x4000130u;
- ldrh r0,[r0] @ ax_keymap keymap = *(ax_i10 *)addr;
+ ldr r0,.addr @ ax_i02 addr = 0x4000130u;
+ ldrh r0,[r0] @ ax_keymap keymap = *(ax_i01 *)addr;
bx lr @ return keymap;
diff --git a/agbx/source/priv/init.s b/agbx/source/priv/init.s
index 49ada46..1c32c4e 100644
--- a/agbx/source/priv/init.s
+++ b/agbx/source/priv/init.s
@@ -1,6 +1,6 @@
@ 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 a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>.
.syntax unified