diff src/defs.s @ 132:917b4893bb3d

Checkpoint before redoing a bunch of code for clarity
author William Astle <lost@l-w.ca>
date Mon, 24 Jun 2024 23:44:39 -0600
parents 5d5472b11ccd
children 18940aa42dcf
line wrap: on
line diff
--- a/src/defs.s	Sat May 18 00:41:46 2024 -0600
+++ b/src/defs.s	Mon Jun 24 23:44:39 2024 -0600
@@ -14,6 +14,21 @@
 stringstacknum  equ 20                          ; number of entries on the anonymous string descriptor stack
 stackheadroom   equ 50                          ; required headroom for the stack on OM checks
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+; Program storage structure
+;
+; The program itself consists of two sets of data. The first is a table of line numbers. Each consists of a 16 bit
+; pointer to the line data and a 16 bit unsigned line number. These entries are stored in line number order. The line
+; data is also stored in line number order. The length of each line is the difference between the current line pointer
+; and the next line pointer. There is a final dummy line number entry after the last program line which holds the
+; pointer to the first free byte after the program. This is stored there to allow for simpler code for calculating line
+; lengths.
+;
+; Note: linetab_stride + linetabent_size must be a power of two *less than* 256
+linetabent_ptr  equ 0                           ; offset of the pointer to the line data (must be first)
+linetabent_num  equ 2                           ; offset to line number
+linetabent_size equ 4                           ; size of a line number table entry, must be power of two
+linetab_stride  equ 16                          ; expand the line table in blocks of 16 entries, must be power of two
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ; Data structure used for calculations. Calculations are handled via structures called value accumulators. A value
 ; accumulator consists of a data type flag (at the end of the structure) and a data area whose layout varies based
 ; on the actual data type. The layouts for each value type are described below.