diff options
author | yenatch <yenatch@gmail.com> | 2018-01-22 01:06:48 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-22 01:06:48 -0500 |
commit | c60f1331fef22b886adf3472d2b4f348832cfaf7 (patch) | |
tree | 5a471fad61e406f5b3ca1aba67ced0186de01c52 /engine/routines/getsquareroot.asm | |
parent | f27f79488a460f0a89670f3611e1e9e175baf5d6 (diff) | |
parent | 7fba864883732ccecb1221ae7ff97492d112362a (diff) |
Merge pull request #456 from Rangi42/master
OAM data documentation; move more content into data/; move palettes into gfx/; more code+script constants; consistent map naming
Diffstat (limited to 'engine/routines/getsquareroot.asm')
-rw-r--r-- | engine/routines/getsquareroot.asm | 14 |
1 files changed, 8 insertions, 6 deletions
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 |