File tree Expand file tree Collapse file tree 3 files changed +28
-18
lines changed Expand file tree Collapse file tree 3 files changed +28
-18
lines changed Original file line number Diff line number Diff line change @@ -25,13 +25,14 @@ __i48rems:
25
25
lea de, iy
26
26
push bc
27
27
pop hl
28
- ; negate remainder if dividend was negative
29
- call m, __i48neg
30
28
31
29
pop bc
32
30
pop iy
33
- ret
31
+
32
+ ret p
33
+ ; negate remainder if dividend was negative
34
+ jp __i48neg
34
35
35
36
extern __i48dvrmu
36
37
extern __i48neg
37
- extern __uiyubcNeg
38
+ extern __uiyubcNeg
Original file line number Diff line number Diff line change @@ -65,11 +65,10 @@ __lldivs:
65
65
bit 7, (iy + 23)
66
66
.div_quotient_skip:
67
67
68
- call nz, __llneg
69
-
70
68
pop iy
71
69
72
- ret
70
+ ret z
71
+ jp __llneg
73
72
74
73
extern __lldvrmu.hijack
75
74
extern __llneg
Original file line number Diff line number Diff line change 6
6
7
7
; i48div_t i48div(int48_t numer, int48_t denom);
8
8
_i48div:
9
- ; TODO: __i48dvrmu is called twice here
10
9
push ix
11
10
ld ix, 0
12
11
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
13
19
ld hl, (ix + 9)
14
20
ld de, (ix + 12)
21
+ call c, __i48neg
22
+ ld a, b
23
+ rla
15
24
ld bc, (ix + 15)
16
25
ld iy, (ix + 18)
26
+ call c, __uiyubcNeg
27
+ call __i48dvrmu
17
28
ld ix, (ix + 6)
18
- push hl
19
- push de
20
- call __i48divs
29
+ pop af
30
+ call m, __i48neg
21
31
ld (ix + 0), hl
22
32
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
28
37
pop ix
29
38
ret
30
39
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