1;----------------------------------------------------------------------
2; Floating Point Library for 6502: Variables
3;----------------------------------------------------------------------
4
5addprc	=1
6fbuffr	=$100    ; buffer for "fout".
7                 ; on page 1 so that string is not copied
8
9; XXX Dependencies on BASIC:
10; XXX FPLIB should not jump to the BASIC error handler.
11; XXX Instead, FP functions should return an error code,
12; XXX and BASIC jumps to the error handler.
13.import error, fcerr    ; code
14.importzp errdvo, errov ; constants
15
16.segment "ZPFPLIB" : zeropage
17
18;                      C64 location
19;                         VVV
20index1	.res 2           ;$22 indexes
21index	=index1          ;$22
22index2	.res 2           ;$24
23
24resho	.res 1           ;$26 result of multiplier and divider
25resmoh	.res 1           ;$27
26resmo	.res 1           ;$28
27reslo	.res 1           ;$29
28resov	.res 1           ;$2A fifth byte for res
29
30fdecpt	.res 2           ;$47 pointer into power of tens of "fout"
31
32tempf3	.res 5           ;$4E a third fac temporary
33
34tempf1	.res 5           ;$57 5 bytes temp fac
35
36tempf2	.res 5           ;$5C 5 bytes temp fac
37deccnt	=tempf2+1        ;$5D number of places before decimal point
38tenexp	=tempf2+2        ;$5E has a dpt been input?
39
40; --- the floating accumulator ---:
41fac                      ;$61
42facexp	.res 1           ;$61
43facho	.res 1           ;$62 most significant byte of mantissa
44facmoh	.res 1           ;$63 one more
45facmo	.res 1           ;$64 middle order of mantissa
46faclo	.res 1           ;$65 least sig byte of mantissa
47facsgn	.res 1           ;$66 sign of fac (0 or -1) when unpacked
48
49degree	.res 1           ;$67 a count used by polynomials
50sgnflg =degree
51
52; --- the floating argument (unpacked) ---:
53argexp	.res 1           ;$69
54argho	.res 1           ;$6A
55argmoh	.res 1           ;$6B
56argmo	.res 1           ;$6C
57arglo	.res 1           ;$6D
58argsgn	.res 1           ;$6E
59arisgn	.res 1           ;$6F a sign reflecting the result
60reshop =arisgn
61facov	.res 1           ;$70 overflow byte of the fac
62
63polypt	.res 2           ;$71 pointer into polynomial coefficients.
64fbufpt	=polypt          ;$71 pointer into fbuffr used by fout
65
66.segment "FPVARS"
67
68integr	.res 1           ;$07 a one-byte integer from "qint"
69tansgn	.res 1           ;$12 used in determining sign of tangent
70oldov	.res 1           ;$56 the old overflow
71fachop =oldov
72bits	.res 1           ;$68 something for "shiftr" to use
73rndx	.res 5           ;$8B
74