From 3a97ec326ceba86c7afd3b3f92ef3b308beea835 Mon Sep 17 00:00:00 2001 From: Rangi Date: Sun, 18 Apr 2021 15:51:07 -0400 Subject: Use pokecrystal's sine_table macro --- macros/data.asm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'macros/data.asm') diff --git a/macros/data.asm b/macros/data.asm index f9274392..b5836b50 100644 --- a/macros/data.asm +++ b/macros/data.asm @@ -69,11 +69,11 @@ dbbw: MACRO dw \3 ENDM -sine_wave: MACRO -; \1: amplitude +sine_table: MACRO +; \1 samples of sin(x) from x=0 to x<32768 (pi radians) x = 0 -REPT $20 +REPT \1 dw (sin(x) + (sin(x) & $ff)) >> 8 ; round up -x = x + (\1) * $40000 +x = x + DIV(32768, \1) ; a circle has 65536 "degrees" ENDR ENDM -- cgit v1.3.1-sl0p