summaryrefslogtreecommitdiff
path: root/macros/data.asm
diff options
context:
space:
mode:
Diffstat (limited to 'macros/data.asm')
-rw-r--r--macros/data.asm9
1 files changed, 9 insertions, 0 deletions
diff --git a/macros/data.asm b/macros/data.asm
index fb8ea844..b5836b50 100644
--- a/macros/data.asm
+++ b/macros/data.asm
@@ -68,3 +68,12 @@ dbbw: MACRO
db \1, \2
dw \3
ENDM
+
+sine_table: MACRO
+; \1 samples of sin(x) from x=0 to x<32768 (pi radians)
+x = 0
+REPT \1
+ dw (sin(x) + (sin(x) & $ff)) >> 8 ; round up
+x = x + DIV(32768, \1) ; a circle has 65536 "degrees"
+ENDR
+ENDM