summaryrefslogtreecommitdiff
path: root/macros.asm
diff options
context:
space:
mode:
authoryenatch <yenatch@gmail.com>2014-05-05 15:58:43 -0400
committeryenatch <yenatch@gmail.com>2014-05-05 15:58:43 -0400
commitddc88bed4bab836b04ae11f0404baa03d001d3df (patch)
treefc3e8b859e4c7e63a3c950461f7fa851d3c8bfee /macros.asm
parent2a2b5d7f23fc4b0beda9ae9ab084d145c7690953 (diff)
Use a macro for sine waves.
So far they're identical, but amplitude could change.
Diffstat (limited to 'macros.asm')
-rw-r--r--macros.asm11
1 files changed, 11 insertions, 0 deletions
diff --git a/macros.asm b/macros.asm
index a35b833df..a9948ae6a 100644
--- a/macros.asm
+++ b/macros.asm
@@ -191,3 +191,14 @@ ENDC
ENDM
+sine_wave: MACRO
+; \1: amplitude
+
+x = 0
+ rept $20
+ ; Round up.
+ dw (sin(x) + (sin(x) & $ff)) >> 8
+x = x + \1 * $40000
+ endr
+ENDM
+