summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--home.asm5
-rw-r--r--home/random.asm2
2 files changed, 4 insertions, 3 deletions
diff --git a/home.asm b/home.asm
index 34e2058..a0aead2 100644
--- a/home.asm
+++ b/home.asm
@@ -785,9 +785,10 @@ INCLUDE "home/random.asm"
INCLUDE "home/joypad.asm"
INCLUDE "home/palettes.asm"
-HorrendousMultiplyAbyL: ; 0xdd4
+MultiplyAbyL_AncientEgyptian: ; 0xdd4
; Return a * l to hl
-; Stupid waste of space
+; This is a constant-time multiplication algorithm that uses binary decomposition to achieve the result.
+; See https://en.wikipedia.org/wiki/Ancient_Egyptian_multiplication
push bc
ld c, l
ld b, $0
diff --git a/home/random.asm b/home/random.asm
index ce34f69..c532ec5 100644
--- a/home/random.asm
+++ b/home/random.asm
@@ -119,7 +119,7 @@ RandomRange: ; 0xa21
add hl, bc
ld l, [hl]
call GenRandom
- call HorrendousMultiplyAbyL
+ call MultiplyAbyL_AncientEgyptian
inc h
srl h
ld a, h