THE FLOATING POINT PACKAGE

The remaining page zero locations from 212 to 255 are used by the OS's floating point package, a whole bunch of subroutines that BASIC uses when doing math and that kind of stuff. The routines themselves are stored in the OS ROM, so if you don't use them at all in your program, these locations will be free. Don't count on it though, even if you think you're not using the routines. They can sneak up on you when you least expect it.

Floating point math uses six-byte BCD, which was explained briefly under location VVTP (134,135). See the section in De Re Atari on the floating point package for more information.

Unfortunately, the listing for the floating point package is mighty hard to come by, so some of these locations are going to have real short explanations. My apologies to you, and my thanks to the OS Manual and Mapping the Atari for the information I couldn't find anywhere else.

FR0
212-217         00D4-00D9

Floating point register zero. A floating point register is just a place used to hold floating point numbers while operations are performed on them (it may also hold a partial result of an operation). They are all, including FR0 of course, six bytes long since they must hold a six byte BCD representation of the number.

FR0 is also used by the USR command. Remember that USR has the format X=USR(address [,argument][.... ]) where X can be any variable and the arguments are optional. If you want your machine language routine to give a value to X, you should store that value in the first two bytes of FR0 (212,213 - low byte and high byte respectively) before your RTS statement. BASIC will automatically convert these bytes into a floating point number and store it in X (or whatever variable you used for the call). If you're not using BASIC, you can use FR0 yourself to convert binary values to floating point and vice versa. Put the binary number in locations \$D4 and \$D5 and then JSR \$D9AA to convert to floating point (the result will be stored in FR0). To convert back, JSR \$D9D2. Note that you can't use these routines from BASIC since BASIC is constantly using FR0 and will mess up your values.

FRE
218-223         00DA-00DF

This isn't very well documented, but it appears to be an extra floating point register.

FR1
224-229         00E0-00E5

Floating point register one. FR1 has the same format as FR0 and is often used in conjunction with it, especially for two-number arithmetic.

FR2
230-235         00E6-00EB

Floating point register two.

FRX
236         00EC

A single-byte register used for single-byte calculations.

EEXP
237         00ED

The value of the exponent (E). I suspect this is the exponent of the floating point number currently being processed, but this is only a suspicion.

NSIGN
238         00EE

The sign of the floating point number (same suspicion as above).

ESIGN
239         00EF

The sign of the exponent in EEXP (237).

FCHRFLG
240         00F0

The first character flag. Your guess is as good as mine.

DIGRT
241         00F1

The number of digits to the right of the decimal point (zero to eight).

CIX
242         00F2

An offset into the text buffer pointed to by INBUFF.

INBUFF
243,244         00F3,00F4

Finally something that can be understood! There are times when BASIC has to convert an ATASCII representation of a number to the corresponding floating point value (like when you type in X =1000). INBUFF points to a buffer used to hold the ATASCII representation. The result gets stored in FR0.

See LBUFF (1408 to 1535) for the buffer itself.

ZTEMP1
245,246         00F5,00F6

A temporary register.

ZTEMP4
247,248         00F7,00F8

Another temporary register.

ZTEMP3
249,250         00F9,00FA

Still another temporary register (will it never end?).

251         00FB

RADFLG determines whether the trigonometric functions (SIN, COS, etc.) are performed in radians or degrees. If it's zero, then radians are used. If it's six, then degrees are in fashion. SYSTEM RESET and NEW both restore RADFLG to radians (zero).

BASIC also calls this location DEGFLG.

FLPTR
252,253         00FC,00FD

FLPTR holds the address of the floating point number that the package is now operating on. FLPTR and FPTR2 (to follow) point to the addresses where the results of the current operation will be stored. The documentation is sketchy though, so I'm just making an educated guess.

FPTR2
254,255         00FE,00FF

FPTR2 holds the address of the second floating point number that the package is operating on.