Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/crt/dtof.src
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ __dtof:
; BC:UDE:UHL = 1 << shift
; (SP) = X
call __lland
call __llcmpzero
call __llequzero
pop hl
; DE and BC are swapped here
pop bc
Expand Down Expand Up @@ -215,6 +215,6 @@ __dtof:
jr .L.ret_copysign

.extern __lland
.extern __llcmpzero
.extern __llequzero
.extern __llshru
.extern __lshru
8 changes: 8 additions & 0 deletions src/crt/i48cmpu.src
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,21 @@
.assume adl=1

.section .text

.global __i48cmpequ
.type __i48cmpequ, @function

.global __i48cmpu
.type __i48cmpu, @function

__i48cmpequ:
; Zero = (UDE:UHL == UIY:UBC)
__i48cmpu:
; CC: 15 bytes
; Minimum: 11F + 6R + 3W + 2
; Maximum: 16F + 6R + 3W + 2
; Zero = (UDE:UHL == UIY:UBC)
; Carry = (UDE:UHL unsigned_less_than UIY:UBC)
push hl
or a, a
lea hl, iy + 0
Expand Down
8 changes: 8 additions & 0 deletions src/crt/i48cmpzero.src
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,18 @@
.assume adl=1

.section .text

.global __i48equzero
.type __i48equzero, @function

.global __i48cmpzero
.type __i48cmpzero, @function

__i48equzero:
; Zero flag = (UDE:UHL == 0)
__i48cmpzero:
; Zero flag = (UDE:UHL == 0)
; Sign flag = (UDE:UHL < 0)
; CC: 13 bytes
; Minimum: 8F + 3R + 2
; Maximum: 14F + 3R + 3
Expand Down
9 changes: 9 additions & 0 deletions src/crt/lcmpu.src
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
.assume adl=1

.section .text

.global __lcmpequ
.type __lcmpequ, @function

.global __lcmpu
.type __lcmpu, @function

.ifdef PREFER_OS_CRT

.set __lcmpu, 0x0001AC
.set __lcmpequ, __lcmpu

.else

__lcmpequ:
; Zero = (E:UHL == A:UBC)
__lcmpu:
; Zero = (E:UHL == A:UBC)
; Carry = (E:UHL unsigned_less_than A:UBC)
cp a, e
ccf
ret nz
Expand Down
8 changes: 8 additions & 0 deletions src/crt/lcmpzero.src
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
.assume adl=1

.section .text

.global __lequzero
.type __lequzero, @function

.global __lcmpzero
.type __lcmpzero, @function

__lequzero:
; Zero flag = (E:UHL == 0)
__lcmpzero:
; Zero flag = (E:UHL == 0)
; Sign flag = (E:UHL < 0)
inc e
dec e
ret nz
Expand Down
8 changes: 8 additions & 0 deletions src/crt/llcmpu.src
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
.assume adl=1

.section .text

.global __llcmpequ
.type __llcmpequ, @function

.global __llcmpu
.type __llcmpu, @function

__llcmpequ:
; Zero = (BC:UDE:UHL == (SP64))
__llcmpu:
; Zero = (BC:UDE:UHL == (SP64))
; Carry = (BC:UDE:UHL unsigned_less_than (SP64))
push iy
ld iy, 0
add iy, sp
Expand Down
8 changes: 8 additions & 0 deletions src/crt/llcmpzero.src
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
.assume adl=1

.section .text

.global __llequzero
.type __llequzero, @function

.global __llcmpzero
.type __llcmpzero, @function

__llequzero:
; Zero flag = (BC:UDE:UHL == 0)
__llcmpzero:
; Zero flag = (BC:UDE:UHL == 0)
; Sign flag = (BC:UDE:UHL < 0)
inc b
dec b
ret nz
Expand Down
4 changes: 2 additions & 2 deletions src/libc/strtoll.src
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ _strtoll.maybe_out_of_range:
; negative
; check that the result is not an exact INT_MIN
ld b, a ; B = (B << 1)
call __llcmpzero
call __llequzero
set 7, b
ret z ; exact INT_MIN
_strtoll.underflow:
Expand Down Expand Up @@ -344,4 +344,4 @@ __strtoll_common.set_overflow_bit:

.extern _errno
.extern __llneg
.extern __llcmpzero
.extern __llequzero
6 changes: 3 additions & 3 deletions src/softfloat/s_shiftRightJam64.src
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ _softfloat_shiftRightJam64:
ld hl, (iy + 4)
call __llshl
xor a, a
call __llcmpzero
call __llequzero
jr z, .L.no_round
inc a ; ld a, 1
.L.no_round:
Expand All @@ -58,7 +58,7 @@ _softfloat_shiftRightJam64:
.L.overflow_shift:
; A is zero here
ld hl, (iy + 4)
call __llcmpzero
call __llequzero
ret z
xor a, a
sbc hl, hl
Expand All @@ -69,6 +69,6 @@ _softfloat_shiftRightJam64:
inc hl
ret

.extern __llcmpzero
.extern __llequzero
.extern __llshl
.extern __llshru
Loading