diff options
Diffstat (limited to 'agbx/source/gfx')
-rw-r--r-- | agbx/source/gfx/clrscrn.cc | 23 | ||||
-rw-r--r-- | agbx/source/gfx/flip.s | 39 | ||||
-rw-r--r-- | agbx/source/gfx/getvbnk.s | 62 | ||||
-rw-r--r-- | agbx/source/gfx/plot.c | 31 | ||||
-rw-r--r-- | agbx/source/gfx/plottex.cc | 29 | ||||
-rw-r--r-- | agbx/source/gfx/rd.s | 32 | ||||
-rw-r--r-- | agbx/source/gfx/vsync.s | 37 |
7 files changed, 0 insertions, 253 deletions
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 |