Commit 4459c5a5 authored by PoroCYon's avatar PoroCYon
Browse files

fix typedefs conflicting with libgba, use libgba's Div BIOS routine

Depending on whether thumb or arm is used, the snippet of inline asm
won't work (as some of it is decided in a later pass than the
preprocessor).
parent bc684261
......@@ -6,6 +6,7 @@
#ifndef PIMP_BASE_H
#define PIMP_BASE_H
#ifndef _gba_types_h_
#ifndef PIMP_DONT_DECLARE_BASIC_TYPES
typedef signed char s8;
typedef unsigned char u8;
......@@ -16,6 +17,7 @@ typedef unsigned int u32;
#endif
typedef signed long long s64;
typedef unsigned long long u64;
#endif
#include <stddef.h>
typedef size_t pimp_size_t;
......
......@@ -3,6 +3,10 @@
* For conditions of distribution and use, see copyright notice in LICENSE.TXT
*/
#ifdef TARGET_GBA
#include <gba.h>
#endif
#include "pimp_mixer.h"
#include "pimp_debug.h"
......@@ -51,21 +55,22 @@ PURE int pimp_calc_loop_event(int event_cursor, int event_delta, const int max_s
int denom = event_delta;
/* call BIOS-function to divide, as it's fast enough for our needs. */
asm (
"mov r0, %[number] \n"
"mov r1, %[denom] \n"
#ifdef __thumb__
"swi 0x6 \n"
#else
"swi 0x6 << 16 \n"
#endif
"mov %[result], r0 \n"
: [result] "=r" (result) /* output */
: /* inputs */
[number] "r" (number),
[denom] "r" (denom)
: "r0", "r1", "r2", "r3" /* clobbers */
);
result = Div(number, denom);
// asm (
// "mov r0, %[number] \n"
// "mov r1, %[denom] \n"
//#ifdef __thumb__
// "swi 0x6 \n"
//#else
// "swi 0x6 << 16 \n"
//#endif
// "mov %[result], r0 \n"
// : [result] "=r" (result) /* output */
// : /* inputs */
// [number] "r" (number),
// [denom] "r" (denom)
// : "r0", "r1", "r2", "r3" /* clobbers */
// );
}
#else
result = (event_cursor + event_delta - 1) / event_delta;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment