summaryrefslogtreecommitdiff
path: root/agbx/source
diff options
context:
space:
mode:
Diffstat (limited to 'agbx/source')
-rw-r--r--agbx/source/bs/done.c22
-rw-r--r--agbx/source/bs/get.s39
-rw-r--r--agbx/source/bs/set.s39
-rw-r--r--agbx/source/gfx/clrscrn.cc23
-rw-r--r--agbx/source/gfx/flip.s39
-rw-r--r--agbx/source/gfx/getvbnk.s62
-rw-r--r--agbx/source/gfx/plot.c31
-rw-r--r--agbx/source/gfx/plottex.cc29
-rw-r--r--agbx/source/gfx/rd.s32
-rw-r--r--agbx/source/gfx/vsync.s37
-rw-r--r--agbx/source/key/getkeymap.s27
-rw-r--r--agbx/source/priv/init.s25
12 files changed, 0 insertions, 405 deletions
diff --git a/agbx/source/bs/done.c b/agbx/source/bs/done.c
deleted file mode 100644
index 17b55c6..0000000
--- a/agbx/source/bs/done.c
+++ /dev/null
@@ -1,22 +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>.
-*/
-
-#include <ax/priv.h>
-
-#include <ax/gfx.h>
-
-void ax_done(ax_err const _err) {
- if (_err == ax_err_ok) {
- __asm__ (
- "svc 0x3\n"
- );
- __builtin_unreachable();
- }
- __asm__ (
- "svc 0x2\n"
- );
- for (;;) {}
-}
diff --git a/agbx/source/bs/get.s b/agbx/source/bs/get.s
deleted file mode 100644
index a936f73..0000000
--- a/agbx/source/bs/get.s
+++ /dev/null
@@ -1,39 +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>.
-
-.syntax unified
-
-.cpu arm7tdmi
-.thumb
-
-.globl ax_get10
-.globl ax_get20
-.globl ax_get8
-
-.func
-.thumb_func
-
-ax_get10:
- ldrh r0,[r0] @ ax_i01 val = *(ax_i01 *)addr;
- bx lr @ return val;
-
-.endfunc
-
-.func
-.thumb_func
-
-ax_get20:
- ldr r0,[r0] @ ax_i02 val = *(ax_i02 *)addr;
- bx lr @ return val;
-
-.endfunc
-
-.func
-.thumb_func
-
-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
deleted file mode 100644
index 1719be6..0000000
--- a/agbx/source/bs/set.s
+++ /dev/null
@@ -1,39 +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>.
-
-.syntax unified
-
-.cpu arm7tdmi
-.thumb
-
-.globl ax_set10
-.globl ax_set20
-.globl ax_set8
-
-.func
-.thumb_func
-
-ax_set10:
- strh r1,[r0] @ *(ax_i01 *)addr = val;
- bx lr @ return;
-
-.endfunc
-
-.func
-.thumb_func
-
-ax_set20:
- str r1,[r0] @ *(ax_i02 *)addr = val;
- bx lr @ return;
-
-.endfunc
-
-.func
-.thumb_func
-
-ax_set8:
- strb r1,[r0] @ *(ax_i8 *)addr = val;
- bx lr @ return;
-
-.endfunc
diff --git a/agbx/source/gfx/clrscrn.cc b/agbx/source/gfx/clrscrn.cc
deleted file mode 100644
index 8f27268..0000000
--- a/agbx/source/gfx/clrscrn.cc
+++ /dev/null
@@ -1,23 +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>.
-*/
-
-#include <ax/priv.h>
-
-#include <ax/gfx.h>
-
-template<typename _pxtyp> [[gnu::always_inline]] inline static auto __ax_clrscrn(::ax_i02 const _vaddr,_pxtyp const _col) noexcept -> void {
- static_assert(::__ax_typeq<_pxtyp,::ax_i8> || ::__ax_typeq<_pxtyp,::ax_i01>);
- ::ax_i02 const val = [&_col] {
- if constexpr (::__ax_typeq<_pxtyp,::ax_i01>) {
- return (ax_i02)_col | (ax_i02)_col << 0x10u;
- }
- return (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);}
-}
-
-extern "C" auto ax_clrscrn1(::ax_i02 const _vaddr,::ax_i8 const _col) -> void {::__ax_clrscrn(_vaddr,_col);}
-extern "C" auto ax_clrscrn2(::ax_i02 const _vaddr,::ax_i01 const _col) -> void {::__ax_clrscrn(_vaddr,_col);}
diff --git a/agbx/source/gfx/flip.s b/agbx/source/gfx/flip.s
deleted file mode 100644
index 887377d..0000000
--- a/agbx/source/gfx/flip.s
+++ /dev/null
@@ -1,39 +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>.
-
-.syntax unified
-
-.cpu arm7tdmi
-.thumb
-
-.extern __ax_getvbnk
-
-.globl ax_flip
-
-.func
-.thumb_func
-
-ax_flip:
- @ Get the current value of dispcnt:
- 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_i01 *)dispcntaddr = dispcnt;
-
- @ Get the address of the video bank:
- b __ax_getvbnk @ ax_i02 vaddr = __ax_getvbnk();
-
- bx lr @ return vaddr;
-
-.endfunc
-
-.align
-
-.dispcntaddr:
- .long 0x4000000
diff --git a/agbx/source/gfx/getvbnk.s b/agbx/source/gfx/getvbnk.s
deleted file mode 100644
index d3dcbcf..0000000
--- a/agbx/source/gfx/getvbnk.s
+++ /dev/null
@@ -1,62 +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>.
-
-.syntax unified
-
-.cpu arm7tdmi
-.thumb
-
-.globl __ax_getvbnk
-.globl ax_getvbnk
-
-.func
-.thumb_func
-
-ax_getvbnk:
- @ Get the current value of dispcnt:
- ldr r0,.dispcntaddr @ ax_i02 dispcntaddr = 0x4000000u;
- ldrh r1,[r0] @ ax_i01 dispcnt = *(ax_i01 *)dispcntaddr;
-
- @ Get the address:
- b __ax_getvbnk @ ax_i02 vaddr = __ax_getvbnk();
-
- bx lr @ return vaddr;
-
-.endfunc
-
-.func
-.thumb_func
-
-__ax_getvbnk: @ Takes the value of dispcnt in r1.
- @ Check if the fifth bit is set:
- movs r0,0b10000
- tst r1,r0
- beq .vbnk1
-
-.vbnk0:
- @ Return the address of the first video bank:
- ldr r0,.vbnk0addr
- bx lr
-
-.vbnk1:
- @ Return the address of the second video bank:
- ldr r0,.vbnk1addr
- bx lr
-
-.endfunc
-
-.align
-
-.dispcntaddr:
- .long 0x4000000
-
-.align
-
-.vbnk0addr:
- .long 0x6000000
-
-.align
-
-.vbnk1addr:
- .long 0x600A000
diff --git a/agbx/source/gfx/plot.c b/agbx/source/gfx/plot.c
deleted file mode 100644
index 066b97e..0000000
--- a/agbx/source/gfx/plot.c
+++ /dev/null
@@ -1,31 +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>.
-*/
-
-#include <ax/priv.h>
-
-#include <ax/gfx.h>
-
-void ax_plot1(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_i02 addr = _vaddr + _px - odd;
- ax_i01 precol = __ax_get10(addr);
- ax_i01 col = _col;
- if (odd) {
- precol &= 0b11111111u;
- col <<= 0x8u;
- }
- else {
- precol &= 0b1111111100000000u;
- }
- ax_i01 const newcol = precol | col;
- __ax_set10(addr,newcol);
-}
-
-void ax_plot2(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/plottex.cc b/agbx/source/gfx/plottex.cc
deleted file mode 100644
index 836a6ff..0000000
--- a/agbx/source/gfx/plottex.cc
+++ /dev/null
@@ -1,29 +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>.
-*/
-
-#include <ax/priv.h>
-
-#include <ax/gfx.h>
-
-template<typename _pxtyp> [[gnu::always_inline]] inline static auto __ax_plottex(::ax_i02 const _vaddr,::ax_i8 const _scrnw,_pxtyp const * const _tex,::ax_i01 const _px,::ax_i8 const _w,::ax_i8 const _h) noexcept -> void {
- static_assert(::__ax_typeq<_pxtyp,::ax_i8> || ::__ax_typeq<_pxtyp,::ax_i01>);
- _pxtyp const * texpos = _tex;
- for (::ax_i01 px = _px;px != _px + _h * _scrnw;) {
- ::ax_i01 const rowstart = px;
- for (;px != rowstart + _w;++px) {
- if constexpr (::__ax_typeq<_pxtyp,::ax_i01>) {
- ax_plot2(_vaddr,px,*(texpos++));
- }
- else {
- ax_plot1(_vaddr,px,*(texpos++));
- }
- }
- px = rowstart + _scrnw;
- }
-}
-
-extern "C" auto ax_plottex1(::ax_i02 const _vaddr,::ax_i8 const _scrnw,::ax_i8 const * const _tex,::ax_i01 const _px,::ax_i8 const _w,::ax_i8 const _h) -> void {::__ax_plottex(_vaddr,_scrnw,_tex,_px,_w,_h);}
-extern "C" auto ax_plottex2(::ax_i02 const _vaddr,::ax_i8 const _scrnw,::ax_i01 const * const _tex,::ax_i01 const _px,::ax_i8 const _w,::ax_i8 const _h) -> void {::__ax_plottex(_vaddr,_scrnw,_tex,_px,_w,_h);}
diff --git a/agbx/source/gfx/rd.s b/agbx/source/gfx/rd.s
deleted file mode 100644
index 6662848..0000000
--- a/agbx/source/gfx/rd.s
+++ /dev/null
@@ -1,32 +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>.
-
-.syntax unified
-
-.cpu arm7tdmi
-.thumb
-
-.globl ax_rd1
-.globl ax_rd2
-
-.func
-.thumb_func
-
-ax_rd1:
- adds r0,r1 @ Get the address of the pixel by adding the offset to the video address.
- ldrh r0,[r0]
- bx lr
-
-.endfunc
-
-.func
-.thumb_func
-
-ax_rd2:
- 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]
- bx lr
-
-.endfunc
diff --git a/agbx/source/gfx/vsync.s b/agbx/source/gfx/vsync.s
deleted file mode 100644
index e16724f..0000000
--- a/agbx/source/gfx/vsync.s
+++ /dev/null
@@ -1,37 +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>.
-
-.syntax unified
-
-.cpu arm7tdmi
-.thumb
-
-.globl ax_vsync
-
-.func
-.thumb_func
-
-ax_vsync:
- @ Set the constants:
- ldr r0,.vcountaddr @ ax_i02 vcountaddr = 0x4000006u;
- movs r1,0xA0 @ ax_i02 numhline = 0xA0;
-
-.loop:
- @ Check the scanline counter:
- ldrh r2,[r0] @ ax_i02 vcount = *(ax_i01 *)vcountaddr;
- cmp r2,r1
- beq .ret @ if (vcount == numhline) {goto ret;}
-
- b .loop @ goto loop;
-
-.ret:
- @ Return:
- bx lr @ return;
-
-.endfunc
-
-.align
-
-.vcountaddr:
- .long 0x4000006
diff --git a/agbx/source/key/getkeymap.s b/agbx/source/key/getkeymap.s
deleted file mode 100644
index 2751c9f..0000000
--- a/agbx/source/key/getkeymap.s
+++ /dev/null
@@ -1,27 +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>.
-
-.syntax unified
-
-.cpu arm7tdmi
-.thumb
-
-.globl ax_getkeymap
-
-.func
-.thumb_func
-
-ax_getkeymap:
- @ Load the keys:
- ldr r0,.addr @ ax_i02 addr = 0x4000130u;
- ldrh r0,[r0] @ ax_keymap keymap = *(ax_i01 *)addr;
-
- bx lr @ return keymap;
-
-.endfunc
-
-.align
-
-.addr:
- .long 0x4000130
diff --git a/agbx/source/priv/init.s b/agbx/source/priv/init.s
deleted file mode 100644
index 718638d..0000000
--- a/agbx/source/priv/init.s
+++ /dev/null
@@ -1,25 +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>.
-
-.syntax unified
-
-.cpu arm7tdmi
-.thumb
-
-.extern ax_done
-.extern ax_start
-
-.globl __ax_init
-
-.func
-.thumb_func
-
-__ax_init:
- @ Call main:
- bl ax_start
-
- @ Call done:
- bl ax_done @ The return value is already in r0, so there's no need to move it.
-
-.endfunc