File tree Expand file tree Collapse file tree 3 files changed +27
-17
lines changed Expand file tree Collapse file tree 3 files changed +27
-17
lines changed Original file line number Diff line number Diff line change @@ -29,12 +29,13 @@ __i48rems:
2929 lea de, iy
3030 push bc
3131 pop hl
32- ; negate remainder if dividend was negative
33- call m, __i48neg
3432
3533 pop bc
3634 pop iy
37- ret
35+
36+ ret p
37+ ; negate remainder if dividend was negative
38+ jp __i48neg
3839
3940 extern __i48dvrmu
4041 extern __i48neg
Original file line number Diff line number Diff line change @@ -65,11 +65,10 @@ __lldivs:
6565 bit 7, (iy + 23)
6666.div_quotient_skip:
6767
68- call nz, __llneg
69-
7068 pop iy
7169
72- ret
70+ ret z
71+ jp __llneg
7372
7473 extern __lldvrmu.hijack
7574 extern __llneg
Original file line number Diff line number Diff line change 66
77; i48div_t i48div(int48_t numer, int48_t denom);
88_i48div:
9- ; TODO: __i48dvrmu is called twice here
109 push ix
1110 ld ix, 0
1211 add ix, sp
12+ ld c, (ix + 14)
13+ ld b, (ix + 20)
14+ ld a, c
15+ xor a, b
16+ ld a, c
17+ push af
18+ rla
1319 ld hl, (ix + 9)
1420 ld de, (ix + 12)
21+ call c, __i48neg
22+ ld a, b
23+ rla
1524 ld bc, (ix + 15)
1625 ld iy, (ix + 18)
26+ call c, __uiyubcNeg
27+ call __i48dvrmu
1728 ld ix, (ix + 6)
18- push hl
19- push de
20- call __i48divs
29+ pop af
30+ call m, __i48neg
2131 ld (ix + 0), hl
2232 ld (ix + 3), de
23- pop de
24- pop hl
25- call __i48rems
26- ld (ix + 6), hl
27- ld (ix + 9), de
33+ rla
34+ call c, __uiyubcNeg
35+ ld (ix + 6), bc
36+ ld (ix + 9), iy
2837 pop ix
2938 ret
3039
31- extern __i48divs
32- extern __i48rems
40+ extern __i48dvrmu
41+ extern __i48neg
42+ extern __uiyubcNeg
You can’t perform that action at this time.
0 commit comments