diff options
-rw-r--r-- | CHANGELOG.txt | 4 | ||||
-rw-r--r-- | ax/source/gfx/plottex.cc | 2 | ||||
-rw-r--r-- | ax/source/key/getkeymap.s | 3 | ||||
-rw-r--r-- | ax/source/priv/init.s | 9 |
4 files changed, 12 insertions, 6 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 02792c6..a887360 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,7 @@ +# A.2 + +* Fix init not exchanging instruction set when start is implemented with ARM instructions; + # A.1 * Update readme; diff --git a/ax/source/gfx/plottex.cc b/ax/source/gfx/plottex.cc index c039291..2eb0a38 100644 --- a/ax/source/gfx/plottex.cc +++ b/ax/source/gfx/plottex.cc @@ -15,7 +15,7 @@ template<typename _pxtyp> [[gnu::always_inline]] inline static auto __ax_plottex ::ax_i01 const rowstart = px; for (;px != rowstart + _w;++px) { if constexpr (::__ax_typeq<_pxtyp,::ax_i01>) { - ax_plot2(_vaddr,px,*(texpos++)); + __ax_plot2(_vaddr,px,*(texpos++)); } else { ax_plot1(_vaddr,px,*(texpos++)); diff --git a/ax/source/key/getkeymap.s b/ax/source/key/getkeymap.s index 2751c9f..6c9835c 100644 --- a/ax/source/key/getkeymap.s +++ b/ax/source/key/getkeymap.s @@ -15,8 +15,9 @@ ax_getkeymap: @ Load the keys: ldr r0,.addr @ ax_i02 addr = 0x4000130u; - ldrh r0,[r0] @ ax_keymap keymap = *(ax_i01 *)addr; + ldrh r0,[r0] @ ax_keymap keymap = {._keys = *(ax_i01 *)addr}; + @ Return: bx lr @ return keymap; .endfunc diff --git a/ax/source/priv/init.s b/ax/source/priv/init.s index 718638d..e8bd8ee 100644 --- a/ax/source/priv/init.s +++ b/ax/source/priv/init.s @@ -5,7 +5,7 @@ .syntax unified .cpu arm7tdmi -.thumb +.arm .extern ax_done .extern ax_start @@ -13,13 +13,14 @@ .globl __ax_init .func -.thumb_func __ax_init: @ Call main: - bl ax_start + ldr r0,=ax_start @ We load the address of start into a register so we can use bx to call it, allowing for the programmer to implement the function in either ARM or THUMB. This processor doesn't support blx, so we aren't able to use that instead. + mov lr,pc @ bx doesn't set the return address, so we do it ourselves. pc stores the instruction after the next one, so we don't have to apply any arithmetic on it. THUMB doesn't support using pc in a mov expression, which is why this function is ARM. + bx r0 @ Call done: - bl ax_done @ The return value is already in r0, so there's no need to move it. + bl ax_done @ The error code (returned by ax_start) is already in r0, so there's no need to move it. .endfunc |