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