summaryrefslogtreecommitdiff
path: root/home/math.asm
diff options
context:
space:
mode:
authordannye <33dannye@gmail.com>2020-11-04 00:06:44 -0600
committerdannye <33dannye@gmail.com>2020-11-04 00:06:44 -0600
commit5647ca687b92954dcf37a6ea6bfbc9a341c32de4 (patch)
treedde1937a1bfdb3a835f4155e1c2eb8f1aaf86f63 /home/math.asm
parent53fcd05aa24693093d8af1dc8ec4fedd3957decc (diff)
Sync with pokered
Diffstat (limited to 'home/math.asm')
-rw-r--r--home/math.asm33
1 files changed, 33 insertions, 0 deletions
diff --git a/home/math.asm b/home/math.asm
new file mode 100644
index 00000000..59eda606
--- /dev/null
+++ b/home/math.asm
@@ -0,0 +1,33 @@
+; function to do multiplication
+; all values are big endian
+; INPUT
+; FF96-FF98 = multiplicand
+; FF99 = multiplier
+; OUTPUT
+; FF95-FF98 = product
+Multiply::
+ push hl
+ push bc
+ callfar _Multiply
+ pop bc
+ pop hl
+ ret
+
+; function to do division
+; all values are big endian
+; INPUT
+; FF95-FF98 = dividend
+; FF99 = divisor
+; b = number of bytes in the dividend (starting from FF95)
+; OUTPUT
+; FF95-FF98 = quotient
+; FF99 = remainder
+Divide::
+ push hl
+ push de
+ push bc
+ homecall _Divide
+ pop bc
+ pop de
+ pop hl
+ ret