diff --git a/library-asm/ftou32reg.asm b/library-asm/ftou32reg.asm index 394bda4fb..d2e3e9e04 100644 --- a/library-asm/ftou32reg.asm +++ b/library-asm/ftou32reg.asm @@ -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 @@ -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 diff --git a/tests/functional/70.asm b/tests/functional/70.asm index c85ea7731..d37ea9d70 100644 --- a/tests/functional/70.asm +++ b/tests/functional/70.asm @@ -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 @@ -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 diff --git a/tests/functional/arrbase1.asm b/tests/functional/arrbase1.asm index df7e8a2de..61d89fd7c 100644 --- a/tests/functional/arrbase1.asm +++ b/tests/functional/arrbase1.asm @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/tests/functional/circle.asm b/tests/functional/circle.asm index 6c709a2f9..163fb707a 100644 --- a/tests/functional/circle.asm +++ b/tests/functional/circle.asm @@ -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 @@ -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 diff --git a/tests/functional/coercion1.asm b/tests/functional/coercion1.asm index ba98b26ce..d063e4da8 100644 --- a/tests/functional/coercion1.asm +++ b/tests/functional/coercion1.asm @@ -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 @@ -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 diff --git a/tests/functional/div32.asm b/tests/functional/div32.asm index b98e9efa1..e5877898f 100644 --- a/tests/functional/div32.asm +++ b/tests/functional/div32.asm @@ -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 @@ -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 diff --git a/tests/functional/dountilsplitted.asm b/tests/functional/dountilsplitted.asm index 4459e4f7a..cc2091024 100644 --- a/tests/functional/dountilsplitted.asm +++ b/tests/functional/dountilsplitted.asm @@ -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 @@ -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 diff --git a/tests/functional/dowhilesplitted.asm b/tests/functional/dowhilesplitted.asm index 44726bab0..3735e3e46 100644 --- a/tests/functional/dowhilesplitted.asm +++ b/tests/functional/dowhilesplitted.asm @@ -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 @@ -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 diff --git a/tests/functional/draw.asm b/tests/functional/draw.asm index eb0e923eb..351e83dfb 100644 --- a/tests/functional/draw.asm +++ b/tests/functional/draw.asm @@ -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 @@ -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 diff --git a/tests/functional/draw3.asm b/tests/functional/draw3.asm index e142351cb..d7ad6f774 100644 --- a/tests/functional/draw3.asm +++ b/tests/functional/draw3.asm @@ -1424,6 +1424,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 @@ -1480,10 +1481,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 diff --git a/tests/functional/eq0.asm b/tests/functional/eq0.asm index 2356d1cc5..50601daab 100644 --- a/tests/functional/eq0.asm +++ b/tests/functional/eq0.asm @@ -169,6 +169,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 @@ -225,10 +226,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 diff --git a/tests/functional/funcif.asm b/tests/functional/funcif.asm index 0139d42a9..ea11b257d 100644 --- a/tests/functional/funcif.asm +++ b/tests/functional/funcif.asm @@ -114,6 +114,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 @@ -170,10 +171,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 diff --git a/tests/functional/ifcrash.asm b/tests/functional/ifcrash.asm index 8a467c559..89caaf8f5 100644 --- a/tests/functional/ifcrash.asm +++ b/tests/functional/ifcrash.asm @@ -233,6 +233,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 @@ -289,10 +290,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 diff --git a/tests/functional/lcd3.asm b/tests/functional/lcd3.asm index 5fbc33539..e22716e4b 100644 --- a/tests/functional/lcd3.asm +++ b/tests/functional/lcd3.asm @@ -585,6 +585,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 @@ -641,10 +642,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 @@ -806,9 +823,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 @@ -1242,7 +1259,7 @@ BRIGHT_TMP: -#line 4 "/src/zxb/trunk/library-asm/copy_attr.asm" +#line 4 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/copy_attr.asm" @@ -1301,7 +1318,7 @@ TABLE: and (hl) ; OVER 2 MODE or (hl) ; OVER 3 MODE -#line 65 "/src/zxb/trunk/library-asm/copy_attr.asm" +#line 65 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/copy_attr.asm" __REFRESH_TMP: ld a, (hl) diff --git a/tests/functional/mcleod.asm b/tests/functional/mcleod.asm index fc38a8078..8344c5eda 100644 --- a/tests/functional/mcleod.asm +++ b/tests/functional/mcleod.asm @@ -79,6 +79,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 @@ -135,10 +136,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 diff --git a/tests/functional/opt3_data2.asm b/tests/functional/opt3_data2.asm index 71b41a3e7..c11f8bb81 100644 --- a/tests/functional/opt3_data2.asm +++ b/tests/functional/opt3_data2.asm @@ -186,7 +186,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 @@ -209,10 +209,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 @@ -242,7 +242,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 @@ -273,7 +273,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 @@ -720,7 +720,7 @@ BRIGHT_TMP: -#line 4 "/src/zxb/trunk/library-asm/copy_attr.asm" +#line 4 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/copy_attr.asm" @@ -779,7 +779,7 @@ TABLE: and (hl) ; OVER 2 MODE or (hl) ; OVER 3 MODE -#line 65 "/src/zxb/trunk/library-asm/copy_attr.asm" +#line 65 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/copy_attr.asm" __REFRESH_TMP: ld a, (hl) @@ -1918,9 +1918,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 @@ -2134,6 +2134,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 @@ -2190,10 +2191,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 diff --git a/tests/functional/opt3_lcd5.asm b/tests/functional/opt3_lcd5.asm index ea70741b8..ae6cdd401 100644 --- a/tests/functional/opt3_lcd5.asm +++ b/tests/functional/opt3_lcd5.asm @@ -413,6 +413,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 @@ -469,10 +470,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 diff --git a/tests/functional/optspeed.asm b/tests/functional/optspeed.asm index f79e8b17d..d22ab78d9 100644 --- a/tests/functional/optspeed.asm +++ b/tests/functional/optspeed.asm @@ -505,6 +505,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 @@ -561,10 +562,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 diff --git a/tests/functional/out0.asm b/tests/functional/out0.asm index b06c66cc1..2a84fc853 100644 --- a/tests/functional/out0.asm +++ b/tests/functional/out0.asm @@ -78,6 +78,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 @@ -134,10 +135,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 diff --git a/tests/functional/plot.asm b/tests/functional/plot.asm index af14b406c..7c5835b7f 100644 --- a/tests/functional/plot.asm +++ b/tests/functional/plot.asm @@ -100,6 +100,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 @@ -156,10 +157,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 diff --git a/tests/functional/read.asm b/tests/functional/read.asm index a13c5c1ff..cba30ec0c 100644 --- a/tests/functional/read.asm +++ b/tests/functional/read.asm @@ -340,9 +340,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 @@ -581,6 +581,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 @@ -637,10 +638,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 diff --git a/tests/functional/read10.asm b/tests/functional/read10.asm index 7544b1a37..63b5422f5 100644 --- a/tests/functional/read10.asm +++ b/tests/functional/read10.asm @@ -639,7 +639,7 @@ BRIGHT_TMP: -#line 4 "/src/zxb/trunk/library-asm/copy_attr.asm" +#line 4 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/copy_attr.asm" @@ -698,7 +698,7 @@ TABLE: and (hl) ; OVER 2 MODE or (hl) ; OVER 3 MODE -#line 65 "/src/zxb/trunk/library-asm/copy_attr.asm" +#line 65 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/copy_attr.asm" __REFRESH_TMP: ld a, (hl) @@ -2012,9 +2012,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 @@ -2198,6 +2198,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 @@ -2254,10 +2255,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 diff --git a/tests/functional/read12.asm b/tests/functional/read12.asm index 1dd151522..fe10fb682 100644 --- a/tests/functional/read12.asm +++ b/tests/functional/read12.asm @@ -344,9 +344,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 @@ -780,7 +780,7 @@ BRIGHT_TMP: -#line 4 "/src/zxb/trunk/library-asm/copy_attr.asm" +#line 4 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/copy_attr.asm" @@ -839,7 +839,7 @@ TABLE: and (hl) ; OVER 2 MODE or (hl) ; OVER 3 MODE -#line 65 "/src/zxb/trunk/library-asm/copy_attr.asm" +#line 65 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/copy_attr.asm" __REFRESH_TMP: ld a, (hl) @@ -1833,6 +1833,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 @@ -1889,10 +1890,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 diff --git a/tests/functional/read4.asm b/tests/functional/read4.asm index c4c812b36..1b9ac7d58 100644 --- a/tests/functional/read4.asm +++ b/tests/functional/read4.asm @@ -383,9 +383,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 @@ -760,6 +760,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 @@ -816,10 +817,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 diff --git a/tests/functional/read5.asm b/tests/functional/read5.asm index 0b0d9e6fe..9b0a02e7d 100644 --- a/tests/functional/read5.asm +++ b/tests/functional/read5.asm @@ -587,7 +587,7 @@ BRIGHT_TMP: -#line 4 "/src/zxb/trunk/library-asm/copy_attr.asm" +#line 4 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/copy_attr.asm" @@ -646,7 +646,7 @@ TABLE: and (hl) ; OVER 2 MODE or (hl) ; OVER 3 MODE -#line 65 "/src/zxb/trunk/library-asm/copy_attr.asm" +#line 65 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/copy_attr.asm" __REFRESH_TMP: ld a, (hl) @@ -1910,9 +1910,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 @@ -2126,6 +2126,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 @@ -2182,10 +2183,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 diff --git a/tests/functional/read8.asm b/tests/functional/read8.asm index cc7e85170..ed27a823d 100644 --- a/tests/functional/read8.asm +++ b/tests/functional/read8.asm @@ -578,7 +578,7 @@ BRIGHT_TMP: -#line 4 "/src/zxb/trunk/library-asm/copy_attr.asm" +#line 4 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/copy_attr.asm" @@ -637,7 +637,7 @@ TABLE: and (hl) ; OVER 2 MODE or (hl) ; OVER 3 MODE -#line 65 "/src/zxb/trunk/library-asm/copy_attr.asm" +#line 65 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/copy_attr.asm" __REFRESH_TMP: ld a, (hl) @@ -1901,9 +1901,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 @@ -2117,6 +2117,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 @@ -2173,10 +2174,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 diff --git a/tests/functional/read9.asm b/tests/functional/read9.asm index 043aa4b28..545e6a697 100644 --- a/tests/functional/read9.asm +++ b/tests/functional/read9.asm @@ -208,7 +208,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 @@ -231,10 +231,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 @@ -264,7 +264,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 @@ -295,7 +295,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 @@ -824,7 +824,7 @@ BRIGHT_TMP: -#line 4 "/src/zxb/trunk/library-asm/copy_attr.asm" +#line 4 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/copy_attr.asm" @@ -883,7 +883,7 @@ TABLE: and (hl) ; OVER 2 MODE or (hl) ; OVER 3 MODE -#line 65 "/src/zxb/trunk/library-asm/copy_attr.asm" +#line 65 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/copy_attr.asm" __REFRESH_TMP: ld a, (hl) @@ -2147,9 +2147,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 @@ -2333,6 +2333,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 @@ -2389,10 +2390,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 diff --git a/tests/functional/readbug.asm b/tests/functional/readbug.asm index 8e445fe5d..853a4b5e7 100644 --- a/tests/functional/readbug.asm +++ b/tests/functional/readbug.asm @@ -338,9 +338,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 @@ -554,6 +554,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 @@ -610,10 +611,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 diff --git a/tests/functional/readokdown.asm b/tests/functional/readokdown.asm index 37686008d..87d8a4875 100644 --- a/tests/functional/readokdown.asm +++ b/tests/functional/readokdown.asm @@ -462,7 +462,7 @@ BRIGHT_TMP: -#line 4 "/src/zxb/trunk/library-asm/copy_attr.asm" +#line 4 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/copy_attr.asm" @@ -521,7 +521,7 @@ TABLE: and (hl) ; OVER 2 MODE or (hl) ; OVER 3 MODE -#line 65 "/src/zxb/trunk/library-asm/copy_attr.asm" +#line 65 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/copy_attr.asm" __REFRESH_TMP: ld a, (hl) @@ -2460,9 +2460,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 @@ -2644,6 +2644,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 @@ -2700,10 +2701,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 diff --git a/tests/functional/readokup.asm b/tests/functional/readokup.asm index cf0602341..1f11b134f 100644 --- a/tests/functional/readokup.asm +++ b/tests/functional/readokup.asm @@ -461,7 +461,7 @@ BRIGHT_TMP: -#line 4 "/src/zxb/trunk/library-asm/copy_attr.asm" +#line 4 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/copy_attr.asm" @@ -520,7 +520,7 @@ TABLE: and (hl) ; OVER 2 MODE or (hl) ; OVER 3 MODE -#line 65 "/src/zxb/trunk/library-asm/copy_attr.asm" +#line 65 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/copy_attr.asm" __REFRESH_TMP: ld a, (hl) @@ -2459,9 +2459,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 @@ -2643,6 +2643,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 @@ -2699,10 +2700,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 diff --git a/tests/functional/strsigil.asm b/tests/functional/strsigil.asm index b0771cd7e..e732a4ce3 100644 --- a/tests/functional/strsigil.asm +++ b/tests/functional/strsigil.asm @@ -444,6 +444,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 @@ -500,10 +501,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 @@ -700,9 +717,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 diff --git a/tests/functional/test.py b/tests/functional/test.py index 30932ac5b..84e2359e5 100755 --- a/tests/functional/test.py +++ b/tests/functional/test.py @@ -454,7 +454,7 @@ def normalizeDiff(diff): is_same_file(fname1, tfname, ignore_regexp=FILTER, diff=lines) lines = normalizeDiff(lines) - if lines != fdiff: + if lines[:len(fdiff)] != fdiff: for x, y in zip(lines, fdiff): x = x.strip() y = y.strip() @@ -509,8 +509,7 @@ def main(argv=None): parser.add_argument('-d', '--show-diff', action='store_true', help='Shows output difference on failure') parser.add_argument('-v', '--show-visual-diff', action='store_true', help='Shows visual difference using vimdiff ' 'upon failure') - parser.add_argument('-u', '--update', type=str, default=None, help='Updates all *.bas test if the UPDATE diff' - ' matches') + parser.add_argument('-u', '--update', type=str, default=None, help='Updates a test if the UPDATE diff matches') parser.add_argument('-U', '--force-update', action='store_true', help='Updates all failed test with the new output') parser.add_argument('--tmp-dir', type=str, default=TEMP_DIR, help='Temporary directory for tests generation') parser.add_argument('FILES', nargs='+', type=str, help='List of files to be processed') diff --git a/tests/functional/while.asm b/tests/functional/while.asm index dc9efd8e7..e7a34d56a 100644 --- a/tests/functional/while.asm +++ b/tests/functional/while.asm @@ -186,6 +186,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 @@ -242,10 +243,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 diff --git a/tests/functional/whilesplitted.asm b/tests/functional/whilesplitted.asm index 2a6d45bfb..701b8dfc0 100644 --- a/tests/functional/whilesplitted.asm +++ b/tests/functional/whilesplitted.asm @@ -188,6 +188,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 @@ -244,10 +245,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