Skip to content

Commit e967bf8

Browse files
committed
cleaned up the .if/.else/.endif code for fallback routines
1 parent af00c84 commit e967bf8

5 files changed

Lines changed: 26 additions & 9 deletions

File tree

src/crt/ldivu.src

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010

1111
.else
1212

13+
.if 1
14+
1315
__ldivu:
1416
; I: EUHL=dividend, AUBC=divisor
1517
; O: euhl=EUHL/AUBC
16-
17-
.if 1
1818
push bc
1919

2020
call __ldvrmu
@@ -27,6 +27,10 @@ __ldivu:
2727
ret
2828

2929
.else
30+
31+
__ldivu:
32+
; I: EUHL=dividend, AUBC=divisor
33+
; O: euhl=EUHL/AUBC
3034
push ix
3135
push iy
3236

src/crt/ldvrmu.src

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515

1616
.else
1717

18-
__ldvrmu:
1918
; REMEMBER to also modify ldivu.src, lremu.src, and ldiv.src if you change this
20-
if 1
19+
.if 1
20+
21+
__ldvrmu:
2122
; I: EUHL=dividend, AUBC=divisor
2223
; O: a[uhl']=EUHL%AUBC, bcu=0, b=A, c=?, euhl=EUHL/AUBC, eubc'=AUBC, zf=!IEF2
2324

@@ -90,6 +91,8 @@ if 1
9091
;;; }
9192

9293
.else
94+
95+
__ldvrmu:
9396
; I: EUHL=dividend, AUBC=divisor
9497
; O: auhl=EUHL%AUBC, euix=EUHL/AUBC, iyh=A, iyl=0
9598

src/crt/llmulu.src

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
.global __llmulu
55
.type __llmulu, @function
66

7+
.if 1
8+
79
__llmulu:
810
; Really slow
9-
10-
.if 1
1111
; clobbers SP.S
1212
push ix
1313
push iy
@@ -79,6 +79,8 @@ __llmulu:
7979

8080
.else
8181

82+
__llmulu:
83+
; Really slow
8284
; fallback routine that does not clobber SP.S
8385
push ix
8486
push iy

src/crt/lremu.src

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010

1111
.else
1212

13+
.if 1
14+
1315
__lremu:
1416
; I: EUHL=dividend, AUBC=divisor
1517
; O: euhl=EUHL%AUBC
16-
17-
.if 1
1818
call __ldvrmu
1919
ld e, a
2020
push de
@@ -27,6 +27,10 @@ __lremu:
2727
ret
2828

2929
.else
30+
31+
__lremu:
32+
; I: EUHL=dividend, AUBC=divisor
33+
; O: euhl=EUHL%AUBC
3034
push ix
3135
push iy
3236

src/libc/ldiv.src

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
.global _ldiv
55
.type _ldiv, @function
66

7-
_ldiv:
87
.if 1
8+
9+
_ldiv:
910
pop hl
1011
pop iy
1112
pop de
@@ -53,6 +54,8 @@ _ldiv:
5354
jp (hl)
5455

5556
.else
57+
58+
_ldiv:
5659
pop hl ; return address
5760
pop iy ; ldiv_t pointer
5861
pop de ; [ 0:23] numerator
@@ -107,6 +110,7 @@ _ldiv:
107110
push de
108111
push de
109112
jp (hl)
113+
110114
.endif
111115

112116
.extern __ldivs_lrems_common

0 commit comments

Comments
 (0)