diff options
-rw-r--r-- | CHANGELOG.txt | 5 | ||||
-rw-r--r-- | README.html | 2 | ||||
-rw-r--r-- | agbx/source/gfx/getpx.c | 19 | ||||
-rw-r--r-- | agbx/source/gfx/getpx.s | 34 | ||||
-rw-r--r-- | agbx/source/gfx/setpx.c | 2 |
5 files changed, 41 insertions, 21 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 2e3ba35..1cbd842 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,8 @@ +# 4.2 + +* Update readme; +* Implement getpx in assembly; + # 4.1 * Update readme; diff --git a/README.html b/README.html index 70ea256..33b26f2 100644 --- a/README.html +++ b/README.html @@ -4,7 +4,7 @@ <p>Framework for development on the Game Boy Advance.</p> <h2>Features</h2> <p>The goal of this project is to provide a modern, standard-compliant C library for developing games and other types of software for the Game Boy Advance series.</p> - <p>This project is still – relatively – early in development; Don't expect too much of it.</p> + <p>This project is still (relatively) early in development; Don't expect too much of it.</p> <p>Current features include:</p> <ul> <li> diff --git a/agbx/source/gfx/getpx.c b/agbx/source/gfx/getpx.c deleted file mode 100644 index 5d24db4..0000000 --- a/agbx/source/gfx/getpx.c +++ /dev/null @@ -1,19 +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 <agbx/priv.h> - -#include <agbx/gfx.h> - -agbx_i8 agbx_getpx1(agbx_i20 const _vaddr,agbx_i10 const _px) { - agbx_i20 const addr = _vaddr + _px; - return __agbx_get8(addr); -} - -agbx_i10 agbx_getpx2(agbx_i20 const _vaddr,agbx_i10 const _px) { - agbx_i20 const addr = _vaddr + _px * 0x2u; - return __agbx_get8(addr); -} diff --git a/agbx/source/gfx/getpx.s b/agbx/source/gfx/getpx.s new file mode 100644 index 0000000..f583b56 --- /dev/null +++ b/agbx/source/gfx/getpx.s @@ -0,0 +1,34 @@ +@ 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 agbx_getpx1 +.globl agbx_getpx2 + +.func + +.thumb_func + +agbx_getpx1: + 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 + +agbx_getpx2: + 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/setpx.c b/agbx/source/gfx/setpx.c index df3f0de..e478603 100644 --- a/agbx/source/gfx/setpx.c +++ b/agbx/source/gfx/setpx.c @@ -9,7 +9,7 @@ #include <agbx/gfx.h> void agbx_setpx1(agbx_i20 const _vaddr,agbx_i10 const _px,agbx_i8 const _col) { - /* We can only write halfwords to VRAM, so we load the adjacent pixel value and combine it into a halfword. */ + /* We can only write halfwords to VRAM, so we need to load the adjacent pixel value and combine it into a halfword. */ agbx_i20 const addr = _vaddr + _px - (_px & 0x1u) * 0x1u; agbx_i10 col; if (_px & 0x1u) {col = (agbx_i10)agbx_get8(addr) | (agbx_i10)_col << 0x8u;} |