diff --git a/c64/basic/,aliases.s b/c64/basic/,aliases.s index 3a886555..a978b466 100644 --- a/c64/basic/,aliases.s +++ b/c64/basic/,aliases.s @@ -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 diff --git a/c64/basic/basic_main_loop.s b/c64/basic/basic_main_loop.s index bc7d7bda..aaab9f6e 100644 --- a/c64/basic/basic_main_loop.s +++ b/c64/basic/basic_main_loop.s @@ -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. diff --git a/c64/basic/cmd_new.s b/c64/basic/cmd_new.s index b1743998..6f97abcf 100644 --- a/c64/basic/cmd_new.s +++ b/c64/basic/cmd_new.s @@ -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: diff --git a/c64/basic/injest_number.s b/c64/basic/injest_number.s index 45042819..5587330b 100644 --- a/c64/basic/injest_number.s +++ b/c64/basic/injest_number.s @@ -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