Mercurial > hg > index.cgi
changeset 105:65cb0a0297b3
Make integer to floating point conversion use extra bits in fp accumulator
author | William Astle <lost@l-w.ca> |
---|---|
date | Mon, 30 Oct 2023 22:25:47 -0600 |
parents | eecb576c76c6 |
children | 1396fe221ff7 |
files | src/fps.s |
diffstat | 1 files changed, 10 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/fps.s Mon Oct 30 22:25:04 2023 -0600 +++ b/src/fps.s Mon Oct 30 22:25:47 2023 -0600 @@ -898,24 +898,24 @@ sta fpa0+fpa.sign ldd zero ; negate the value and store it to temporary location subd val.int+2,x - std fpaextra+2 + std fpa0+fpa.extra+2 ldd zero sbcb val.int+1,x sbca val.int,x - std fpaextra + std fpa0+fpa.extra bra fps_fromint0 ; go finish the conversion fps_fromuint clr fpa0+fpa.sign ; set sign to positive ldd val.int+2,x ; copy value to temporary accumulator - std fpaextra+2 + std fpa0+fpa.extra+2 ldd val.int,x - std fpaextra + std fpa0+fpa.extra fps_fromint0 ldd zero ; zero out destination std fpa0+fpa.sig std fpa0+fpa.sig+2 sta fpa0+fpa.sig+4 ldd #0x5f20 ; set exponent for decimal right of significand and 32 bit shifts sta fpa0+fpa.exp ; save exponent - stb fpaextra+5 ; save counter + stb fpa0+fpa.extra+4 ; save counter bra fps_fromint2 ; skip digit check on the first iteration since none need adjustment fps_fromint1 ldu #fpa0+fpa.sig ; point to significand bsr fps_fromint3 ; do adjustments, 5 bytes worth of digits @@ -923,16 +923,16 @@ bsr fps_fromint3 bsr fps_fromint3 bsr fps_fromint3 -fps_fromint2 lsl fpaextra+3 ; shift left - rol fpaextra+2 - rol fpaextra+1 - rol fpaextra +fps_fromint2 lsl fpa0+fpa.extra+3 ; shift left + rol fpa0+fpa.extra+2 + rol fpa0+fpa.extra+1 + rol fpa0+fpa.extra rol fpa0+fpa.sig+4 rol fpa0+fpa.sig+3 rol fpa0+fpa.sig+2 rol fpa0+fpa.sig+1 rol fpa0+fpa.sig - dec fpaextra+5 ; done all digits? + dec fpa0+fpa.extra+4 ; done all digits? bne fps_fromint1 ; brif not lda #valtype_float ; set result type to floating point sta val.type,y