Re: 64 ROM F.P. question

From: Brian Ketterling (
Date: 2003-10-29 00:54:53

Hi --

With a little closer study I guess I've answered my own questions -- thanks, 
Willi and John, for being a sounding board and helping me focus!

I don't know if anyone else will ever be interested in passing big numbers 
back and forth between BASIC and ML, but...

It turns out that the routine at BC9B is called by BASIC's INT() function.  
It literally turns the f.p. number into a binary integer, then converts it 
back again to f.p.

I was wrong about the format of negative numbers.  It doesn't flag them with 
the MSbit, but instead does a complement-thing, e.g.:

-1 = FF FF FF FF
-2 = FF FF FF FE

Also, INT's floor-function operation (+1.1 becomes +1, -1.1 becomes -2... 
always downward) is built into the first conversion routine at BC9B.

So, negative numbers could be a hassle, but for passing positive 4-byte 
integers to BASIC, it looks like you just have to preload $62-$65 with the 
number (highest byte first), LDY #0, then jump into INT with JSR $BCD5.  The 
result will be in FAC1.

-- Brian

Surf and talk on the phone at the same time with broadband Internet access. 
Get high-speed for as low as $29.95/month (depending on the local service 
providers in your area).

       Message was sent through the cbm-hackers mailing list

Archive generated by hypermail pre-2.1.8.