summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Huderle <huderlem@gmail.com>2017-09-13 18:08:08 -0700
committerMarcus Huderle <huderlem@gmail.com>2017-09-13 18:08:08 -0700
commitb30ac0c5f2bd5b840424dc6b41bcf2f0c4524064 (patch)
treef274a0db1bd002c172d23dbc511823674499dc76
parentf2d839a1f498ff22ecb239bfc4d7c2752a652afd (diff)
Properly name the ancient-Egyptian-style multiplication routine
-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