diff options
Diffstat (limited to 'agbx/source/gfx/setpx.c')
-rw-r--r-- | agbx/source/gfx/setpx.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/agbx/source/gfx/setpx.c b/agbx/source/gfx/setpx.c new file mode 100644 index 0000000..ace2463 --- /dev/null +++ b/agbx/source/gfx/setpx.c @@ -0,0 +1,33 @@ +/* + 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> + +void agbx_setpx1(agbx_i10 const _px,agbx_i8 const _col) { +#if defined(__agbx_dbg) + agbx_i10 const dispcnt = agbx_get10(0x4000000u); + agbx_i8 const md = dispcnt & 0x7u; + if (md == 0x3u || md == 0x5u) {agbx_done(agbx_err_badmd);} + if (_px >= 0x9600u) {agbx_done(agbx_err_px2big);} +#endif + __agbx_setpx1(_px,_col) +} + +void agbx_setpx2(agbx_i10 const _px,agbx_i10 const _col) { +#if defined(__agbx_dbg) + agbx_i10 const dispcnt = agbx_get10(0x4000000u); + agbx_i8 const md = dispcnt & 0x7u; + if (md == 0x4u) {agbx_done(agbx_err_badmd);} + if (md == 0x5u) { + if (_px >= 0x5000u) {agbx_done(agbx_err_px2big);} + } + else { + if (md != 0x3u) {agbx_done(agbx_err_badmd);} + if (_px >= 0x9600u) {agbx_done(agbx_err_px2big);} + } +#endif + __agbx_setpx2(_px,_col) +} |