diff options
Diffstat (limited to 'arm9/source/devices/math.h')
-rw-r--r-- | arm9/source/devices/math.h | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/arm9/source/devices/math.h b/arm9/source/devices/math.h index ae52a10..6b173b6 100644 --- a/arm9/source/devices/math.h +++ b/arm9/source/devices/math.h @@ -1,19 +1,33 @@ #ifndef MATH_H_ #define MATH_H_ + #include <math.h> + #include "../bang.h" + + + // Bedrock math device. typedef struct { - u16 op1, op2; - u16 sqrt, atan; u32 prod; u16 quot, rem; // read - bool sqrt_rc, atan_rc, prod_rc, quot_rc, rem_rc; // read cached - } MathDevice ; + s16 x, y; // Cartesian write + u16 r, t; // Polar write + s16 x_read, y_read; // Cartesian read + bool x_cached, y_cached; // Cartesian cached + u16 r_read, t_read; // Polar read + bool r_cached, t_cached; // Polar cached + u32 prod_read; // Multiplication read + bool prod_cached; // Multiplication cached + u16 quot_read, rem_read; // Division read + bool quot_cached, rem_cached; // Division cached + } MathDevice; - void set_op1_high(MathDevice *math, u8 high); - void set_op1_low(MathDevice *math, u8 low); - void set_op2_high(MathDevice *math, u8 high); - void set_op2_low(MathDevice *math, u8 low); - u16 get_sqrt(MathDevice *math); - u16 get_atan(MathDevice *math); - u32 get_prod(MathDevice *math); - u16 get_quot(MathDevice *math); - u16 get_rem(MathDevice *math); + // Methods. + void math_reset(MathDevice *math); + void math_clear_cartesian(MathDevice *math); + void math_clear_polar(MathDevice *math); + s16 math_get_x(MathDevice *math); + s16 math_get_y(MathDevice *math); + u16 math_get_r(MathDevice *math); + u16 math_get_t(MathDevice *math); + u32 math_get_prod(MathDevice *math); + u16 math_get_quot(MathDevice *math); + u16 math_get_rem(MathDevice *math); #endif |