home *** CD-ROM | disk | FTP | other *** search
/ Outlet 53 / outlet-53.mgt / p8 < prev    next >
Text File  |  2021-04-18  |  4KB  |  1 lines

  1.        _2E8F_PF_MEDIUM (X isn't a small integer or a pure       fraction; X is more than one but less than 2**27. It is         therefore necessary to count how many of the binary digits      should be considered as preceding the fractional point. N in themagnitude counter indicates by how many powers of ten, if any, Xhas been reduced; iX is the last value on the stack):                   - call 2FBA FETCH TWO with the pointers switched, to getiX into L'D'E'DE                                                        - set the hi bit of D'; this corrects the mantissa to a true mantissa                                                           - get the exponent from L'                                      - subtract 80h/128d; this corrects it to the true       exponent, which is the number of binary digits in iX                    - make this the bit counter for PF BITS                        _2E7B_PF_BITS (also entered from PF SAVE: there is either          a one-byte iX in D' with a bit counter 08, or                   a two-byte iX in D'E' with a bit counter 16d, or                a four-byte iX in D'E'DE with a bit counter showing   the actual number of significant digits): shift D'E'DE left withzero into the lo bit and the hi bit to carry; this carry        represents the hi binary digit of iX                                    - get a pointer to the tenth byte of the buffer, mem-4  byte 5; the lo digit of the print buffer                                - make a byte counter 05 for PF BYTES.                         _2E8A_PF_BYTES: get the byte at the pointer; it          represents two decimal digits, see below, initially both zero           - add it to itself with the carry; this doubles each of the decimal digits and adds the new binary digit to the lo      decimal digit                                                           - use the DAA "decimal adjust" instruction, with which  my readers are no doubt thoroughly familiar! It is used after   single-byte additions, subtractions, increments or decrements   when the bytes are meant to represent a pair of decimal digits. Eg if A is 37h representing 37d, and B is 84h representing 84d, ADD A,B will produce BBh in A without carry; but if the ADD A,B is followed by DAA, without disturbing the carry and half-carry flags, BBh is corrected to 21h with carry, representing 37d +   84d = 121d.                                                             So now the byte in the print buffer represents two      decimal digits; originally zero, and corrected each time a new  binary digit is added from iX                                           - put this byte back at the pointer                             - move the pointer back to the next highest byte                - decrement the byte counter and loop back to PF BYTES  until it reaches zero; this adds any carry from a lower byte    into the decimal digits in the higher byte                              - (all decimal digits adjusted for the new binary digit)loop back to PF BITS for the next binary digit                          - (up to nine decimal digits are now held in the five lobytes of the buffer, two to a byte) zero a byte buffer                  - put a source pointer on the sixth byte of the buffer, the first pair of digits, and a destination pointer on the firstbyte of the buffer                                                      - make a digit counter of nine                                  - use RLD to drop the hi digit; which is zero, there arenever more than nine digits. The RLD instruction rotates        _clockwise: