Skip to content
Merged
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
19 changes: 18 additions & 1 deletion library-asm/ftou32reg.asm
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ __FTOU32REG: ; Converts a Float to (un)signed 32 bit integer (NOTE: It's ALWAYS
PROC

LOCAL __IS_FLOAT
LOCAL __NEGATE

or a
jr nz, __IS_FLOAT
Expand Down Expand Up @@ -62,10 +63,26 @@ __FTOU32REG_LOOP:
__FTOU32REG_END:
pop af ; Take the sign bit
or a ; Sets SGN bit to 1 if negative
jp m, __NEG32 ; Negates DEHL
jp m, __NEGATE ; Negates DEHL

ret

__NEGATE:
exx
ld a, d
or e
or b
or c
exx
jr z, __END
inc l
jr nz, __END
inc h
jr nz, __END
inc de
LOCAL __END
__END:
jp __NEG32
ENDP


Expand Down
19 changes: 18 additions & 1 deletion tests/functional/70.asm
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ __FTOU32REG: ; Converts a Float to (un)signed 32 bit integer (NOTE: It's ALWAYS
PROC

LOCAL __IS_FLOAT
LOCAL __NEGATE

or a
jr nz, __IS_FLOAT
Expand Down Expand Up @@ -217,10 +218,26 @@ __FTOU32REG_LOOP:
__FTOU32REG_END:
pop af ; Take the sign bit
or a ; Sets SGN bit to 1 if negative
jp m, __NEG32 ; Negates DEHL
jp m, __NEGATE ; Negates DEHL

ret

__NEGATE:
exx
ld a, d
or e
or b
or c
exx
jr z, __END
inc l
jr nz, __END
inc h
jr nz, __END
inc de
LOCAL __END
__END:
jp __NEG32
ENDP


Expand Down
33 changes: 25 additions & 8 deletions tests/functional/arrbase1.asm
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ __MUL16NOADD:

#line 20 "array.asm"

#line 24 "/src/zxb/trunk/library-asm/array.asm"
#line 24 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/array.asm"

__ARRAY:
PROC
Expand All @@ -159,10 +159,10 @@ __ARRAY:
ld hl, 0 ; BC = Offset "accumulator"

LOOP:
#line 49 "/src/zxb/trunk/library-asm/array.asm"
#line 49 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/array.asm"
pop bc ; Get next index (Ai) from the stack

#line 59 "/src/zxb/trunk/library-asm/array.asm"
#line 59 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/array.asm"

add hl, bc ; Adds current index

Expand Down Expand Up @@ -192,7 +192,7 @@ ARRAY_END:
push de
exx

#line 92 "/src/zxb/trunk/library-asm/array.asm"
#line 92 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/array.asm"
LOCAL ARRAY_SIZE_LOOP

ex de, hl
Expand Down Expand Up @@ -223,7 +223,7 @@ ARRAY_SIZE_LOOP:

;add hl, de
;__ARRAY_FIN:
#line 123 "/src/zxb/trunk/library-asm/array.asm"
#line 123 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/array.asm"

pop de
add hl, de ; Adds element start
Expand Down Expand Up @@ -562,9 +562,9 @@ __MEM_START:
__MEM_LOOP: ; Loads lengh at (HL, HL+). If Lenght >= BC, jump to __MEM_DONE
ld a, h ; HL = NULL (No memory available?)
or l
#line 111 "/src/zxb/trunk/library-asm/alloc.asm"
#line 111 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/alloc.asm"
ret z ; NULL
#line 113 "/src/zxb/trunk/library-asm/alloc.asm"
#line 113 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/alloc.asm"
; HL = Pointer to Free block
ld e, (hl)
inc hl
Expand Down Expand Up @@ -778,6 +778,7 @@ __FTOU32REG: ; Converts a Float to (un)signed 32 bit integer (NOTE: It's ALWAYS
PROC

LOCAL __IS_FLOAT
LOCAL __NEGATE

or a
jr nz, __IS_FLOAT
Expand Down Expand Up @@ -834,10 +835,26 @@ __FTOU32REG_LOOP:
__FTOU32REG_END:
pop af ; Take the sign bit
or a ; Sets SGN bit to 1 if negative
jp m, __NEG32 ; Negates DEHL
jp m, __NEGATE ; Negates DEHL

ret

__NEGATE:
exx
ld a, d
or e
or b
or c
exx
jr z, __END
inc l
jr nz, __END
inc h
jr nz, __END
inc de
LOCAL __END
__END:
jp __NEG32
ENDP


Expand Down
19 changes: 18 additions & 1 deletion tests/functional/circle.asm
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,7 @@ __FTOU32REG: ; Converts a Float to (un)signed 32 bit integer (NOTE: It's ALWAYS
PROC

LOCAL __IS_FLOAT
LOCAL __NEGATE

or a
jr nz, __IS_FLOAT
Expand Down Expand Up @@ -644,10 +645,26 @@ __FTOU32REG_LOOP:
__FTOU32REG_END:
pop af ; Take the sign bit
or a ; Sets SGN bit to 1 if negative
jp m, __NEG32 ; Negates DEHL
jp m, __NEGATE ; Negates DEHL

ret

__NEGATE:
exx
ld a, d
or e
or b
or c
exx
jr z, __END
inc l
jr nz, __END
inc h
jr nz, __END
inc de
LOCAL __END
__END:
jp __NEG32
ENDP


Expand Down
19 changes: 18 additions & 1 deletion tests/functional/coercion1.asm
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ __FTOU32REG: ; Converts a Float to (un)signed 32 bit integer (NOTE: It's ALWAYS
PROC

LOCAL __IS_FLOAT
LOCAL __NEGATE

or a
jr nz, __IS_FLOAT
Expand Down Expand Up @@ -351,10 +352,26 @@ __FTOU32REG_LOOP:
__FTOU32REG_END:
pop af ; Take the sign bit
or a ; Sets SGN bit to 1 if negative
jp m, __NEG32 ; Negates DEHL
jp m, __NEGATE ; Negates DEHL

ret

__NEGATE:
exx
ld a, d
or e
or b
or c
exx
jr z, __END
inc l
jr nz, __END
inc h
jr nz, __END
inc de
LOCAL __END
__END:
jp __NEG32
ENDP


Expand Down
19 changes: 18 additions & 1 deletion tests/functional/div32.asm
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ __FTOU32REG: ; Converts a Float to (un)signed 32 bit integer (NOTE: It's ALWAYS
PROC

LOCAL __IS_FLOAT
LOCAL __NEGATE

or a
jr nz, __IS_FLOAT
Expand Down Expand Up @@ -228,10 +229,26 @@ __FTOU32REG_LOOP:
__FTOU32REG_END:
pop af ; Take the sign bit
or a ; Sets SGN bit to 1 if negative
jp m, __NEG32 ; Negates DEHL
jp m, __NEGATE ; Negates DEHL

ret

__NEGATE:
exx
ld a, d
or e
or b
or c
exx
jr z, __END
inc l
jr nz, __END
inc h
jr nz, __END
inc de
LOCAL __END
__END:
jp __NEG32
ENDP


Expand Down
19 changes: 18 additions & 1 deletion tests/functional/dountilsplitted.asm
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ __FTOU32REG: ; Converts a Float to (un)signed 32 bit integer (NOTE: It's ALWAYS
PROC

LOCAL __IS_FLOAT
LOCAL __NEGATE

or a
jr nz, __IS_FLOAT
Expand Down Expand Up @@ -246,10 +247,26 @@ __FTOU32REG_LOOP:
__FTOU32REG_END:
pop af ; Take the sign bit
or a ; Sets SGN bit to 1 if negative
jp m, __NEG32 ; Negates DEHL
jp m, __NEGATE ; Negates DEHL

ret

__NEGATE:
exx
ld a, d
or e
or b
or c
exx
jr z, __END
inc l
jr nz, __END
inc h
jr nz, __END
inc de
LOCAL __END
__END:
jp __NEG32
ENDP


Expand Down
19 changes: 18 additions & 1 deletion tests/functional/dowhilesplitted.asm
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ __FTOU32REG: ; Converts a Float to (un)signed 32 bit integer (NOTE: It's ALWAYS
PROC

LOCAL __IS_FLOAT
LOCAL __NEGATE

or a
jr nz, __IS_FLOAT
Expand Down Expand Up @@ -246,10 +247,26 @@ __FTOU32REG_LOOP:
__FTOU32REG_END:
pop af ; Take the sign bit
or a ; Sets SGN bit to 1 if negative
jp m, __NEG32 ; Negates DEHL
jp m, __NEGATE ; Negates DEHL

ret

__NEGATE:
exx
ld a, d
or e
or b
or c
exx
jr z, __END
inc l
jr nz, __END
inc h
jr nz, __END
inc de
LOCAL __END
__END:
jp __NEG32
ENDP


Expand Down
19 changes: 18 additions & 1 deletion tests/functional/draw.asm
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,7 @@ __FTOU32REG: ; Converts a Float to (un)signed 32 bit integer (NOTE: It's ALWAYS
PROC

LOCAL __IS_FLOAT
LOCAL __NEGATE

or a
jr nz, __IS_FLOAT
Expand Down Expand Up @@ -806,10 +807,26 @@ __FTOU32REG_LOOP:
__FTOU32REG_END:
pop af ; Take the sign bit
or a ; Sets SGN bit to 1 if negative
jp m, __NEG32 ; Negates DEHL
jp m, __NEGATE ; Negates DEHL

ret

__NEGATE:
exx
ld a, d
or e
or b
or c
exx
jr z, __END
inc l
jr nz, __END
inc h
jr nz, __END
inc de
LOCAL __END
__END:
jp __NEG32
ENDP


Expand Down
Loading