[comp.binaries.apple2] Applesoft function maker.

asd@mace.cc.purdue.edu (Kareth) (08/27/89)

This was mailed to me to post to the net.  Enjoy.

From: eldorado@en.ecn.purdue.edu (David Dietrich Jansen)

This is the code that "everyone" has been waiting for.  When run, it
prompts for a function in Applesoft form so 2cos x will not work.
Instead use 2*cos (x).  Also if more than one function is needed, no
problem, just DEF FN FOOBAR(X) and later use the command &FOOBAR.
The truth is that this is not my code.  It's from the book "Assembly
Language for the Applesoft Programmer" pages 178-181.  But it wouldn't
work so after fooling with the BASIC program, I came up with this WORKING
program.  To use, just cut on the dotted line, SAVE and EXEC the file,
and then RUN the BASIC program while making sure that the BIN FNINPT is
in the current directory.

-----------------------------CUT ME HERE----------------------------

5  POKE 1013,76: POKE 1014,00: POKE 1015,03
10  PRINT  CHR$ (4);"BLOAD FNINPT"
20  DEF  FN F(X) =  :::::::::::::::
30  INPUT "ENTER F(X) = ";F$: & F
40  X = 2
50 PRINT FN F(X)
SAVE FUNCTION
CALL -151
300:20 B7 00 09 80 85 14 20
308:EA DF A5 9B 85 FD A5 9C
310:85 FE A0 02 B1 FD 85 FB
318:C8 B1 FD 85 FC A5 B8 48
320:A5 B9 48 A9 00 85 B8 20
328:59 D5 98 18 E9 03 A8 A9
330:B2 91 FB 88 A9 3A 91 FB
338:88 B9 00 02 91 FB 88 10
340:F8 AD 00 02 A0 06 91 FD
348:68 85 B9 68 85 B8 60
BSAVE FNINPT,A$300,L$4F
3D0G