[comp.sys.apple] Assembler FP routine usage

rdlanctot@instr.okanagan.bc.ca (Ryan Lanctot) (07/13/89)

Hi.  I found the article on using floating point numbers.  It's in the
September 1986 issue of Nibble 

rdlanctot@instr.okanagan.bc.ca (Ryan Lanctot) (07/13/89)

Hi.  I found the article on using floating point numbers.  It's in the
September 1986 issue of Nibble (Vol 7, no 9) on page 74.

Ryan Lanctot
<rdlanctot@instr.okanagan.bc.ca>
or try
<rdlanctot@instr.okanagan.bcc.cdn>

ldcol@PacBell.COM (Larry D Colton) (07/15/89)

In article <354*rdlanctot@instr.okanagan.bc.ca> rdlanctot@instr.okanagan.bc.ca (Ryan Lanctot) writes:
>
>Hi.  I found the article on using floating point numbers.  It's in the
>September 1986 issue of Nibble (Vol 7, no 9) on page 74.
>
>Ryan Lanctot
><rdlanctot@instr.okanagan.bc.ca>
>or try
><rdlanctot@instr.okanagan.bcc.cdn>


I'm not sure what information the original poster was seeking, but the Nibble 
article shows the reader how to use the FP routines built in the Applesoft in 
ROM.  This may suffice if the intent is to write some routines that will always
run on an Apple.  If the intent was to learn how to write 6502 code that will
handle FP math, then the Nibble article will not be sufficient.

It will probalby be necessary to make a trip to a bookstore and look through 
the table of contents of the various 6502 programming books.

-- 
Larry Colton                {att,bellcore,sun,ames,pyramid}!pacbell!ldcol

ggray@wpi.wpi.edu (Gary Gray) (07/16/89)

While we are on the subject of Assembler and FP, I have another question.  I
am trying to use the FP routines from a SYS application, i.e. no Basic.system
in sight.  Th problem is, these routines bomb out, apparently due to the fact
that basic system sets up some pointers somewhere for the routines use.
I got a code fragment from A2PRO.ERIC on GEnie, but the code does nothing
helpful.  What it does is store the locations of $36 and $37 and replace them
with the memory address of one of the labels in the code. It then jumps to
$E000.  At some point, I imagine, the Applesoft setup routine does a relative
jump from locations $36 & $37, which will dump it back into the code fragment.
 The code then restores the contents of $36 and $37 and ends.  
	I believe that location $E000 is a cold restart.  I also tried jumping
to location $E003, which is a warm restart.  The end result, though, is the
same, attepmting to run the code from merlin fails.  I am quite sure that this
problem is not with merlin, but with the routines themselves.  Anybody got any
suggestions?

Thanks
WARNING!! the opinions expressed above can be HAZARDOUS or FATAL if swallowed!

I mean, does anybody *really* care what pithy saying I put in here?

Gary Gray - inet ggray@wpi.wpi.edu - bitnet ggray@wpi.bitnet - GEnie G.GRAY6

JerryK@cup.portal.com (Jerry E Kindall) (07/17/89)

Gary Gray writes:

I got a code fragment from A2PRO.ERIC on GEnie, but the code does nothing 
helpful.  What it does is store the locations of $36 and $37 and replace 
them with the memory address of one of the labels in the code. It then 
jumps to $E000.  At some point, I imagine, the Applesoft setup routine 
does a relative jump from locations $36 & $37, which will dump it back 
into the code fragment.   The code then restores the contents of $36 and 
$37 and ends. 
        I believe that location $E000 is a cold restart.  I also tried 
jumping to location $E003, which is a warm restart.  The end result, 
though, is the same, attepmting to run the code from merlin fails.  I am 
quite sure that this problem is not with merlin, but with the routines 
themselves.  Anybody got any suggestions? 

(end quote)

Gary, the problem IS with Merlin.  If you're trying to run this code from
within Merlin, you should be aware that when you go into the Monitor from
Merlin, the language card memory is switched in.  The Applesoft ROM is not
available.  Try turning it into a SYS file (by ORGing it at $2000 and setting
the filetype to SYS using the TYP $FF instruction) and then launch it from a
program selector.

By the way, locations $36 and $37 are the Monitor's output vector (known as
CSW).  Whenever Applesoft (or any other program) wants to print a character,
it calls the Monitor ROM.  The Monitor ROM sends passes control to the routine
specified by the CSW.  What Eric's code fragment does is to grab control back
from Applesoft when it tries to print its prompt character.

/\    Jerry Kindall     JerryK@cup.portal.com
  \/  Death to COBOL    GEnie: A2.JERRY   ALink: A2 Jerry