summaryrefslogtreecommitdiff
path: root/home/math.asm
diff options
context:
space:
mode:
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