Mercurial > hg > index.cgi
view src/vars.s @ 136:e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
author | William Astle <lost@l-w.ca> |
---|---|
date | Fri, 12 Jul 2024 23:29:45 -0600 |
parents | 917b4893bb3d |
children |
line wrap: on
line source
*pragmapush list *pragma list ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Start of memory which has the direct page and other data. org 0 dpstart equ * ; start of direct page zero rmb 2 ; constant zero word used for faster zeroing of 16 bit registers binval rmb 2 ; arbitary binary value, usually a line number or integer memtop rmb 2 ; absolute top of memory in 64K memory map memsize rmb 2 ; top of memory not reserved freetop rmb 2 ; top of free memory (bottom of string space) stringtab rmb 2 ; bottom of used string space cstackptr rmb 2 ; bottom of the "stack frame" stack (the actual stack is below here) prog_linetab rmb 2 ; pointer to start of the program line table prog_linetabp rmb 2 ; pointer to the first free program line table entry prog_text rmb 2 ; start of the program text data (immediately after the line table) vartab rmb 2 ; pointer to start of integer scalars (the runtime heap) objecttab rmb 2 ; pointer to start of arrays and other variable sized objects freestart rmb 2 ; pointer to start of unallocated memory readlinenoecho rmb 1 ; if nonzero, the readline routine won't echo its input console_curptr rmb 2 ; current cursor pointer for console driver console_blnkdel rmb 1 ; cursor blink delay console_truelc rmb 1 ; set to nonzero if the console supports true lower case (gfx, etc.) filenum rmb 1 ; current input/output channel fileeof rmb 1 ; flag for whether last read detected EOF keyb_flags rmb 1 ; shift flags for the keyboard keyb_joystate rmb 1 ; joystick button state keyb_repdel rmb 1 ; repeat delay keyb_curscan rmb 1 ; current repeating scan code keyb_buffw rmb 2 ; keyboard ring buffer write pointer keyb_buffr rmb 2 ; keyboard ring buffer read pointer curline rmb 2 ; pointer to current line contline rmb 2 ; pointer to line for CONT contstmt rmb 2 ; interpretation pointer for CONT curstmt rmb 2 ; start of statement currently being interpreted endflag rmb 1 ; 00 = END, FF = STOP stringstackptr rmb 2 ; anonymous string descriptor stack pointer tok_skipkw rmb 1 ; flag for when skipping an unrecognized keyword tok_skipdt rmb 1 ; flag for when processing DATA tok_kwtype rmb 1 ; primary/secondary type flag for tokens tok_kwnum rmb 1 ; the actual token number tok_kwmatchl rmb 1 ; the length of the best match during lookup tok_kwmatch rmb 2 ; the current best matched token number parse_noout rmb 1 ; flag for whether we're outputting encoded lines when parsing parse_tokenst rmb 2 ; pointer into input buffer of start of currently parsed token parse_curtok rmb 1 ; current token type code parse_stackptr rmb 2 ; saved stack pointer for bailing out from random parse points rmb 0x71-* ; align RSTFLG/RSTVEC for stock ROM compatibility RSTFLG rmb 1 ; 0x55 if RSTVEC is valid RSTVEC rmb 2 ; points to warm start routine (must start with NOP) inputptr rmb 2 ; pointer to current program execution location ; General value accumulators used during expression evaluation. These are in the same format used for storing ; values in variables with the exception of having a type flag. val0 rmb val.size ; value accumulator 0 - current expression value val1 rmb val.size ; value accumulator 1 - usually left operand of binary operator ; The fpa0 and fpa1 areas are used for scratch work during floating point operations. They are only used by ; floating point operations and operations related to floating point such as number conversion. This saves a fair ; few clock cycles over simply working off the index register pointers passed into the routines and it also allows ; for being able to leave the input operands for the routines unmodified, or to overlap the input and output ; operands. These floating point accumulators can hold the maximum precision floating point values used by the ; system. fpa0 rmb fpa.size ; floating point accumulator 1 fpa1 rmb fpa.size ; floating point accumulator 1 fpaextra rmb 12 ; "extra" bytes for calculations rmb 0x100-* ; make sure the stuff that isn't direct page is outside of it SW3VEC rmb 3 ; SWI3 vector (for compatibility) SW2VEC rmb 3 ; SWI2 vector (for compatibility) SWIVEC rmb 3 ; SWI vector (for compatibility) NMIVEC rmb 3 ; NMI vector (for compatibility) IRQVEC rmb 3 ; IRQ vector (for compatibility) FRQVEC rmb 3 ; FIRQ vector (for compatibility) keyb_state rmb 8 ; rollover table state keyb_buff rmb keyb_bufflen ; the keyboard ring buffer linebuff rmb linebuffsize ; the line input buffer tokebuff rmb linebuffsize+50 ; make it as long as line buffer plus a margin stringstack rmb 5*stringstacknum ; reserve space for the anonymous string descriptor stack stringstackend equ * ; end of string stack buffer strbuff rmb 20 ; temporary string buffer for converting numbers and other things ifne *&0x1ff rmb 0x200-(*&0x1ff) endc textscreen rmb 0x200 ; the actual text screen (must be on 512 byte alignment) heapstart equ * ; start of dynamically allocated stuff ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; The heap has the following items in order: ; ; Program text: preceded by a NUL and pointed to by progtext ; Variable table: pointed to by vartab; contains records for all scalar and array variables ; Free space: unused memory between the object table and the stack; pointed to by freestart ; The stack: grows downward from the bottom of string space, pointed to by the stack pointer, obviously ; String space: garbage collected non-constant string data pointed to by freetop ; Reserved memory: immediately above string space; pointed to by memsize ; Actual top of RAM: top of reserved memory; pointed to by memtop ; ; The variable table consists of several symbol tables defined as follows: ; ; Pointer Size of entry Variable types ; vartabint 4 Integer scalars ; vartablong 6 Long integer scalars ; vartabfloat 7 Floating point scalars ; vartabstring 6 String scalars ; ; Each entry starts with 2 bytes for the variable name followed by the data payload. *pragmapop list