diff options
| author | Rangi <remy.oukaour+rangi42@gmail.com> | 2018-02-03 13:26:34 -0500 | 
|---|---|---|
| committer | Rangi <remy.oukaour+rangi42@gmail.com> | 2018-02-03 13:26:34 -0500 | 
| commit | b0d84c64a696b2525ba6aac846989eae661b1d67 (patch) | |
| tree | e6f881e74f311adbb1a7fe344026803e115fe327 /macros | |
| parent | d11cac9e833a9c2188415cfeb6de7d4687336c2f (diff) | |
Use fixed-point DIV function for a generalized sine_wave table macro
Diffstat (limited to 'macros')
| -rw-r--r-- | macros/code.asm | 4 | ||||
| -rw-r--r-- | macros/data.asm | 5 | 
2 files changed, 5 insertions, 4 deletions
| diff --git a/macros/code.asm b/macros/code.asm index 799c27d45..0b36f6c11 100644 --- a/macros/code.asm +++ b/macros/code.asm @@ -41,8 +41,8 @@ maskbits: MACRO  ; example usage in rejection sampling:  ; .loop  ; 	call Random -; 	maskbits 30 -; 	cp 30 +; 	maskbits 26 +; 	cp 26  ; 	jr nc, .loop  x = 1  rept 8 diff --git a/macros/data.asm b/macros/data.asm index 1543e601d..8adb33005 100644 --- a/macros/data.asm +++ b/macros/data.asm @@ -112,10 +112,11 @@ ENDM  sine_wave: MACRO -x = 0.0 +; \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 + 1024.0 ; a circle has 65536.0 "degrees" +x = x + DIV(32768, \1) ; a circle has 65536 "degrees"  endr  ENDM | 
