make room for a task before fractional numbers
[mu.git] / 314divide.subx
blobc0b855264201840ee81686b5f4bd00a42e797fab
1 == code
3 integer-divide:  # a: int, b: int -> quotient/eax: int, remainder/edx: int
4     # . prologue
5     55/push-ebp
6     89/<- %ebp 4/r32/esp
7     # eax = a
8     8b/-> *(ebp+8) 0/r32/eax
9     # edx = all 0s or all 1s
10     99/sign-extend-eax-into-edx
11     # quotient, remainder = divide eax by b
12     f7 7/subop/divide-eax-edx-by *(ebp+0xc)
13 $integer-divide:end:
14     # . epilogue
15     89/<- %esp 5/r32/ebp
16     5d/pop-to-ebp
17     c3/return