# HG changeset patch # User William Astle # Date 1703660825 25200 # Node ID 03eb6d6b49b4569e68a3b574ea3fd91f636c5460 # Parent df803556bfaec2d1df6af9697651dbf4d6d302e1 Correct order of initialization in floating point division diff -r df803556bfae -r 03eb6d6b49b4 src/fps.s --- a/src/fps.s Wed Dec 27 00:05:31 2023 -0700 +++ b/src/fps.s Wed Dec 27 00:07:05 2023 -0700 @@ -649,15 +649,6 @@ lda fpa0+fpa.sign ; calculate result sign (XOR of argument signs) eora fpa1+fpa.sign sta fpa0+fpa.sign - ldd fpa0+fpa.sig ; initialize residue to dividend - std fpa1+fpa.sig - ldd fpa0+fpa.sig+2 - std fpa1+fpa.sig+2 - lda fpa0+fpa.sig+4 - sta fpa1+fpa.sig+4 - ldd #11 ; initialize digit counter and nonzero seen flag - std fpaextra+5 - sta fpaextra+7 ; set ongoing extra carry digits to zero ldd #0x9999 ;* calculate 9's complement of divisor for later; we'll introduce a carry subd fpa1+fpa.sig ;* to the first byte to complete the 10's complement's +1 to save doing std fpaextra ;* the extra work here @@ -667,6 +658,15 @@ lda #0x99 suba fpa1+fpa.sig+4 sta fpaextra+4 + ldd fpa0+fpa.sig ; initialize residue to dividend + std fpa1+fpa.sig+5 + ldd fpa0+fpa.sig+2 + std fpa1+fpa.sig+7 + lda fpa0+fpa.sig+4 + sta fpa1+fpa.sig+9 + ldd #11 ; initialize digit counter and nonzero seen flag + std fpaextra+5 + sta fpaextra+7 ; set ongoing extra carry digits to zero bsr fps_div3 ; calculate the quotient byte by byte stb fpa0+fpa.sig bsr fps_div3