diff options
Diffstat (limited to 'engine/math')
-rw-r--r-- | engine/math/get_square_root.asm | 4 | ||||
-rw-r--r-- | engine/math/math.asm | 6 | ||||
-rw-r--r-- | engine/math/print_num.asm | 10 | ||||
-rw-r--r-- | engine/math/sine.asm | 2 |
4 files changed, 10 insertions, 12 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..4240ef6cd 100644 --- a/engine/math/math.asm +++ b/engine/math/math.asm @@ -1,4 +1,4 @@ -_Multiply:: ; 66de +_Multiply:: ; hMultiplier is one byte. ld a, 8 @@ -82,10 +82,9 @@ _Multiply:: ; 66de ld [hProduct + 0], a ret -; 673e -_Divide:: ; 673e +_Divide:: xor a ld [hMathBuffer + 0], a ld [hMathBuffer + 1], a @@ -193,4 +192,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 |