properly initialise memory when BASIC starts.

This commit is contained in:
Paul Gardner-Stephen committed 2019-04-27 23:08:11 +09:30
1 parent eef572e0ab
commit 6d57d17b74
4 files changed
+25 -7

No files matched your search

+1 -1
View File
@@ -24,7 +24,7 @@
.alias basic_end_of_arrays_ptr $31
.alias basic_start_of_free_space_ptr $31
.alias basic_start_of_strings_ptr $33
.alias basic_top_of_memory_ptr $35
.alias basic_top_of_memory_ptr $37
.alias basic_numeric_work_area $57 ; $57 - $60 inclusive = 10 bytes
+1 -4
View File
@@ -75,9 +75,6 @@ rsl_l1: lda $0200,x
jsr injest_number
lda tokenise_work1
sta $0427
;; Check if the number is a valid line number
;; i.e., 16 bits, no exponent, no decimal
lda basic_fac1_mantissa+2
@@ -90,7 +87,7 @@ ml_bad_line_number:
jmp do_basic_error
* lda tokenise_work4
cmp #$ff
beq ml_bad_line_number
bne ml_bad_line_number
;; Got a valid line number.
+23 -1
View File
@@ -11,12 +11,34 @@ basic_do_new:
;; Setup pointers to memory storage
lda #<$0801
sta basic_start_of_text_ptr+0
lda >$0801
lda #>$0801
sta basic_start_of_text_ptr+1
sta basic_start_of_vars_ptr+1
lda #<$0803
sta basic_start_of_vars_ptr+0
;; Get top of memory.
;; If a cart is present, then it is $7FFF,
;; if not, then it is $F7FF, since we support having
;; programs and variables under ROM.
;; i.e., we support 56KB RAM for BASIC, keeping some space
;; free for some optimisation structures, e.g., FOR/NEXT loop
;; records (without them going on the stack), GOSUB stack
;; (same story), expression value cache?
sec ; Read, not write value
jsr $ff99 ; KERNAL MEMTOP routine
cpx #$80
bne +
lda #>$f7ff
.byte $2c
* lda #>$7FFF
sta basic_top_of_memory_ptr+1
sta basic_start_of_strings_ptr+1
lda #<$f7ff
sta basic_top_of_memory_ptr+0
sta basic_start_of_strings_ptr+0
;; FALL THROUGH
basic_do_clr:
-1
View File
@@ -15,7 +15,6 @@ ij_not_a_digit:
;; exponent or mantissa digits
;; Look for decimal point
sta $0420
cmp #$2e
bne ij_not_decimal
lda tokenise_work4