moved most of the CLR and NEW commands to Mega65 extra ROM segment

This commit is contained in:
FeralChild64 committed 2020-02-26 22:36:08 +01:00
1 parent d1bc38694d
commit 4a510d78fd
6 files changed
+108 -81

No files matched your search

+90
View File
@@ -0,0 +1,90 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# M65 * #TAKE
// #LAYOUT# X16 BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
basic_do_new:
#if (ROM_LAYOUT_M65 && SEGMENT_BASIC_0)
jsr map_BASIC_1
jsr_ind VB1__basic_do_new
jmp map_NORMAL
basic_do_clr:
jsr map_BASIC_1
jsr_ind VB1__basic_do_clr
jmp map_NORMAL
#else
// Setup pointers to memory storage XXX should depend on text start vector
lda #<$0801
sta TXTTAB+0
lda #>$0801
sta TXTTAB+1
sta VARTAB+1
lda #<$0803
sta VARTAB+0
// Zero line pointer
// XXX - We should also zero $0800, i.e., TXTTAB - 1
ldy #$00
tya
sta (TXTTAB),y
iny
sta (TXTTAB),y
// 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 JMEMTOP
cpx #$80
beq !+
#if CONFIG_MEMORY_MODEL_60K
lda #>$F7FF
#else // CONFIG_MEMORY_MODEL_38K
lda #>$A000
#endif
.byte $2C
!:
#if CONFIG_MEMORY_MODEL_60K
lda #>$F7FF
#else // CONFIG_MEMORY_MODEL_38K
lda #>$A000
#endif
sta MEMSIZ+1
sta FRETOP+1
#if CONFIG_MEMORY_MODEL_60K
lda #<$F7FF
#else // CONFIG_MEMORY_MODEL_38K
lda #<$A000
#endif
sta MEMSIZ+0
sta FRETOP+0
// FALL THROUGH
basic_do_clr:
// Clear variables, arrays and strings
lda VARTAB+0
sta ARYTAB+0
sta STREND+0
lda VARTAB+1
sta ARYTAB+1
sta STREND+1
rts
#endif // ROM layout
@@ -15,6 +15,8 @@
.label VB1__tokenise_line = $4000 + 2 * 1
.label VB1__list_single_line = $4000 + 2 * 2
.label VB1__print_packed_message = $4000 + 2 * 3
.label VB1__basic_do_clr = $4000 + 2 * 4
.label VB1__basic_do_new = $4000 + 2 * 5
#else
@@ -24,5 +26,7 @@
.word tokenise_line
.word list_single_line
.word print_packed_message
.word basic_do_clr
.word basic_do_new
#endif
+1 -1
View File
@@ -10,8 +10,8 @@
.label peek_under_roms = BASIC_0.proxy_B1_peek_under_roms
.label JCHROUT = BASIC_0.proxy_B1_JCHROUT
.label JMEMTOP = KERNAL_0.JMEMTOP
.label plot_set = KERNAL_0.plot_set
.label basic_do_new = BASIC_0.proxy_B1_basic_do_new
.label rom_revision_basic_string = BASIC_0.rom_revision_basic_string
.label print_integer = BASIC_0.proxy_B1_print_integer
.label print_return = BASIC_0.proxy_B1_print_return
-7
View File
@@ -24,13 +24,6 @@ proxy_B1_JCHROUT:
jmp map_BASIC_1
proxy_B1_basic_do_new:
jsr map_NORMAL
jsr basic_do_new
jmp map_BASIC_1
proxy_B1_print_integer:
jsr map_NORMAL
+12
View File
@@ -0,0 +1,12 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
cmd_clr:
jsr basic_do_clr
// CLR command does not stop execution
// (Cconfirmed on a c64)
jmp basic_execute_statement
+1 -73
View File
@@ -4,81 +4,9 @@
cmd_new:
jsr basic_do_new
// NEW command terminates execution
// (Confirmed on a C64)
jmp basic_main_loop
cmd_clr:
jsr basic_do_clr
// CLR command does not stop execution
// (Cconfirmed on a c64)
jmp basic_execute_statement
basic_do_new:
// Setup pointers to memory storage XXX should depend on text start vector
lda #<$0801
sta TXTTAB+0
lda #>$0801
sta TXTTAB+1
sta VARTAB+1
lda #<$0803
sta VARTAB+0
// Zero line pointer
// XXX - We should also zero $0800, i.e., TXTTAB - 1
ldy #$00
tya
sta (TXTTAB),y
iny
sta (TXTTAB),y
// 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 JMEMTOP
cpx #$80
beq !+
#if CONFIG_MEMORY_MODEL_60K
lda #>$F7FF
#else // CONFIG_MEMORY_MODEL_38K
lda #>$A000
#endif
.byte $2C
!:
#if CONFIG_MEMORY_MODEL_60K
lda #>$F7FF
#else // CONFIG_MEMORY_MODEL_38K
lda #>$A000
#endif
sta MEMSIZ+1
sta FRETOP+1
#if CONFIG_MEMORY_MODEL_60K
lda #<$F7FF
#else // CONFIG_MEMORY_MODEL_38K
lda #<$A000
#endif
sta MEMSIZ+0
sta FRETOP+0
// FALL THROUGH
basic_do_clr:
// Clear variables, arrays and strings
lda VARTAB+0
sta ARYTAB+0
sta STREND+0
lda VARTAB+1
sta ARYTAB+1
sta STREND+1
rts