annotate src/vars.s @ 73:2d52cd154ed1

Split some code into separate files for easier management Because the source for lwbasic is so large, split it into several different files to make it easier to navigate and modify. This is part one of the split.
author William Astle <lost@l-w.ca>
date Sun, 06 Aug 2023 00:12:29 -0600
parents
children bb50ac9fdf37
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
73
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
1 *pragmapush list
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
2 *pragma list
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
3 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
4 ; Start of memory which has the direct page and other data.
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
5 org 0
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
6 dpstart equ * ; start of direct page
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
7 zero rmb 2 ; constant zero word used for faster zeroing of 16 bit registers
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
8 binval rmb 2 ; arbitary binary value, usually a line number or integer
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
9 memtop rmb 2 ; absolute top of memory in 64K memory map
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
10 memsize rmb 2 ; top of memory not reserved
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
11 freetop rmb 2 ; top of free memory (bottom of string space)
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
12 stringtab rmb 2 ; bottom of used string space
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
13 stackptr rmb 2 ; bottom of the "stack frame" stack (the actual stack is below here)
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
14 progtext rmb 2 ; pointer to start of program text
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
15 vartab rmb 2 ; pointer to start of integer scalars
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
16 objecttab rmb 2 ; pointer to start of arrays and other variable sized objects
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
17 freestart rmb 2 ; pointer to start of unallocated memory
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
18 readlinenoecho rmb 1 ; if nonzero, the readline routine won't echo its input
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
19 console_curptr rmb 2 ; current cursor pointer for console driver
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
20 console_blnkdel rmb 1 ; cursor blink delay
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
21 console_truelc rmb 1 ; set to nonzero if the console supports true lower case (gfx, etc.)
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
22 filenum rmb 1 ; current input/output channel
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
23 fileeof rmb 1 ; flag for whether last read detected EOF
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
24 keyb_flags rmb 1 ; shift flags for the keyboard
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
25 keyb_joystate rmb 1 ; joystick button state
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
26 keyb_repdel rmb 1 ; repeat delay
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
27 keyb_curscan rmb 1 ; current repeating scan code
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
28 keyb_buffw rmb 2 ; keyboard ring buffer write pointer
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
29 keyb_buffr rmb 2 ; keyboard ring buffer read pointer
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
30 curline rmb 2 ; pointer to current line
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
31 contline rmb 2 ; pointer to line for CONT
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
32 contstmt rmb 2 ; interpretation pointer for CONT
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
33 curstmt rmb 2 ; start of statement currently being interpreted
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
34 endflag rmb 1 ; 00 = END, FF = STOP
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
35 stringstackptr rmb 2 ; anonymous string descriptor stack pointer
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
36 tok_skipkw rmb 1 ; flag for when skipping an unrecognized keyword
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
37 tok_skipdt rmb 1 ; flag for when processing DATA
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
38 tok_kwtype rmb 1 ; primary/secondary type flag for tokens
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
39 tok_kwnum rmb 1 ; the actual token number
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
40 tok_kwmatchl rmb 1 ; the length of the best match during lookup
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
41 tok_kwmatch rmb 2 ; the current best matched token number
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
42 val0 rmb val.size ; value accumulator 0
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
43 val1 rmb val.size ; value accumulator 1
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
44 rmb 0x71-* ; align RSTFLG/RSTVEC for stock ROM compatibility
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
45 RSTFLG rmb 1 ; 0x55 if RSTVEC is valid
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
46 RSTVEC rmb 2 ; points to warm start routine (must start with NOP)
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
47 inputptr rmb 2 ; pointer to current program execution location
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
48 rmb 0x100-* ; make sure the stuff that isn't direct page is outside of it
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
49 SW3VEC rmb 3 ; SWI3 vector (for compatibility)
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
50 SW2VEC rmb 3 ; SWI2 vector (for compatibility)
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
51 SWIVEC rmb 3 ; SWI vector (for compatibility)
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
52 NMIVEC rmb 3 ; NMI vector (for compatibility)
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
53 IRQVEC rmb 3 ; IRQ vector (for compatibility)
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
54 FRQVEC rmb 3 ; FIRQ vector (for compatibility)
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
55 keyb_state rmb 8 ; rollover table state
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
56 keyb_buff rmb keyb_bufflen ; the keyboard ring buffer
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
57 linebuff rmb linebuffsize ; the line input buffer
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
58 tokebuff rmb linebuffsize+50 ; make it as long as line buffer plus a margin
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
59 stringstack rmb 5*stringstacknum ; reserve space for the anonymous string descriptor stack
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
60 stringstackend equ * ; end of string stack buffer
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
61 ifne *&0x1ff
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
62 rmb 0x200-(*&0x1ff)
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
63 endc
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
64 textscreen rmb 0x200 ; the actual text screen (must be on 512 byte alignment)
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
65 heapstart equ * ; start of dynamically allocated stuff
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
66 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
67 ; The heap has the following items in order:
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
68 ;
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
69 ; Program text: preceded by a NUL and pointed to by progtext
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
70 ; Variable table: pointed to by vartab; contains records for all scalar and array variables
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
71 ; Free space: unused memory between the object table and the stack; pointed to by freestart
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
72 ; The stack: grows downward from the bottom of string space, pointed to by the stack pointer, obviously
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
73 ; String space: garbage collected non-constant string data pointed to by freetop
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
74 ; Reserved memory: immediately above string space; pointed to by memsize
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
75 ; Actual top of RAM: top of reserved memory; pointed to by memtop
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
76 ;
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
77 ; The variable table consists of several symbol tables defined as follows:
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
78 ;
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
79 ; Pointer Size of entry Variable types
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
80 ; vartabint 4 Integer scalars
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
81 ; vartablong 6 Long integer scalars
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
82 ; vartabfloat 7 Floating point scalars
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
83 ; vartabstring 6 String scalars
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
84 ;
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
85 ; Each entry starts with 2 bytes for the variable name followed by the data payload.
2d52cd154ed1 Split some code into separate files for easier management
William Astle <lost@l-w.ca>
parents:
diff changeset
86 *pragmapop list