summaryrefslogtreecommitdiff
path: root/demo
diff options
context:
space:
mode:
Diffstat (limited to 'demo')
-rw-r--r--demo/GNUmakefile6
-rw-r--r--demo/hdr.s4
-rw-r--r--demo/include/ax-demo.h (renamed from demo/include/agbx-demo.h)0
-rw-r--r--demo/source/chgcol.c2
-rw-r--r--demo/source/chkkeys.c2
-rw-r--r--demo/source/initdat.c2
-rw-r--r--demo/source/initgfx.c40
-rw-r--r--demo/source/loop.c2
-rw-r--r--demo/source/setcolbdr.c2
-rw-r--r--demo/source/start.c65
10 files changed, 84 insertions, 41 deletions
diff --git a/demo/GNUmakefile b/demo/GNUmakefile
index ee59a0d..d5c5a81 100644
--- a/demo/GNUmakefile
+++ b/demo/GNUmakefile
@@ -13,7 +13,7 @@ OBJCOPY := arm-none-eabi-objcopy
# TOOL FLAGS
CFLAGS := \
- -I../agbx/include \
+ -I../ax/include \
-Iinclude \
-O3 \
-Wall \
@@ -27,7 +27,7 @@ CFLAGS := \
-std=c2x
LDFLAGS := \
- -L../agbx \
+ -L../ax \
-Tscript.ld \
-znoexecstack
@@ -45,7 +45,7 @@ OBJS := \
ROMHDR := hdr.o
LDLIBS := \
- -lagbx
+ -lax
IMG := demo.gba
diff --git a/demo/hdr.s b/demo/hdr.s
index 508ea2f..ecf4bb3 100644
--- a/demo/hdr.s
+++ b/demo/hdr.s
@@ -5,7 +5,7 @@
@ 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 __ax_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 ax is used.
.ARM
.global _start
_start: @ We define this label to stop the linker from complaining
@@ -17,7 +17,7 @@ _start: @ We define this label to stop the linker from complaining
@ Game title (12)
@ Twelve character ASCII-string (with uppercase letters) signalling the title of the program. If the string does not take up twelve characters, it is padded to that size with zero.
-.ascii "AGBXDEMO\x0\x0\x0\x0"
+.ascii "AXDEMO\x0\x0\x0\x0\x0\x0"
@ Game code (4)
@ Four character ASCII-string. This is the code that is printed on the cartridge sticker (following the "AGB-"-part).
diff --git a/demo/include/agbx-demo.h b/demo/include/ax-demo.h
index 6b354c6..6b354c6 100644
--- a/demo/include/agbx-demo.h
+++ b/demo/include/ax-demo.h
diff --git a/demo/source/chgcol.c b/demo/source/chgcol.c
index 4519319..6b99abb 100644
--- a/demo/source/chgcol.c
+++ b/demo/source/chgcol.c
@@ -1,4 +1,4 @@
-#include <agbx-demo.h>
+#include <ax-demo.h>
#include <ax/gfx.h>
diff --git a/demo/source/chkkeys.c b/demo/source/chkkeys.c
index 8e2a76c..262d542 100644
--- a/demo/source/chkkeys.c
+++ b/demo/source/chkkeys.c
@@ -1,4 +1,4 @@
-#include <agbx-demo.h>
+#include <ax-demo.h>
#include <ax/key.h>
#include <ax/gfx.h>
diff --git a/demo/source/initdat.c b/demo/source/initdat.c
index 4650593..4d0b420 100644
--- a/demo/source/initdat.c
+++ b/demo/source/initdat.c
@@ -1,4 +1,4 @@
-#include <agbx-demo.h>
+#include <ax-demo.h>
#include <ax/gfx.h>
diff --git a/demo/source/initgfx.c b/demo/source/initgfx.c
index 14ea24f..de95d29 100644
--- a/demo/source/initgfx.c
+++ b/demo/source/initgfx.c
@@ -1,4 +1,4 @@
-#include <agbx-demo.h>
+#include <ax-demo.h>
#include <ax/gfx.h>
@@ -7,23 +7,23 @@ static_assert(ax_col(0x0u,0x1Fu,0x0u) == 0b000001111100000u);
static_assert(ax_col(0x0u,0x0u,0x1Fu) == 0b111110000000000u);
void axd_initgfx(void) {
- ax_set10(0x500'0000u,ax_col(0x00u,0x00u,0x00u)); /* Black */
- ax_set10(0x500'0002u,ax_col(0x07u,0x07u,0x07u)); /* Darkgrey */
- ax_set10(0x500'0004u,ax_col(0x0Fu,0x0Fu,0x0Fu)); /* Grey */
- ax_set10(0x500'0006u,ax_col(0x17u,0x17u,0x17u)); /* Lightgrey */
- ax_set10(0x500'0008u,ax_col(0x1Fu,0x1Fu,0x1Fu)); /* White */
- ax_set10(0x500'000Au,ax_col(0x11u,0x01u,0x07u)); /* Red */
- ax_set10(0x500'000Cu,ax_col(0x15u,0x06u,0x02u)); /* Vermillion */
- ax_set10(0x500'000Eu,ax_col(0x1Bu,0x0Eu,0x04u)); /* Orange */
- ax_set10(0x500'0010u,ax_col(0x1Du,0x12u,0x01u)); /* Amber */
- ax_set10(0x500'0012u,ax_col(0x1Du,0x17u,0x01u)); /* Yellow */
- ax_set10(0x500'0014u,ax_col(0x12u,0x19u,0x05u)); /* Chartreuse */
- ax_set10(0x500'0016u,ax_col(0x04u,0x0Fu,0x03u)); /* Green */
- ax_set10(0x500'0018u,ax_col(0x04u,0x11u,0x0Du)); /* Teal */
- ax_set10(0x500'001Au,ax_col(0x04u,0x08u,0x16u)); /* Blue */
- ax_set10(0x500'001Cu,ax_col(0x08u,0x05u,0x10u)); /* Violet */
- ax_set10(0x500'001Eu,ax_col(0x0Au,0x05u,0x11u)); /* Purple */
- ax_set10(0x500'0020u,ax_col(0x11u,0x03u,0x15u)); /* Magenta */
- ax_set10(0x400'0000u,0x404u);
- ax_clrscrn1(0x600'0000u,0x0u);
+ ax_set01(0x400'0000u,0b00000100'10000100u);
+ ax_setcol(0x00u,ax_col(0x00u,0x00u,0x00u)); /* Black */
+ ax_setcol(0x01u,ax_col(0x07u,0x07u,0x07u)); /* Darkgrey */
+ ax_setcol(0x02u,ax_col(0x0Fu,0x0Fu,0x0Fu)); /* Grey */
+ ax_setcol(0x03u,ax_col(0x17u,0x17u,0x17u)); /* Lightgrey */
+ ax_setcol(0x04u,ax_col(0x1Fu,0x1Fu,0x1Fu)); /* White */
+ ax_setcol(0x05u,ax_col(0x11u,0x01u,0x07u)); /* Red */
+ ax_setcol(0x06u,ax_col(0x17u,0x0Au,0x04u)); /* Vermillion */
+ ax_setcol(0x07u,ax_col(0x1Bu,0x0Eu,0x04u)); /* Orange */
+ ax_setcol(0x08u,ax_col(0x1Bu,0x11u,0x01u)); /* Amber */
+ ax_setcol(0x09u,ax_col(0x1Du,0x16u,0x02u)); /* Yellow */
+ ax_setcol(0x0Au,ax_col(0x12u,0x19u,0x05u)); /* Chartreuse */
+ ax_setcol(0x0Bu,ax_col(0x04u,0x0Fu,0x03u)); /* Green */
+ ax_setcol(0x0Cu,ax_col(0x04u,0x11u,0x0Du)); /* Teal */
+ ax_setcol(0x0Du,ax_col(0x04u,0x08u,0x16u)); /* Blue */
+ ax_setcol(0x0Eu,ax_col(0x08u,0x05u,0x10u)); /* Violet */
+ ax_setcol(0x0Fu,ax_col(0x0Au,0x05u,0x11u)); /* Purple */
+ ax_setcol(0x10u,ax_col(0x11u,0x03u,0x15u)); /* Magenta */
+ ax_clrscrn1(0x600'0000u,0x4u);
}
diff --git a/demo/source/loop.c b/demo/source/loop.c
index 65779fa..469f62e 100644
--- a/demo/source/loop.c
+++ b/demo/source/loop.c
@@ -1,4 +1,4 @@
-#include <agbx-demo.h>
+#include <ax-demo.h>
#include <ax/key.h>
#include <ax/gfx.h>
diff --git a/demo/source/setcolbdr.c b/demo/source/setcolbdr.c
index 1173d55..64a0029 100644
--- a/demo/source/setcolbdr.c
+++ b/demo/source/setcolbdr.c
@@ -1,4 +1,4 @@
-#include <agbx-demo.h>
+#include <ax-demo.h>
#include <ax/gfx.h>
diff --git a/demo/source/start.c b/demo/source/start.c
index 15da8f6..15ecec6 100644
--- a/demo/source/start.c
+++ b/demo/source/start.c
@@ -1,4 +1,4 @@
-#include <agbx-demo.h>
+#include <ax-demo.h>
#include <ax/key.h>
#include <ax/gfx.h>
@@ -7,13 +7,13 @@ static ax_i8 const axd_logo[] = {
0x00u,0x00u, 0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u, 0x00u, 0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u, 0x00u, 0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u, 0x00u, 0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u, 0x00u,0x00u,
0x00u,0x04u, 0x04u,0x04u,0x04u,0x04u,0x04u,0x04u,0x04u, 0x04u, 0x04u,0x04u,0x04u,0x04u,0x04u,0x04u,0x04u, 0x04u, 0x04u,0x04u,0x04u,0x04u,0x04u,0x04u,0x04u, 0x04u, 0x04u,0x04u,0x04u,0x04u,0x04u,0x04u,0x04u, 0x04u,0x00u,
- 0x00u,0x04u, 0x04u,0x04u,0x07u,0x08u,0x09u,0x04u,0x04u, 0x04u, 0x04u,0x0Du,0x0Eu,0x0Fu,0x10u,0x05u,0x04u, 0x04u, 0x07u,0x08u,0x09u,0x0Au,0x0Bu,0x0Cu,0x04u, 0x04u, 0x0Eu,0x0Fu,0x04u,0x04u,0x04u,0x07u,0x08u, 0x04u,0x00u,
- 0x00u,0x04u, 0x04u,0x06u,0x07u,0x08u,0x09u,0x0Au,0x04u, 0x04u, 0x0Cu,0x0Du,0x0Eu,0x0Fu,0x10u,0x05u,0x06u, 0x04u, 0x07u,0x08u,0x09u,0x0Au,0x0Bu,0x0Cu,0x0Du, 0x04u, 0x0Eu,0x0Fu,0x10u,0x04u,0x06u,0x07u,0x08u, 0x04u,0x00u,
- 0x00u,0x04u, 0x05u,0x06u,0x04u,0x04u,0x04u,0x0Au,0x0Bu, 0x04u, 0x0Cu,0x0Du,0x04u,0x04u,0x04u,0x04u,0x04u, 0x04u, 0x07u,0x08u,0x04u,0x04u,0x04u,0x0Cu,0x0Du, 0x04u, 0x04u,0x0Fu,0x10u,0x05u,0x06u,0x07u,0x04u, 0x04u,0x00u,
- 0x00u,0x04u, 0x05u,0x06u,0x04u,0x04u,0x04u,0x0Au,0x0Bu, 0x04u, 0x0Cu,0x0Du,0x04u,0x0Fu,0x10u,0x05u,0x06u, 0x04u, 0x07u,0x08u,0x09u,0x0Au,0x0Bu,0x0Cu,0x04u, 0x04u, 0x04u,0x04u,0x10u,0x05u,0x06u,0x04u,0x04u, 0x04u,0x00u,
- 0x00u,0x04u, 0x05u,0x06u,0x07u,0x08u,0x09u,0x0Au,0x0Bu, 0x04u, 0x0Cu,0x0Du,0x04u,0x04u,0x04u,0x05u,0x06u, 0x04u, 0x07u,0x08u,0x04u,0x04u,0x04u,0x0Cu,0x0Du, 0x04u, 0x04u,0x0Fu,0x10u,0x05u,0x06u,0x07u,0x04u, 0x04u,0x00u,
- 0x00u,0x04u, 0x05u,0x06u,0x04u,0x04u,0x04u,0x0Au,0x0Bu, 0x04u, 0x0Cu,0x0Du,0x0Eu,0x0Fu,0x10u,0x05u,0x06u, 0x04u, 0x07u,0x08u,0x09u,0x0Au,0x0Bu,0x0Cu,0x0Du, 0x04u, 0x0Eu,0x0Fu,0x10u,0x04u,0x06u,0x07u,0x08u, 0x04u,0x00u,
- 0x00u,0x04u, 0x05u,0x06u,0x04u,0x04u,0x04u,0x0Au,0x0Bu, 0x04u, 0x04u,0x0Du,0x0Eu,0x0Fu,0x10u,0x05u,0x04u, 0x04u, 0x07u,0x08u,0x09u,0x0Au,0x0Bu,0x0Cu,0x04u, 0x04u, 0x0Eu,0x0Fu,0x04u,0x04u,0x04u,0x07u,0x08u, 0x04u,0x00u,
+ 0x00u,0x04u, 0x04u,0x04u,0x04u,0x04u,0x04u,0x04u,0x04u, 0x04u, 0x04u,0x04u,0x07u,0x08u,0x09u,0x04u,0x04u, 0x04u, 0x0Cu,0x0Du,0x04u,0x04u,0x04u,0x05u,0x06u, 0x04u, 0x04u,0x04u,0x04u,0x04u,0x04u,0x04u,0x04u, 0x04u,0x00u,
+ 0x00u,0x04u, 0x04u,0x04u,0x04u,0x04u,0x04u,0x04u,0x04u, 0x04u, 0x04u,0x06u,0x07u,0x08u,0x09u,0x0Au,0x04u, 0x04u, 0x0Cu,0x0Du,0x0Eu,0x04u,0x10u,0x05u,0x06u, 0x04u, 0x04u,0x04u,0x04u,0x04u,0x04u,0x04u,0x04u, 0x04u,0x00u,
+ 0x00u,0x04u, 0x04u,0x04u,0x04u,0x04u,0x04u,0x04u,0x04u, 0x04u, 0x05u,0x06u,0x04u,0x04u,0x04u,0x0Au,0x0Bu, 0x04u, 0x04u,0x0Du,0x0Eu,0x0Fu,0x10u,0x05u,0x04u, 0x04u, 0x04u,0x04u,0x04u,0x04u,0x04u,0x04u,0x04u, 0x04u,0x00u,
+ 0x00u,0x04u, 0x04u,0x04u,0x04u,0x04u,0x04u,0x04u,0x04u, 0x04u, 0x05u,0x06u,0x04u,0x04u,0x04u,0x0Au,0x0Bu, 0x04u, 0x04u,0x04u,0x0Eu,0x0Fu,0x10u,0x04u,0x04u, 0x04u, 0x04u,0x04u,0x04u,0x04u,0x04u,0x04u,0x04u, 0x04u,0x00u,
+ 0x00u,0x04u, 0x04u,0x04u,0x04u,0x04u,0x04u,0x04u,0x04u, 0x04u, 0x05u,0x06u,0x07u,0x08u,0x09u,0x0Au,0x0Bu, 0x04u, 0x04u,0x0Du,0x0Eu,0x0Fu,0x10u,0x05u,0x04u, 0x04u, 0x04u,0x04u,0x04u,0x04u,0x04u,0x04u,0x04u, 0x04u,0x00u,
+ 0x00u,0x04u, 0x04u,0x04u,0x04u,0x04u,0x04u,0x04u,0x04u, 0x04u, 0x05u,0x06u,0x04u,0x04u,0x04u,0x0Au,0x0Bu, 0x04u, 0x0Cu,0x0Du,0x0Eu,0x04u,0x10u,0x05u,0x06u, 0x04u, 0x04u,0x04u,0x04u,0x04u,0x04u,0x04u,0x04u, 0x04u,0x00u,
+ 0x00u,0x04u, 0x04u,0x04u,0x04u,0x04u,0x04u,0x04u,0x04u, 0x04u, 0x05u,0x06u,0x04u,0x04u,0x04u,0x0Au,0x0Bu, 0x04u, 0x0Cu,0x0Du,0x04u,0x04u,0x04u,0x05u,0x06u, 0x04u, 0x04u,0x04u,0x04u,0x04u,0x04u,0x04u,0x04u, 0x04u,0x00u,
0x00u,0x04u, 0x04u,0x04u,0x04u,0x04u,0x04u,0x04u,0x04u, 0x04u, 0x04u,0x04u,0x04u,0x04u,0x04u,0x04u,0x04u, 0x04u, 0x04u,0x04u,0x04u,0x04u,0x04u,0x04u,0x04u, 0x04u, 0x04u,0x04u,0x04u,0x04u,0x04u,0x04u,0x04u, 0x04u,0x00u,
0x04u,0x00u, 0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u, 0x00u, 0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u, 0x00u, 0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u, 0x00u, 0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u, 0x00u,0x04u,
@@ -39,16 +39,59 @@ ax_err ax_start(void) {
axd_dat dat;
axd_initdat(&dat);
axd_initgfx();
+ ax_vsync();
+ ax_blnk();
+ ax_clrscrn1(dat.vaddr,0x0u);
ax_plottex1(dat.vaddr,ax_scrnw3,axd_logo,ax_coord(ax_scrnw3,ax_scrnw3 / 0x2u - axd_logow / 0x2u,ax_scrnh3 / 0x2u - axd_logoh / 0x2u),axd_logow,axd_logoh);
+ ax_key startkey;
for (;;) {
ax_keymap const keymap = ax_getkeymap();
- if (ax_chkkey(keymap,ax_key_a)) {
+ startkey = ax_key_a;
+ if (ax_chkkey(keymap,startkey)) {
+ break;
+ }
+ startkey = ax_key_b;
+ if (ax_chkkey(keymap,startkey)) {
+ break;
+ }
+ startkey = ax_key_l;
+ if (ax_chkkey(keymap,startkey)) {
+ break;
+ }
+ startkey = ax_key_pade;
+ if (ax_chkkey(keymap,startkey)) {
+ break;
+ }
+ startkey = ax_key_padn;
+ if (ax_chkkey(keymap,startkey)) {
+ break;
+ }
+ startkey = ax_key_pads;
+ if (ax_chkkey(keymap,startkey)) {
+ break;
+ }
+ startkey = ax_key_padw;
+ if (ax_chkkey(keymap,startkey)) {
+ break;
+ }
+ startkey = ax_key_r;
+ if (ax_chkkey(keymap,startkey)) {
+ break;
+ }
+ startkey = ax_key_sel;
+ if (ax_chkkey(keymap,startkey)) {
+ break;
+ }
+ startkey = ax_key_start;
+ if (ax_chkkey(keymap,startkey)) {
break;
}
}
- for (;;) { /* Wait for the key to become released. */
+ ax_vsync();
+ ax_clrscrn1(dat.vaddr,0x0u);
+ for (;;) { /* Wait for the key to be released. */
ax_keymap const keymap = ax_getkeymap();
- if (!ax_chkkey(keymap,ax_key_a)) {
+ if (!ax_chkkey(keymap,startkey)) {
break;
}
}