From 23bb05851b0f71ca7cf9277d46f09e799986350d Mon Sep 17 00:00:00 2001 From: yenatch Date: Tue, 3 Sep 2013 18:40:12 -0400 Subject: [PATCH] split Sine/Cosine into engine/sine.asm --- engine/sine.asm | 22 ++++++++++++++++++++++ main.asm | 25 +------------------------ 2 files changed, 23 insertions(+), 24 deletions(-) create mode 100644 engine/sine.asm diff --git a/engine/sine.asm b/engine/sine.asm new file mode 100644 index 000000000..09d06ca89 --- /dev/null +++ b/engine/sine.asm @@ -0,0 +1,22 @@ +Cosine: ; 1b0f +; Return d * cos(a) in hl + add $10 ; 90 degrees + +Sine: ; 1b11 +; Return d * sin(a) in hl +; a is a signed 6-bit value. + + ld e, a + + ld a, [hROMBank] + push af + ld a, BANK(_Sine) + rst Bankswitch + + call _Sine + + pop af + rst Bankswitch + ret +; 1b1e + diff --git a/main.asm b/main.asm index 85a981024..d54647474 100644 --- a/main.asm +++ b/main.asm @@ -29,30 +29,7 @@ INCLUDE "engine/copy.asm" INCLUDE "engine/text.asm" INCLUDE "engine/video.asm" INCLUDE "engine/map_objects.asm" - - -Cosine: ; 1b0f -; Return d * cos(a) in hl - add $10 ; 90 degrees - -Sine: ; 1b11 -; Return d * sin(a) in hl -; a is a signed 6-bit value. - - ld e, a - - ld a, [hROMBank] - push af - ld a, BANK(_Sine) - rst Bankswitch - - call _Sine - - pop af - rst Bankswitch - ret -; 1b1e - +INCLUDE "engine/sine.asm" Function1b1e: ; 1b1e ld [$d003], a