diff options
-rw-r--r-- | CHANGELOG.txt | 9 | ||||
-rw-r--r-- | agbx/GNUmakefile | 2 | ||||
-rw-r--r-- | agbx/include/ax/algo.h | 14 | ||||
-rw-r--r-- | agbx/include/ax/bs.h | 7 | ||||
-rw-r--r-- | agbx/include/ax/gfx.h | 10 | ||||
-rw-r--r-- | agbx/include/ax/key.h | 2 | ||||
-rw-r--r-- | agbx/source/priv/init.s | 4 | ||||
-rw-r--r-- | demo/GNUmakefile | 24 | ||||
-rw-r--r-- | demo/include/agbx-demo.h | 13 | ||||
-rw-r--r-- | demo/source/chgcol.c | 3 | ||||
-rw-r--r-- | demo/source/chkkeys.c | 8 | ||||
-rw-r--r-- | demo/source/initdat.c | 6 | ||||
-rw-r--r-- | demo/source/initgfx.c | 31 | ||||
-rw-r--r-- | demo/source/loop.c | 11 | ||||
-rw-r--r-- | demo/source/main.c | 19 | ||||
-rw-r--r-- | demo/source/setcolbdr.c | 18 | ||||
-rw-r--r-- | demo/source/start.c | 65 |
17 files changed, 162 insertions, 84 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 027b608..4365080 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,12 @@ +# 9.0 + +* Move scrnw and scrnh to gfx; +* Make coord take scrnw parameter; +* Expand macro parameters inside parantheses; +* Rename entry point to ax_start; +* Add macro for converting RGB-values into colour values; +* Remove algo module; + # 8.0 * Remove setpx and getpx; diff --git a/agbx/GNUmakefile b/agbx/GNUmakefile index 33db079..211f5a5 100644 --- a/agbx/GNUmakefile +++ b/agbx/GNUmakefile @@ -32,7 +32,7 @@ CFLAGS := \ -nostdlib \ -std=c2x -CXXFLAGS := \ +CXXFLAGS := \ -Iinclude \ -Iinclude-private \ -Ofast \ diff --git a/agbx/include/ax/algo.h b/agbx/include/ax/algo.h deleted file mode 100644 index 8ea344c..0000000 --- a/agbx/include/ax/algo.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - 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 !defined(__ax_hdr_algo) -#define __ax_hdr_algo - -#include <ax/bs.h> - -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 88c632a..0bcfbd7 100644 --- a/agbx/include/ax/bs.h +++ b/agbx/include/ax/bs.h @@ -32,12 +32,7 @@ typedef enum { ax_err_max = 0xFFu, } ax_err; -constexpr ax_i04 ax_ver = 0x8u; - -constexpr ax_i8 ax_scrnw3 = 0xF0u; -constexpr ax_i8 ax_scrnw5 = 0xA0u; -constexpr ax_i8 ax_scrnh3 = 0xA0u; -constexpr ax_i8 ax_scrnh5 = 0x80u; +constexpr ax_i04 ax_ver = 0x9u; [[noreturn]] void ax_done(ax_err err); diff --git a/agbx/include/ax/gfx.h b/agbx/include/ax/gfx.h index d9fa1b7..56405f1 100644 --- a/agbx/include/ax/gfx.h +++ b/agbx/include/ax/gfx.h @@ -13,8 +13,14 @@ extern "C" { #endif -#define ax_coord3(_x,_y) ((ax_i01)_y * ax_scrnw3 + (ax_i01)_x) -#define ax_coord5(_x,_y) ((ax_i01)_y * ax_scrnw5 + (ax_i01)_x) +constexpr ax_i8 ax_scrnw3 = 0xF0u; +constexpr ax_i8 ax_scrnw5 = 0xA0u; +constexpr ax_i8 ax_scrnh3 = 0xA0u; +constexpr ax_i8 ax_scrnh5 = 0x80u; + +#define ax_coord(_scrnw,_x,_y) ((ax_i01)((ax_i01)(_y) * (ax_i01)(_scrnw) + (ax_i01)(_x))) + +#define ax_col(_r,_g,_b) ((ax_i01)(((ax_i01)(_r) | (ax_i01)(_g) << 0x5u | (ax_i01)(_b) << 0xAu) & 0b000000111111111111111)) ax_i02 ax_flip( void); ax_i02 ax_getvbnk(void); diff --git a/agbx/include/ax/key.h b/agbx/include/ax/key.h index 3cff7d6..88d6250 100644 --- a/agbx/include/ax/key.h +++ b/agbx/include/ax/key.h @@ -26,7 +26,7 @@ typedef struct { ax_i01 _keys; } ax_keymap; -#define ax_chkkey(_map,_key) (!(bool)(_map._keys >> (ax_i01)_key & 0x1u)) +#define ax_chkkey(_map,_key) (!(bool)((_map)._keys >> (ax_i01)(_key) & 0x1u)) ax_keymap ax_getkeymap(void); diff --git a/agbx/source/priv/init.s b/agbx/source/priv/init.s index 1c32c4e..718638d 100644 --- a/agbx/source/priv/init.s +++ b/agbx/source/priv/init.s @@ -8,7 +8,7 @@ .thumb .extern ax_done -.extern ax_main +.extern ax_start .globl __ax_init @@ -17,7 +17,7 @@ __ax_init: @ Call main: - bl ax_main + bl ax_start @ Call done: bl ax_done @ The return value is already in r0, so there's no need to move it. diff --git a/demo/GNUmakefile b/demo/GNUmakefile index 27be37f..9e19631 100644 --- a/demo/GNUmakefile +++ b/demo/GNUmakefile @@ -26,19 +26,21 @@ CFLAGS := \ -nostdlib \ -std=c2x -LDFLAGS := \ - -L../agbx \ - -Tscript.ld +LDFLAGS := \ + -L../agbx \ + -Tscript.ld \ + -znoexecstack # BINARIES -OBJS := \ - source/chkkeys.o \ - source/chgcol.o \ - source/initdat.o \ - source/initgfx.o \ - source/loop.o \ - source/main.o +OBJS := \ + source/chkkeys.o \ + source/chgcol.o \ + source/initdat.o \ + source/initgfx.o \ + source/loop.o \ + source/setcolbdr.o \ + source/start.o ROMHDR := hdr.o @@ -52,7 +54,7 @@ IMG := demo.gba .PHONY: clean purge $(IMG): $(ROMHDR) $(OBJS) - $(LD) $(LDFLAGS) -odemo.elf -znoexecstack $(^) $(LDLIBS) + $(LD) $(LDFLAGS) -odemo.elf $(^) $(LDLIBS) $(OBJCOPY) -Obinary demo.elf $(@) agbsum -psi$(@) diff --git a/demo/include/agbx-demo.h b/demo/include/agbx-demo.h index 0bb0b22..6b354c6 100644 --- a/demo/include/agbx-demo.h +++ b/demo/include/agbx-demo.h @@ -23,11 +23,12 @@ typedef struct { bool mv; } axd_upd; -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); +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); +void axd_setcolbdr(ax_i02 vaddr,ax_i01 col); #endif diff --git a/demo/source/chgcol.c b/demo/source/chgcol.c index 554c2d3..4519319 100644 --- a/demo/source/chgcol.c +++ b/demo/source/chgcol.c @@ -3,7 +3,7 @@ #include <ax/gfx.h> void axd_chgcol(axd_dat * _dat,ax_i8 const _dir) { - constexpr ax_i8 maxcol = 0x7u; + constexpr ax_i8 maxcol = 0xEu; ax_i8 col = _dat->col; if (!_dir) { if (!col) {col = maxcol;} @@ -14,4 +14,5 @@ void axd_chgcol(axd_dat * _dat,ax_i8 const _dir) { else {++col;} } _dat->col = col; + axd_setcolbdr(_dat->vaddr,col); } diff --git a/demo/source/chkkeys.c b/demo/source/chkkeys.c index 394495c..8e2a76c 100644 --- a/demo/source/chkkeys.c +++ b/demo/source/chkkeys.c @@ -32,28 +32,28 @@ axd_upd axd_chkkeys(axd_dat * _dat) { axd_wait() } axd_chk(ax_key_pade) { - if (_dat->pos.x != 0xEFu) { + if (_dat->pos.x != 0xEEu) { upd.mv = true; ++_dat->pos.x; axd_wait() } } axd_chk(ax_key_padn) { - if (_dat->pos.y != 0x0u) { + if (_dat->pos.y != 0x1u) { upd.mv = true; --_dat->pos.y; axd_wait() } } axd_chk(ax_key_pads) { - if (_dat->pos.y != 0x9Fu) { + if (_dat->pos.y != 0x9Eu) { upd.mv = true; ++_dat->pos.y; axd_wait() } } axd_chk(ax_key_padw) { - if (_dat->pos.x != 0x0u) { + if (_dat->pos.x != 0x1u) { upd.mv = true; --_dat->pos.x; axd_wait() diff --git a/demo/source/initdat.c b/demo/source/initdat.c index 86f0e6b..4650593 100644 --- a/demo/source/initdat.c +++ b/demo/source/initdat.c @@ -3,8 +3,8 @@ #include <ax/gfx.h> void axd_initdat(axd_dat * const _dat) { - _dat->col = 0x2u; - _dat->pos.x = 0x0u; - _dat->pos.y = 0x0u; + _dat->col = 0x4u; + _dat->pos.x = 0x1u; + _dat->pos.y = 0x1u; _dat->vaddr = 0x600'0000u; } diff --git a/demo/source/initgfx.c b/demo/source/initgfx.c index 342bf20..14ea24f 100644 --- a/demo/source/initgfx.c +++ b/demo/source/initgfx.c @@ -2,15 +2,28 @@ #include <ax/gfx.h> +static_assert(ax_col(0x1Fu,0x0u,0x0u) == 0b000000000011111u); +static_assert(ax_col(0x0u,0x1Fu,0x0u) == 0b000001111100000u); +static_assert(ax_col(0x0u,0x0u,0x1Fu) == 0b111110000000000u); + void axd_initgfx(void) { - ax_set10(0x500'0000u,0b000000000000000u); - ax_set10(0x500'0002u,0b111111111111111u); - ax_set10(0x500'0004u,0b000000000011111u); - ax_set10(0x500'0006u,0b00001111111111u); - ax_set10(0x500'0008u,0b00001111100000u); - ax_set10(0x500'000Au,0b111111111100000u); - ax_set10(0x500'000Cu,0b111110000000000u); - ax_set10(0x500'000Eu,0b111110000011111u); + 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'A000u,0x0u); + ax_clrscrn1(0x600'0000u,0x0u); } diff --git a/demo/source/loop.c b/demo/source/loop.c index c5f88c6..65779fa 100644 --- a/demo/source/loop.c +++ b/demo/source/loop.c @@ -6,7 +6,8 @@ bool axd_loop(axd_dat * const _dat) { bool err = false; _dat->prevcol = 0x0u; - ax_plot1(_dat->vaddr,ax_coord3(_dat->pos.x,_dat->pos.y),0x1u); + axd_setcolbdr(_dat->vaddr,_dat->col); + ax_plot1(_dat->vaddr,ax_coord(ax_scrnw3,_dat->pos.x,_dat->pos.y),0x4u); for (;;) { _dat->prevpos = _dat->pos; axd_upd const upd = axd_chkkeys(_dat); @@ -17,12 +18,12 @@ bool axd_loop(axd_dat * const _dat) { ax_vsync(); if (upd.drw) { _dat->prevcol = _dat->col; - if (upd.mv) {ax_plot1(_dat->vaddr,ax_coord3(_dat->pos.x,_dat->pos.y),_dat->col);} + if (upd.mv) {ax_plot1(_dat->vaddr,ax_coord(ax_scrnw3,_dat->pos.x,_dat->pos.y),_dat->col);} } if (upd.mv) { - ax_plot1(_dat->vaddr,ax_coord3(_dat->prevpos.x,_dat->prevpos.y),_dat->prevcol); - _dat->prevcol = ax_rd1(_dat->vaddr,ax_coord3(_dat->pos.x,_dat->pos.y)); - ax_plot1(_dat->vaddr,ax_coord3(_dat->pos.x,_dat->pos.y),0x1u); + ax_plot1(_dat->vaddr,ax_coord(ax_scrnw3,_dat->prevpos.x,_dat->prevpos.y),_dat->prevcol); + _dat->prevcol = ax_rd1(_dat->vaddr,ax_coord(ax_scrnw3,_dat->pos.x,_dat->pos.y)); + ax_plot1(_dat->vaddr,ax_coord(ax_scrnw3,_dat->pos.x,_dat->pos.y),0x4u); } } return err; diff --git a/demo/source/main.c b/demo/source/main.c deleted file mode 100644 index ca31e5c..0000000 --- a/demo/source/main.c +++ /dev/null @@ -1,19 +0,0 @@ -#include <agbx-demo.h> - -#include <ax/key.h> -#include <ax/gfx.h> - -ax_err ax_main(void) { - axd_dat dat; - axd_initdat(&dat); - axd_initgfx(); - bool const err = axd_loop(&dat); - if (err) { - for (ax_i01 px = 0x0u;px != 0x9600u;++px) { - ax_plot1(dat.vaddr,px,dat.col); - axd_chgcol(&dat,0x1u); - } - return ax_err_max; - } - return ax_err_ok; -} diff --git a/demo/source/setcolbdr.c b/demo/source/setcolbdr.c new file mode 100644 index 0000000..1173d55 --- /dev/null +++ b/demo/source/setcolbdr.c @@ -0,0 +1,18 @@ +#include <agbx-demo.h> + +#include <ax/gfx.h> + +void axd_setcolbdr(ax_i02 const _vaddr,ax_i01 const _col) { + for (ax_i01 px = 0x0u;px != 0xF0u;++px) { + ax_plot1(_vaddr,px,_col); + } + for (ax_i01 px = 0xEFu;px != ax_scrnh3 * ax_scrnw3 + 0xEFu;px += ax_scrnw3) { + ax_plot1(_vaddr,px,_col); + } + for (ax_i01 px = 0x9Fu * ax_scrnw3;px != 0x9Fu * ax_scrnw3 + 0xF0u;++px) { + ax_plot1(_vaddr,px,_col); + } + for (ax_i01 px = 0x0u;px != ax_scrnh3 * ax_scrnw3;px += ax_scrnw3) { + ax_plot1(_vaddr,px,_col); + } +} diff --git a/demo/source/start.c b/demo/source/start.c new file mode 100644 index 0000000..15da8f6 --- /dev/null +++ b/demo/source/start.c @@ -0,0 +1,65 @@ +#include <agbx-demo.h> + +#include <ax/key.h> +#include <ax/gfx.h> + +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,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, + + 0x04u,0x00u, 0x04u,0x04u,0x04u,0x04u,0x04u,0x04u,0x00u, 0x00u, 0x04u,0x04u,0x04u,0x04u,0x04u,0x04u,0x04u, 0x00u, 0x04u,0x04u,0x00u,0x00u,0x00u,0x04u,0x04u, 0x00u, 0x00u,0x04u,0x04u,0x04u,0x04u,0x04u,0x00u, 0x00u,0x04u, + 0x04u,0x00u, 0x04u,0x03u,0x03u,0x03u,0x03u,0x02u,0x02u, 0x00u, 0x04u,0x02u,0x02u,0x02u,0x02u,0x02u,0x02u, 0x00u, 0x04u,0x03u,0x04u,0x00u,0x04u,0x03u,0x02u, 0x00u, 0x04u,0x04u,0x03u,0x03u,0x03u,0x02u,0x02u, 0x00u,0x04u, + 0x04u,0x00u, 0x04u,0x03u,0x00u,0x00u,0x00u,0x03u,0x02u, 0x00u, 0x04u,0x02u,0x00u,0x00u,0x00u,0x00u,0x00u, 0x00u, 0x04u,0x02u,0x02u,0x04u,0x02u,0x03u,0x02u, 0x00u, 0x04u,0x03u,0x00u,0x00u,0x00u,0x03u,0x02u, 0x00u,0x04u, + 0x04u,0x00u, 0x04u,0x03u,0x00u,0x00u,0x00u,0x03u,0x02u, 0x00u, 0x04u,0x02u,0x02u,0x02u,0x00u,0x00u,0x00u, 0x00u, 0x04u,0x02u,0x00u,0x02u,0x00u,0x03u,0x02u, 0x00u, 0x04u,0x03u,0x00u,0x00u,0x00u,0x03u,0x02u, 0x00u,0x04u, + 0x04u,0x00u, 0x04u,0x03u,0x00u,0x00u,0x00u,0x03u,0x02u, 0x00u, 0x04u,0x02u,0x00u,0x00u,0x00u,0x00u,0x00u, 0x00u, 0x04u,0x02u,0x00u,0x00u,0x00u,0x03u,0x02u, 0x00u, 0x04u,0x03u,0x00u,0x00u,0x00u,0x03u,0x02u, 0x00u,0x04u, + 0x04u,0x00u, 0x04u,0x03u,0x03u,0x03u,0x03u,0x02u,0x02u, 0x00u, 0x04u,0x03u,0x03u,0x03u,0x03u,0x03u,0x02u, 0x00u, 0x04u,0x02u,0x00u,0x00u,0x00u,0x03u,0x02u, 0x00u, 0x04u,0x02u,0x03u,0x03u,0x03u,0x02u,0x02u, 0x00u,0x04u, + 0x04u,0x00u, 0x04u,0x02u,0x02u,0x02u,0x02u,0x02u,0x00u, 0x00u, 0x04u,0x02u,0x02u,0x02u,0x02u,0x02u,0x02u, 0x00u, 0x04u,0x02u,0x00u,0x00u,0x00u,0x02u,0x02u, 0x00u, 0x00u,0x02u,0x02u,0x02u,0x02u,0x02u,0x00u, 0x00u,0x04u, + + 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, + 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, 0x04u,0x04u, +}; + +constexpr ax_i8 axd_logow = (0x7u * 0x4u) + (0x2u * 0x2u) + (0x1u * 0x3u); +constexpr ax_i8 axd_logoh = (0x7u * 0x2u) + (0x2u * 0x2u) + (0x2u); + +static_assert(sizeof (axd_logo) == axd_logow * axd_logoh); + +ax_err ax_start(void) { + axd_dat dat; + axd_initdat(&dat); + axd_initgfx(); + 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); + for (;;) { + ax_keymap const keymap = ax_getkeymap(); + if (ax_chkkey(keymap,ax_key_a)) { + break; + } + } + for (;;) { /* Wait for the key to become released. */ + ax_keymap const keymap = ax_getkeymap(); + if (!ax_chkkey(keymap,ax_key_a)) { + break; + } + } + ax_clrscrn1(dat.vaddr,0x0u); + bool const err = axd_loop(&dat); + if (err) { + for (ax_i01 px = 0x0u;px != 0x9600u;++px) { + ax_plot1(dat.vaddr,px,dat.col); + axd_chgcol(&dat,0x1u); + } + return ax_err_max; + } + return ax_err_ok; +} |