mirror of
https://github.com/thornAvery/jep-hack.git
synced 2026-02-21 15:08:53 +13:00
First Commit
Upload literally everything from the pokecrystal16 expand-move-ID branch
This commit is contained in:
commit
2f8a41f833
4618 changed files with 480386 additions and 0 deletions
58
home/math.asm
Normal file
58
home/math.asm
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
SimpleMultiply::
|
||||
; Return a * c.
|
||||
and a
|
||||
ret z
|
||||
|
||||
push bc
|
||||
ld b, a
|
||||
xor a
|
||||
.loop
|
||||
add c
|
||||
dec b
|
||||
jr nz, .loop
|
||||
pop bc
|
||||
ret
|
||||
|
||||
SimpleDivide::
|
||||
; Divide a by c. Return quotient b and remainder a.
|
||||
ld b, 0
|
||||
.loop
|
||||
inc b
|
||||
sub c
|
||||
jr nc, .loop
|
||||
dec b
|
||||
add c
|
||||
ret
|
||||
|
||||
Multiply::
|
||||
; Multiply hMultiplicand (3 bytes) by hMultiplier. Result in hProduct.
|
||||
; All values are big endian.
|
||||
push hl
|
||||
push bc
|
||||
|
||||
callfar _Multiply
|
||||
|
||||
pop bc
|
||||
pop hl
|
||||
ret
|
||||
|
||||
Divide::
|
||||
; Divide hDividend length b (max 4 bytes) by hDivisor. Result in hQuotient.
|
||||
; All values are big endian.
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
homecall _Divide
|
||||
pop bc
|
||||
pop de
|
||||
pop hl
|
||||
ret
|
||||
|
||||
SubtractAbsolute:: ; unreferenced
|
||||
; Return |a - b|, sign in carry.
|
||||
sub b
|
||||
ret nc
|
||||
cpl
|
||||
add 1
|
||||
scf
|
||||
ret
|
||||
Loading…
Add table
Add a link
Reference in a new issue