Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef _STD_MATH_H
- #define _STD_MATH_H
- ;std/math.h
- ;(include "math.asm" somewhere if you want to actually use this)
- ;available defines of MATH_USE_x:
- ;MATH_USE_ALL (auto-defines everything else)
- ;MATH_USE_ADD
- ;MATH_USE_SIN
- #include "pseudoOps.h"
- #ifdef MATH_USE_ALL
- #ifndef MATH_USE_ADD
- #define MATH_USE_ADD
- #endif
- #ifndef MATH_USE_SIN
- #define MATH_USE_SIN
- #endif
- #endif
- ;used to actually call the math subroutines
- #ifdef MATH_USE_ADD
- #define add8s_16(_d,_val, _ptrA) \
- lda _d,(_val) && ldc_imm(_ptrA) &&\
- stc_abs(math_ptrA) &&\
- l1call_abs_s(_add8s_16)
- #define add16_16(_ptrA,_ptrB) \
- ldc_imm(_ptrA) && stc_abs(math_ptrA) &&\
- ldc_imm(_ptrB) &&\
- stc_abs(math_ptrB) &&\
- l1call_abs_s(_add16_16)
- #endif
- #ifdef MATH_USE_SIN
- ;this computes sin by grabbing from sin_table
- ;(requires sin256_8.bin)
- #define sin8_i_shift(_shft) \
- lda @,sin_table &&\
- shr(#,_shft) && sta $,_SCRATCH_C &&\
- and #,0x80>>_shft && bnz @+2+3 &&\
- lda #,0 && jmp @+3+2 &&\
- lda #,_l(0xff00>>_shft) &&\
- ora_abs(_SCRATCH_C)
- #endif
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement