Re: A86: sub


[Prev][Index][Thread]

Re: A86: sub




At 15:48 1999-09-18 -0400, you wrote:
>
>ops are 11 bytes. The format is a bit strange and I can't really
understand it.
>Two of the bytes are used like flag bytes (one for sign and if it is real, the
>other for exponetal).
>I not sure where to find info on this topic because I want to know as well.

It's very easy actually, compared to the IEEE 754 standard used on most
computers today for floating point numbers.

The OP "registers" are 10 bytes in size. The first byte is the sign
byte, where only bit 7 is used. If it is set, the number is negative.

The two bytes after that is the exponent (stored with LSB first). Only the
last 11 bits are used (the first 5 are set to 1), thus the range is
$F800-$FFFF, where $FC00=exponent 0 ($FC04 = 10^4, $FBFE = 10^-2 etc).
(Note: this allows for a max exponent of 1023, which seems logical since
the actual max exponent in TI-OS is 999).

The last 7 bytes is the mantissa, stored in BCD. The first BCD digit
is on the left side of the decimal point, the others to the right.

Example:

 -0.86 is stored like this:

 Byte 0  : $80  (negative number, bit 7 set)
 Byte 1-2: $FF $FB  (that is, $FBFF which is -1 since $FC00 = 0)
 Byte 3-9: $86 $00 $00 $00 $00 $00 $00

That is, -1 * 10^-1 * 8.6 = -0.86

--
Jimmy Mårdell                   "God made machine language;
mailto:yarin@acc.umu.se          all the rest is the work of man."
http://www.acc.umu.se/~yarin/    



References: