1romloc	=$c000          ;x16 basic rom
2lofbuf	=$ff            ;$FF the low fac buffer. copyable
3buflen	=89             ;vic buffer
4bufpag	=2
5buf	=512
6stkend	=507
7clmwid	=10             ;print window 10 chars
8pi	=255
9numlev	=23
10strsiz	=3
11
12.segment "ZPBASIC" : zeropage
13linnum	.res 2           ;$14 location to store line number before buf
14                         ;    so that "bltuc" can store it all away at once.
15                         ;    a comma (preload or from rom)
16                         ;    used by input statement since the
17                         ;    data pointer always starts on a
18                         ;    comma or terminator.
19
20poker	=linnum          ;$14 set up location used by poke
21                         ;    temporary for input and read code
22
23tempst	.res 9           ;$19 storage for numtmp temp descriptors
24
25
26; --- pointers into dynamic data structures ---;
27txttab	.res 2           ;$2B pointer to beginning of text.
28                         ;    doesn't change after being
29                         ;    setup by "init".
30frespc	.res 2           ;$35 pointer to new string
31inpptr	.res 2           ;$43 this remembers where input is coming from
32
33
34forpnt	.res 2           ;$49 a variable's pointer for "for" loops
35                         ;    and "let" statements
36lstpnt	=forpnt          ;$49 pntr to list string
37andmsk	=forpnt          ;$49 the mask used by wait for anding
38eormsk	=forpnt+1        ;$4A the mask for eoring in wait
39
40; CHRGET
41chrget	.res 6           ;$73
42chrgot	.res 1           ;$79
43txtptr	.res 6           ;$7A
44qnum	.res 11          ;$80
45
46; reused zero page from FPLIB
47addend	=resmo           ;$28 temporary used by "umult" (2 bytes)
48varpnt	=fdecpt          ;$47 pointer to variable in memory
49defpnt	=tempf3          ;$4E pointer used in function definition (2 bytes)
50grbpnt	=tempf3          ;$4E another used in garbage collection (2 bytes)
51dscpnt	=tempf3+2        ;$50 pointer to a string descriptor
52highds	=tempf1+1        ;$58 desination of highest element in blt
53arypnt	=tempf1+1        ;$58 a pointer used in array building
54hightr	=tempf1+3        ;$5A source of highest element to move (2 bytes)
55lowtr	=tempf2+3        ;$5F last thing to move in blt
56grbtop	=tempf2+3        ;$5F a pointer used in garbage collection
57dptflg	=tempf2+3        ;$5F base ten exponent
58expsgn	=tempf2+4        ;$60 sign of base ten exponent
59dsctmp	=fac             ;$61 this is where temp descs are built
60indice	=facmo           ;$64 indice is set up here by "qint"
61sgnflg	=degree          ;$67 sign of fac is preserved bere by "fin".
62strng1	=arisgn          ;$6F
63bufptr	=polypt          ;$71 pointer to buf used by "crunch".
64strng2	=polypt          ;$71 pointer to string or desc.
65curtol	=polypt          ;$71 absolute linear index is formed here.
66
67
68.segment "BVARS"
69;                      C64 location
70;                         VVV
71endchr	.res 1           ;$08 the other delimiting character
72trmpos	.res 1           ;$09 position of terminal carriage
73verck	.res 1           ;$0A CBM: single-use tmp for LOAD
74count	.res 1           ;$0B a general counter
75dimflg	.res 1           ;$0C in getting a pointer to a variable
76                         ;    it is important to remember whether it
77                         ;    is being done for "dim" or not.
78                         ;    dimflg and valtyp must be
79                         ;    consecutive locations.
80valtyp	.res 1           ;$0D the type indicator
81                         ;    0=numeric 1=string
82intflg	.res 1           ;$0E tells if integer
83dores	.res 1           ;$0F whether can or can't crunch res'd words YYY
84                         ;    turned on when "data"
85                         ;    being scanned by crunch so unquoted
86                         ;    strings won't be crunched
87garbfl	=dores           ;$0F whether to do garbage collection
88
89subflg	.res 1           ;$10 flag whether sub'd variable allowed.
90                         ;    "for" and user-defined function
91                         ;    pointer fetching turn
92                         ;    this on before calling "ptrget"
93                         ;    so arrays won't be detected.
94                         ;    "stkini" and "ptrget" clear it.
95                         ;    also disallows integers there.
96inpflg	.res 1           ;$11 flags whether we are doing "input"
97                         ;    or "read".
98
99channl	.res 1           ;$13 holds channel number
100temppt	.res 1           ;$16 pointer at first free temp descriptor
101                         ;    initialized to point to tempst
102
103lastpt	.res 2           ;$17 pointer to last-used string temporary
104vartab	.res 2           ;$2D pointer to start of simple
105                         ;    variable space.
106                         ;    updated whenever the size of the
107                         ;    program changes, set to [txttab]
108                         ;    by "scratch" ("new").
109arytab	.res 2           ;$2F pointer to beginning of array
110                         ;    table.
111                         ;    incremented by 6 whenever
112                         ;    a new simple variable is found, and
113                         ;    set to [vartab] by "clearc".
114strend	.res 2           ;$31end of storage in use.
115                         ;    increased whenever a new array
116                         ;    or simple variable is encountered.
117                         ;    set to [vartab] by "clearc".
118fretop	.res 2           ;$33 top of string free space
119memsiz	.res 2           ;$37 highest location in memory
120
121; --- line numbers and textual pointers ---:
122curlin	.res 2           ;$39 current line #.
123                         ;    set to 0,255 for direct statements
124oldlin	.res 2           ;$3B old line number (setup by ^c,"stop"
125                         ;    or "end" in a program).
126oldtxt	.res 2           ;$3D old line number (setup by ^c,"stop"
127                         ;    or "end" in a program).
128datlin	.res 2           ;$3F data line # -- remember for errors
129datptr	.res 2           ;$41 pointer to data. initialized to point
130                         ;    at the zero in front of [txttab]
131                         ;    by "restore" which is called by "clearc".
132                         ;    updated by execution of a "read"
133varnam	.res 2           ;$45 variable's name is stored here
134opptr	.res 2           ;$4B pointer to current op's entry in "optab"
135vartxt	=opptr           ;$4B pointer into list of variables
136opmask	.res 1           ;$4D mask created by current operator
137
138four6	.res 1           ;$53 variable constant used by garb collect
139
140jmper	.res 3           ;$54
141size	=jmper+1         ;$55
142basic_fa .res 1          ;    default device address
143
144; reused vars from FPLIB
145charac	=integr          ;$07 a delimiting character
146domask	=tansgn          ;$12 mask in use by relation operations
147
148.segment "BVECTORS" ;basic indirects
149
150ierror	.res 2           ;$0300 indirect error (output error in .x)
151imain	.res 2           ;$0302 indirect main (system direct loop)
152icrnch	.res 2           ;$0304 indirect crunch (tokenization routine)
153iqplop	.res 2           ;$0306 indirect list (char list)
154igone	.res 2           ;$0308 indirect gone (char dispatch)
155ieval	.res 2           ;$030A indirect eval (symbol evaluation)
156; sys 6502 regs
157sareg	.res 1           ;$030C .a reg
158sxreg	.res 1           ;$030D .x reg
159syreg	.res 1           ;$030E .y reg
160spreg	.res 1           ;$030F .p reg
161usrpok	.res 3           ;$0310 user function dispatch
162