diff options
Diffstat (limited to 'engine/routines/sine.asm')
-rwxr-xr-x | engine/routines/sine.asm | 48 |
1 files changed, 2 insertions, 46 deletions
diff --git a/engine/routines/sine.asm b/engine/routines/sine.asm index 1b2b8f2f3..23e86c015 100755 --- a/engine/routines/sine.asm +++ b/engine/routines/sine.asm @@ -1,48 +1,4 @@ _Sine:: ; 84d9 -; A simple sine function. -; Return d * sin(e) in hl. - -; e is a signed 6-bit value. +; a = d * sin(e * pi/32) ld a, e - and %111111 - cp %100000 - jr nc, .negative - call .ApplySineWave - ld a, h - ret - -.negative - and %011111 - call .ApplySineWave - ld a, h - xor $ff - inc a - ret - -.ApplySineWave: ; 84ef - ld e, a - ld a, d - ld d, 0 - ld hl, .sinewave - add hl, de - add hl, de - ld e, [hl] - inc hl - ld d, [hl] - ld hl, 0 -; Factor amplitude -.multiply - srl a - jr nc, .even - add hl, de -.even - sla e - rl d - and a - jr nz, .multiply - ret - -.sinewave ; 850b -; A 32-word table representing a sine wave. -; sin(90 degrees) is index $10 with an amplitude of $100. - sine_wave 32 + calc_sine_wave |