summaryrefslogtreecommitdiff
path: root/engine/math
diff options
context:
space:
mode:
authorThomas Winwood <twwinwood@gmail.com>2018-07-21 02:06:31 +0100
committerGitHub <noreply@github.com>2018-07-21 02:06:31 +0100
commit23ef2f50a7b94c23b50e9e690a7482ac349c9ef3 (patch)
tree63c20c67efbdf8334c6e273f78065b83135e3886 /engine/math
parent17a4d0540acc00e3f5ad260009115eb36e72b7d2 (diff)
parent2d73d040d16a7836f935a7a6cb2a311aed2ca5a2 (diff)
Merge branch 'master' into the-diffening
Diffstat (limited to 'engine/math')
-rw-r--r--engine/math/get_square_root.asm4
-rw-r--r--engine/math/math.asm11
-rw-r--r--engine/math/print_num.asm10
-rw-r--r--engine/math/sine.asm2
4 files changed, 10 insertions, 17 deletions
diff --git a/engine/math/get_square_root.asm b/engine/math/get_square_root.asm
index 412fd04ff..6791fd7b8 100644
--- a/engine/math/get_square_root.asm
+++ b/engine/math/get_square_root.asm
@@ -1,6 +1,6 @@
NUM_SQUARE_ROOTS EQU 255
-GetSquareRoot: ; 13b87
+GetSquareRoot:
; Return the square root of de in b.
; Rather than calculating the result, we take the index of the
@@ -24,7 +24,7 @@ GetSquareRoot: ; 13b87
jr c, .loop
ret
-.Squares: ; 13b98
+.Squares:
x = 1
rept NUM_SQUARE_ROOTS
dw x * x
diff --git a/engine/math/math.asm b/engine/math/math.asm
index 0cd6b0b47..c2e5f70a3 100644
--- a/engine/math/math.asm
+++ b/engine/math/math.asm
@@ -1,5 +1,4 @@
-_Multiply:: ; 66de
-
+_Multiply::
; hMultiplier is one byte.
ld a, 8
ld b, a
@@ -11,7 +10,6 @@ _Multiply:: ; 66de
ld [hMathBuffer + 3], a
ld [hMathBuffer + 4], a
-
.loop
ld a, [hMultiplier]
srl a
@@ -46,7 +44,6 @@ _Multiply:: ; 66de
dec b
jr z, .done
-
; hMultiplicand <<= 1
ld a, [hMultiplicand + 2]
@@ -67,7 +64,6 @@ _Multiply:: ; 66de
jr .loop
-
.done
ld a, [hMathBuffer + 4]
ld [hProduct + 3], a
@@ -82,10 +78,8 @@ _Multiply:: ; 66de
ld [hProduct + 0], a
ret
-; 673e
-
-_Divide:: ; 673e
+_Divide::
xor a
ld [hMathBuffer + 0], a
ld [hMathBuffer + 1], a
@@ -193,4 +187,3 @@ _Divide:: ; 673e
ld [hDividend + 0], a
ret
-; 67c1
diff --git a/engine/math/print_num.asm b/engine/math/print_num.asm
index fec798d5c..c8899be6c 100644
--- a/engine/math/print_num.asm
+++ b/engine/math/print_num.asm
@@ -1,4 +1,4 @@
-_PrintNum:: ; c4c7
+_PrintNum::
; Print c digits of the b-byte value from de to hl.
; Allows 2 to 7 digits. For 1-digit numbers, add
; the value to char "0" instead of calling PrintNum.
@@ -178,7 +178,7 @@ _PrintNum:: ; c4c7
pop bc
ret
-.PrintYen: ; c5ba
+.PrintYen:
push af
ld a, [hPrintNum1]
and a
@@ -193,7 +193,7 @@ _PrintNum:: ; c4c7
pop af
ret
-.PrintDigit: ; c5cb (3:45cb)
+.PrintDigit:
dec e
jr nz, .ok
ld a, "0"
@@ -278,14 +278,14 @@ _PrintNum:: ; c4c7
ld [hl], "<DOT>"
ret
-.PrintLeadingZero: ; c644
+.PrintLeadingZero:
; prints a leading zero unless they are turned off in the flags
bit 7, d ; print leading zeroes?
ret z
ld [hl], "0"
ret
-.AdvancePointer: ; c64a
+.AdvancePointer:
; increments the pointer unless leading zeroes are not being printed,
; the number is left-aligned, and no nonzero digits have been printed yet
bit 7, d ; print leading zeroes?
diff --git a/engine/math/sine.asm b/engine/math/sine.asm
index 23e86c015..c7422aaf8 100644
--- a/engine/math/sine.asm
+++ b/engine/math/sine.asm
@@ -1,4 +1,4 @@
-_Sine:: ; 84d9
+_Sine::
; a = d * sin(e * pi/32)
ld a, e
calc_sine_wave