Skip to content

Commit 239eed7

Browse files
committed
Fixed several floating point routines; made a temporary fix to a long double linking bug; seperated float64 CRT routines; passed all floating_point autotests
1 parent a15e7f2 commit 239eed7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+2783
-9091
lines changed

src/crt/daddsub.src

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
assume adl=1
2+
3+
section .text
4+
5+
public __dadd, __dsub
6+
7+
; float64_t softfloat_addMagsF64(float64_t x, const float64_t *y, bool sign_x)
8+
__dadd:
9+
push af
10+
ld a, b
11+
jr __daddsub
12+
13+
; float64_t softfloat_subMagsF64(float64_t x, const float64_t *y, bool sign_x)
14+
__dsub:
15+
push af
16+
ld a, b
17+
cpl
18+
; jr __daddsub
19+
20+
__daddsub:
21+
push iy
22+
ld iy, 9
23+
add iy, sp
24+
25+
rlc b
26+
push af ; sign_x
27+
rrc b
28+
29+
push iy ; address of y
30+
push bc, de, hl ; pass x by value
31+
32+
xor a, (iy + 7)
33+
rla
34+
35+
jr nc, .__daddmags ; same signs
36+
; .__dsubmags:
37+
call _softfloat_subMagsF64
38+
jr .__daddsub_ret
39+
.__daddmags:
40+
call _softfloat_addMagsF64
41+
.__daddsub_ret:
42+
pop af, af, af, af, af
43+
pop iy, af
44+
ret
45+
46+
extern _softfloat_addMagsF64, _softfloat_subMagsF64

src/crt/ddiv.src

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
assume adl=1
2+
3+
section .text
4+
5+
public __ddiv
6+
7+
; float64_t f64_div(float64_t, const float64_t*)
8+
__ddiv:
9+
push af, iy
10+
ld iy, 9
11+
add iy, sp
12+
push iy, bc, de, hl
13+
call _f64_div
14+
pop af, af, af, af, iy, af
15+
ret
16+
17+
extern _f64_div

src/crt/dmul.src

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
assume adl=1
2+
3+
section .text
4+
5+
public __dmul
6+
7+
; float64_t f64_mul(float64_t, const float64_t*)
8+
__dmul:
9+
push af, iy
10+
ld iy, 9
11+
add iy, sp
12+
push iy, bc, de, hl
13+
call _f64_mul
14+
pop af, af, af, af, iy, af
15+
ret
16+
17+
extern _f64_mul

src/crt/drem.src

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
assume adl=1
2+
3+
section .text
4+
5+
public __drem
6+
7+
; float64_t f64_rem(float64_t, const float64_t*)
8+
__drem:
9+
push af, iy
10+
ld iy, 9
11+
add iy, sp
12+
push iy, bc, de, hl
13+
call _f64_drem
14+
pop af, af, af, af, iy, af
15+
ret
16+
17+
extern _f64_rem

src/crt/dtof.src

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
assume adl=1
2+
3+
section .text
4+
5+
public __dtof
6+
7+
__dtof:
8+
; f64_ret_f32
9+
push af, iy, bc, de, hl
10+
call _f64_to_f32
11+
pop af, af, af, iy, af
12+
ret
13+
14+
extern _f64_to_f32

src/crt/dtol.src

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
assume adl=1
2+
3+
section .text
4+
5+
public __dtol
6+
7+
__dtol:
8+
; f64_ret_i32
9+
push af, iy, bc, de, hl
10+
call __dtol_c
11+
pop af, af, af, iy, af
12+
ret
13+
14+
extern __dtol_c

src/crt/dtoll.src

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
assume adl=1
2+
3+
section .text
4+
5+
public __dtoll
6+
7+
__dtoll:
8+
; f64_ret_i64
9+
push af, iy, bc, de, hl
10+
call __dtoll_c
11+
pop af, af, af, iy, af
12+
ret
13+
14+
extern __dtoll_c

src/crt/dtoul.src

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
assume adl=1
2+
3+
section .text
4+
5+
public __dtoul
6+
7+
__dtoul:
8+
; f64_ret_u32
9+
push af, iy, bc, de, hl
10+
call __dtoul_c
11+
pop af, af, af, iy, af
12+
ret
13+
14+
extern __dtoul_c

src/crt/dtoull.src

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
assume adl=1
2+
3+
section .text
4+
5+
public __dtoull
6+
7+
__dtoull:
8+
; f64_ret_u64
9+
push af, iy, bc, de, hl
10+
call __dtoull_c
11+
pop af, af, af, iy, af
12+
ret
13+
14+
extern __dtoull_c

0 commit comments

Comments
 (0)