projects
/
fw
/
sdcc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* Runs dhrystone. 68.83d/s with terrible code.
[fw/sdcc]
/
device
/
lib
/
gbz80
/
div.s
diff --git
a/device/lib/gbz80/div.s
b/device/lib/gbz80/div.s
index 5917c24acb81349e0d86686087b2bc3f257ae9c4..9dd447f3ce6c648de3404c6a66798af8b6296f4b 100644
(file)
--- a/
device/lib/gbz80/div.s
+++ b/
device/lib/gbz80/div.s
@@
-1,161
+1,126
@@
;; Originally from GBDK by Pascal Felber.
.area _CODE
;; Originally from GBDK by Pascal Felber.
.area _CODE
-__divschar::
- push de
+__divschar::
push bc
push bc
- push ix
- ld ix,#0
- add ix,sp
-
- ld c,8(ix)
- ld e,9(ix)
+ lda hl,4(sp)
+
+ ld c,(hl)
+ inc hl
+ ld e,(hl)
call .div8
call .div8
- ld l,c
-
- pop ix
+ ld e,c
pop bc
pop bc
- pop de
ret
__modschar::
ret
__modschar::
- push de
push bc
push bc
- push ix
- ld ix,#0
- add ix,sp
-
- ld c,8(ix)
- ld e,9(ix)
+ lda hl,4(sp)
+ ld c,(hl)
+ inc hl
+ ld e,(hl)
call .div8
call .div8
- ld l,e
-
- pop ix
+ ;; Result in e
pop bc
pop bc
- pop de
ret
__divsint::
ret
__divsint::
- push de
push bc
push bc
- push ix
- ld
ix,#0
- add ix,sp
-
- ld c,8(ix)
- ld
b,9(ix
)
- ld e,10(ix)
- ld d,
11(ix
)
+ lda hl,4(sp)
+ ld
c,(hl)
+ inc hl
+ ld b,(hl)
+ inc hl
+ ld
e,(hl
)
+ inc hl
+ ld d,
(hl
)
call .div16
call .div16
- ld l,c
- ld h,b
-
- pop ix
+ ld e,c
+ ld d,b
+
pop bc
pop bc
- pop de
ret
__modsint::
ret
__modsint::
- push de
push bc
push bc
- push ix
- ld ix,#0
- add ix,sp
+ lda hl,4(sp)
- ld c,8(ix)
- ld b,9(ix)
- ld e,10(ix)
- ld d,11(ix)
+ ld c,(hl)
+ inc hl
+ ld b,(hl)
+ inc hl
+ ld e,(hl)
+ inc hl
+ ld d,(hl)
call .div16
call .div16
- ld l,e
- ld h,d
-
- pop ix
+ ;; Result in de
pop bc
pop bc
- pop de
ret
;; Unsigned
__divuchar::
ret
;; Unsigned
__divuchar::
- push de
push bc
push bc
- push ix
- ld ix,#0
- add ix,sp
-
- ld c,8(ix)
- ld e,9(ix)
+ lda hl,4(sp)
+
+ ld c,(hl)
+ inc hl
+ ld e,(hl)
call .divu8
call .divu8
- ld
l
,c
+ ld
e
,c
- pop ix
pop bc
pop bc
- pop de
ret
__moduchar::
ret
__moduchar::
- push de
push bc
push bc
- push ix
- ld ix,#0
- add ix,sp
-
- ld c,8(ix)
- ld e,9(ix)
+ lda hl,4(sp)
+
+ ld c,(hl)
+ inc hl
+ ld e,(hl)
call .divu8
call .divu8
- ld l,e
-
- pop ix
+ ;; Result in e
pop bc
pop bc
- pop de
ret
__divuint::
ret
__divuint::
- push de
push bc
push bc
- push ix
- ld
ix,#0
- add ix,sp
-
- ld c,8(ix)
- ld
b,9(ix
)
- ld e,10(ix)
- ld d,
11(ix
)
+ lda hl,4(sp)
+ ld
c,(hl)
+ inc hl
+ ld b,(hl)
+ inc hl
+ ld
e,(hl
)
+ inc hl
+ ld d,
(hl
)
call .divu16
call .divu16
- ld
l
,c
- ld
h
,b
+ ld
e
,c
+ ld
d
,b
- pop ix
pop bc
pop bc
- pop de
ret
__moduint::
ret
__moduint::
- push de
push bc
push bc
- push ix
- ld
ix,#0
- add ix,sp
-
- ld c,8(ix)
- ld
b,9(ix
)
- ld e,10(ix)
- ld d,
11(ix
)
+ lda hl,4(sp)
+ ld
c,(hl)
+ inc hl
+ ld b,(hl)
+ inc hl
+ ld
e,(hl
)
+ inc hl
+ ld d,
(hl
)
call .divu16
call .divu16
- ld l,e
- ld h,d
-
- pop ix
+ ;; Result in de
pop bc
pop bc
- pop de
ret
.div8::
ret
.div8::