From 5407d8de920b779d760d88153d8e314a687d100e Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Tue, 16 Jan 2018 17:59:05 -0500 Subject: =?UTF-8?q?Cleaner=20Pok=C3=A9dex=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- engine/routines/getsquareroot.asm | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'engine/routines/getsquareroot.asm') diff --git a/engine/routines/getsquareroot.asm b/engine/routines/getsquareroot.asm index 0ba2e50a5..412fd04ff 100644 --- a/engine/routines/getsquareroot.asm +++ b/engine/routines/getsquareroot.asm @@ -1,3 +1,5 @@ +NUM_SQUARE_ROOTS EQU 255 + GetSquareRoot: ; 13b87 ; Return the square root of de in b. @@ -10,7 +12,7 @@ GetSquareRoot: ; 13b87 ; Make sure we don't go past the end of the table. inc b ld a, b - cp $ff + cp NUM_SQUARE_ROOTS ret z ; Iterate over the table until b**2 >= de. @@ -23,8 +25,8 @@ GetSquareRoot: ; 13b87 ret .Squares: ; 13b98 -root = 1 - rept $ff - dw root * root -root = root + 1 - endr +x = 1 +rept NUM_SQUARE_ROOTS + dw x * x +x = x + 1 +endr -- cgit v1.2.3