diff options
Diffstat (limited to 'agbx/source/bs')
-rw-r--r-- | agbx/source/bs/get.c | 40 | ||||
-rw-r--r-- | agbx/source/bs/get.s | 42 | ||||
-rw-r--r-- | agbx/source/bs/set.c | 13 | ||||
-rw-r--r-- | agbx/source/bs/set.s | 42 |
4 files changed, 84 insertions, 53 deletions
diff --git a/agbx/source/bs/get.c b/agbx/source/bs/get.c deleted file mode 100644 index 38da5af..0000000 --- a/agbx/source/bs/get.c +++ /dev/null @@ -1,40 +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> - -agbx_i10 agbx_get10(agbx_i20 const _addr) { - agbx_i10 val; - __asm__ ( \ - "ldrh %0,[%1]" - : "=r" (val) - : "r" (_addr) - : "memory" - ); - return val; -} - -agbx_i20 agbx_get20(agbx_i20 const _addr) { - agbx_i20 val; - __asm__ ( \ - "ldr %0,[%1]" - : "=r" (val) - : "r" (_addr) - : "memory" - ); - return val; -} - -agbx_i8 agbx_get8(agbx_i20 const _addr) { - agbx_i8 val; - __asm__ ( \ - "ldrb %0,[%1]" - : "=r" (val) - : "r" (_addr) - : "memory" - ); - return val; -} diff --git a/agbx/source/bs/get.s b/agbx/source/bs/get.s new file mode 100644 index 0000000..dfd6453 --- /dev/null +++ b/agbx/source/bs/get.s @@ -0,0 +1,42 @@ +@ 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_get10 +.globl agbx_get20 +.globl agbx_get8 + +.func + +.thumb_func + +agbx_get10: + ldrh r0,[r0] + bx lr + +.endfunc + +.func + +.thumb_func + +agbx_get20: + ldr r0,[r0] + bx lr + +.endfunc + +.func + +.thumb_func + +agbx_get8: + ldrb r0,[r0] + bx lr + +.endfunc diff --git a/agbx/source/bs/set.c b/agbx/source/bs/set.c deleted file mode 100644 index 8aa9976..0000000 --- a/agbx/source/bs/set.c +++ /dev/null @@ -1,13 +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> - -void agbx_set10(agbx_i20 const _addr,agbx_i10 const _val) {__agbx_set10(_addr,_val)} - -void agbx_set20(agbx_i20 const _addr,agbx_i20 const _val) {__agbx_set20(_addr,_val)} - -void agbx_set8(agbx_i20 const _addr,agbx_i8 const _val) {__agbx_set8(_addr,_val)} diff --git a/agbx/source/bs/set.s b/agbx/source/bs/set.s new file mode 100644 index 0000000..93ea3b5 --- /dev/null +++ b/agbx/source/bs/set.s @@ -0,0 +1,42 @@ +@ 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_set10 +.globl agbx_set20 +.globl agbx_set8 + +.func + +.thumb_func + +agbx_set10: + strh r1,[r0] + bx lr + +.endfunc + +.func + +.thumb_func + +agbx_set20: + str r1,[r0] + bx lr + +.endfunc + +.func + +.thumb_func + +agbx_set8: + strb r1,[r0] + bx lr + +.endfunc |