changeset 137:18940aa42dcf

Clean up some details in cold start initialization
author William Astle <lost@l-w.ca>
date Sat, 13 Jul 2024 12:56:05 -0600
parents e49bd0493baf
children 4983ba49f936
files src/defs.s src/init.s
diffstat 2 files changed, 5 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/defs.s	Fri Jul 12 23:29:45 2024 -0600
+++ b/src/defs.s	Sat Jul 13 12:56:05 2024 -0600
@@ -13,6 +13,7 @@
 linebuffsize    equ 0x100                       ; the line input buffer (256 bytes)
 stringstacknum  equ 20                          ; number of entries on the anonymous string descriptor stack
 stackheadroom   equ 50                          ; required headroom for the stack on OM checks
+stringspacedef  equ 200                         ; default string space allocation
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ; Program storage structure
 ;
--- a/src/init.s	Fri Jul 12 23:29:45 2024 -0600
+++ b/src/init.s	Sat Jul 13 12:56:05 2024 -0600
@@ -211,19 +211,12 @@
 coldstart2      stx memtop                      ; save absolute top of memory
                 stx memsize                     ; save top of unreserved memory
                 stx stringtab                   ; mark string space as empty
-                leax -200,x                     ; allocate 200 bytes of string space
+                leax -stringspacedef,x          ; allocate 200 bytes of string space
                 stx freetop                     ; save top of free memory
-                clr ,-x                         ; make a hole for the "end of call stack" flag
-                stx cstackptr                   ; save the new call stack pointer
-                leas ,x                         ; put the actual stack below the above
+                leas ,x                         ; put the stack there; will be reset by cmd_newraw
                 ldx #heapstart                  ; point to start of free memory
-                clr ,x+                         ; put a NUL before the start of the program
-                stx prog_text                   ; put the start of the program there
-                clr ,x+                         ; put a NULL pointer to mark end of program
-                clr ,x+
-                stx vartab                      ; put start of integer variables at end of program
-                stx objecttab                   ; also put the start of large objects there
-                stx freestart                   ; mark the start of free memory
+                stx prog_linetab                ; put the program line table there
+                jsr cmd_newraw                  ; go fully initialize the memory structure pointers
                 lda #keyb_caps                  ; enable caps lock but disable all other shift states
                 sta keyb_flags
                 ldx #warmstart                  ; set up warm start handler