Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!floyd!harpo!ihnp4!inuxc!pur-ee!uiucdcs!miller From: miller@uiucdcs.UUCP (miller ) Newsgroups: net.micro.cbm Subject: c64 floating point, part 3 - (nf) Message-ID: <5419@uiucdcs.UUCP> Date: Mon, 6-Feb-84 22:28:25 EST Article-I.D.: uiucdcs.5419 Posted: Mon Feb 6 22:28:25 1984 Date-Received: Thu, 9-Feb-84 13:43:16 EST Lines: 77 #N:uiucdcs:36100036:000:2719 uiucdcs!miller Feb 6 13:00:00 1984 This is the third in the series of how to use the Basic floating point subroutines from machine language on the c64. This time, we'll begin to look at what subroutines are out there for us to use. (Note: as before, most of what I say applies to the vic20 too (or any future major revisions of the c64). The only real changes are the addresses specified.) Also, it has come to my attention that info on the floating point routines is in the book "The VIC Revealed". I did not know this when I started this series. At any rate, since I'm sure there are others like me who do not have this book, I'll continue this series. Here are the first 15 subroutines: Integer to F1 $B391 (45969) A two byte integer value in SF is converted to a floating point number. The results are stored into F1. F1 to integer $B1AA (45482) F1 is converted into a two byte integer which is stored into $64-65 (100-101). F1 is trashed. Memory to F1 $BBA2 (48034) A 5 byte floating pt. no. anywhere in mem is loaded into F1. The address is in SF. The sign flag of F1 is set if the high order bit of the mantissa is set; otherwise it is reset. The exponent is returned in the A register. ASCII to F1 $B7B5 (47029) An ASCII string is converted to floating pt format and stored in F1. The length of the string is loaded into A; the starting location into the "utility string pointer" $22-23 (34-35). F1 to ASCII $BDDD (48605) F1 is converted into an ASCII string and stored starting at $0100 (256). A $00 terminates the string. Memory to F2 $BA8C (47756) Like above except F2 is used and the sign comparison flag is set. The exponent of F1 is returned in A. F1 to memory $BBD7 (48087) F1 is stored into any 5 byte location (X holds the MSB; Y the LSB of that loca- tion). The high order bit of the mantissa is forced to the F1 sign flag. F2 to F1 $BBFC (48124) Copy F2 to F1. F1 to F2 $BC0F (48143) Copy F1 to F2. Logical AND of F1 and F2 $AFE9 (45033) The results are placed into F1. Logical OR of F1 and F2 $AFE6 (45030) The results are placed into F1. F1 = F1 - F2 $B853 (47187) Subtraction. F1 = F1 + F2 $B86A (47210) Addition. You must set the sign comparison flag first. Do this by EORing lo- cations $66 and $6E and store the results in $6F. Also, load A with the value found in $61. Both of the functions can be done by the memory to F2 routine. F1 = F1 * F2 $BA30 (47664) Multiplication. Same notes apply as in addition. However, if you call $BA28 (47656) instead, the memory to F2 will be executed first and then this one automatically. F1 = LOG (F1) $B9EA (47954) Natural logarithm (base e). Next time I'll complete this series with the final 13 subroutines. A. Ray Miller Univ Illinois