several features are now optional, added legacy BASIC memory model
This commit is contained in:
1 parent
49e8b75b85
commit
ed51a62f32
30 files changed
+555
-72
No files matched your search
@@ -113,6 +113,8 @@
|
||||
.label enable_case_switch = $0291
|
||||
.label screen_scroll_disable = $0292
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
|
||||
// BASIC uses some extra bytes for memory access under ROMs located at $2A7 onwards
|
||||
// IRQs are disabled when doing such accesses, and a default NMI handler only increments
|
||||
// a counter, so that if an NMI occurs, it doesn't crash the machine, but can be captured.
|
||||
@@ -124,3 +126,5 @@
|
||||
.label poke_under_roms = tiny_nmi_handler+poke_under_roms_routine-tiny_nmi_handler_routine
|
||||
.label memmap_allram = tiny_nmi_handler+memmap_allram_routine-tiny_nmi_handler_routine
|
||||
.label memmap_normal = tiny_nmi_handler+memmap_normal_routine-tiny_nmi_handler_routine
|
||||
|
||||
#endif // CONFIG_MEMORY_MODEL_60K
|
||||
@@ -14,12 +14,24 @@ basic_delete_line:
|
||||
// .byte $0d,0
|
||||
|
||||
// Get address of next line
|
||||
ldx #<basic_current_line_ptr
|
||||
ldy #0
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<basic_current_line_ptr
|
||||
jsr peek_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (basic_current_line_ptr),y
|
||||
#endif
|
||||
|
||||
sta tokenise_work3
|
||||
iny
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
jsr peek_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (basic_current_line_ptr),y
|
||||
#endif
|
||||
|
||||
sta tokenise_work4
|
||||
|
||||
// Work out length of this line by looking at the pointer
|
||||
|
||||
@@ -2,10 +2,15 @@
|
||||
// after first checking that we have a colon
|
||||
// or $00 char
|
||||
|
||||
basic_end_of_statement_check:
|
||||
ldx #<basic_current_statement_ptr
|
||||
basic_end_of_statement_check:
|
||||
ldy #0
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<basic_current_statement_ptr
|
||||
jsr peek_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (basic_current_statement_ptr),y
|
||||
#endif
|
||||
|
||||
// Consume any spaces
|
||||
cmp #$20
|
||||
@@ -35,8 +40,14 @@ basic_execute_statement:
|
||||
!:
|
||||
// Skip over any white space and :
|
||||
ldy #0
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<basic_current_statement_ptr
|
||||
jsr peek_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (basic_current_statement_ptr),y
|
||||
#endif
|
||||
|
||||
jsr basic_end_of_statement_check
|
||||
bcs basic_end_of_line
|
||||
|
||||
@@ -58,10 +69,17 @@ basic_execute_statement:
|
||||
|
||||
// Get next char of program text, even if it is hiding under a ROM or the
|
||||
// IO area.
|
||||
ldx #<basic_current_statement_ptr
|
||||
|
||||
ldy #0
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<basic_current_statement_ptr
|
||||
jsr peek_under_roms
|
||||
cmp #$00
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (basic_current_statement_ptr),y
|
||||
#endif
|
||||
|
||||
beq basic_end_of_line
|
||||
|
||||
// The checks should be done in order of frequency, so that we are as
|
||||
@@ -94,7 +112,7 @@ not_a_token:
|
||||
cmp #$3a
|
||||
beq basic_skip_char
|
||||
|
||||
// START wedge support
|
||||
#if CONFIG_DOS_WEDGE
|
||||
|
||||
// Are we in direct mode?
|
||||
// DOS Wedge is a hacky solution (inelegant, but convenient),
|
||||
@@ -111,7 +129,8 @@ not_a_token:
|
||||
jsr basic_consume_character
|
||||
jmp wedge_dos
|
||||
!:
|
||||
// END wedge support
|
||||
|
||||
#endif // CONFIG_DOS_WEDGE
|
||||
|
||||
// If all else fails, it's a syntax error
|
||||
jmp do_SYNTAX_error
|
||||
@@ -122,8 +141,14 @@ basic_skip_char:
|
||||
|
||||
basic_fetch_and_consume_character:
|
||||
ldy #0
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<basic_current_statement_ptr
|
||||
jsr peek_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (basic_current_statement_ptr),y
|
||||
#endif
|
||||
|
||||
// FALL THROUGH
|
||||
|
||||
basic_consume_character:
|
||||
@@ -179,8 +204,7 @@ basic_execute_from_current_line:
|
||||
// Check if pointer is null, if so, we are at the end of
|
||||
// the program.
|
||||
ldy #0
|
||||
ldx #<basic_current_line_ptr
|
||||
jsr peek_pointer_null_check
|
||||
jsr peek_line_pointer_null_check
|
||||
bcs !+
|
||||
// End of program reached
|
||||
jmp basic_main_loop
|
||||
@@ -194,13 +218,24 @@ basic_execute_from_current_line:
|
||||
adc #0
|
||||
sta basic_current_statement_ptr+1
|
||||
|
||||
// Store line number
|
||||
ldx #<basic_current_line_ptr
|
||||
ldy #2
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<basic_current_line_ptr
|
||||
jsr peek_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (basic_current_line_ptr),y
|
||||
#endif
|
||||
|
||||
sta basic_current_line_number+0
|
||||
iny
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
jsr peek_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (basic_current_line_ptr),y
|
||||
#endif
|
||||
|
||||
sta basic_current_line_number+1
|
||||
|
||||
jmp basic_execute_statement
|
||||
|
||||
@@ -13,8 +13,14 @@ basic_find_line_loop:
|
||||
// Line number
|
||||
|
||||
ldy #3
|
||||
ldx #<basic_current_line_ptr
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<basic_current_line_ptr+0
|
||||
jsr peek_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (basic_current_line_ptr),y
|
||||
#endif
|
||||
|
||||
cmp basic_line_number+1
|
||||
beq !+
|
||||
bcs line_num_too_high
|
||||
@@ -22,7 +28,13 @@ basic_find_line_loop:
|
||||
!:
|
||||
|
||||
dey
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
jsr peek_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (basic_current_line_ptr),y
|
||||
#endif
|
||||
|
||||
cmp basic_line_number+0
|
||||
beq !+
|
||||
bcs line_num_too_high
|
||||
@@ -32,8 +44,7 @@ basic_find_line_loop:
|
||||
rts
|
||||
not_this_line:
|
||||
// Not this line, so advance to next line
|
||||
ldx #<basic_current_line_ptr
|
||||
jsr peek_pointer_null_check
|
||||
jsr peek_line_pointer_null_check
|
||||
bcs more_lines_exist
|
||||
|
||||
// no more lines exist, return failure
|
||||
@@ -46,11 +57,23 @@ more_lines_exist:
|
||||
// if the link goes backwards.
|
||||
// Follow link to next line
|
||||
ldy #0
|
||||
ldx #<basic_current_line_ptr
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<basic_current_line_ptr+0
|
||||
jsr peek_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (basic_current_line_ptr),y
|
||||
#endif
|
||||
|
||||
sta $0100
|
||||
iny
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
jsr peek_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (basic_current_line_ptr),y
|
||||
#endif
|
||||
|
||||
sta basic_current_line_ptr+1
|
||||
lda $0100
|
||||
sta basic_current_line_ptr+0
|
||||
|
||||
@@ -4,11 +4,23 @@
|
||||
basic_find_next_line:
|
||||
|
||||
ldy #0
|
||||
ldx #<basic_current_line_ptr
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<basic_current_line_ptr+0
|
||||
jsr peek_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (basic_current_line_ptr),y
|
||||
#endif
|
||||
|
||||
pha
|
||||
iny
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
jsr peek_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (basic_current_line_ptr),y
|
||||
#endif
|
||||
|
||||
sta basic_current_line_ptr+1
|
||||
pla
|
||||
sta basic_current_line_ptr+0
|
||||
|
||||
@@ -1,10 +1,22 @@
|
||||
basic_follow_link_to_next_line:
|
||||
ldy #0
|
||||
ldx #<basic_current_line_ptr
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<basic_current_line_ptr+0
|
||||
jsr peek_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (basic_current_line_ptr),y
|
||||
#endif
|
||||
|
||||
pha
|
||||
iny
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
jsr peek_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (basic_current_line_ptr),y
|
||||
#endif
|
||||
|
||||
sta basic_current_line_ptr+1
|
||||
pla
|
||||
sta basic_current_line_ptr+0
|
||||
|
||||
@@ -58,12 +58,23 @@ basic_insert_line:
|
||||
|
||||
// Write the line number
|
||||
ldy #2
|
||||
ldx #<basic_current_line_ptr
|
||||
lda basic_line_number+0
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<basic_current_line_ptr+0
|
||||
jsr poke_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
sta (basic_current_line_ptr),y
|
||||
#endif
|
||||
|
||||
iny
|
||||
lda basic_line_number+1
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
jsr poke_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
sta (basic_current_line_ptr),y
|
||||
#endif
|
||||
|
||||
// Now store the line body itself
|
||||
inc tokenise_work2
|
||||
@@ -71,9 +82,15 @@ line_store_loop:
|
||||
ldx tokenise_work1
|
||||
lda $0200,x
|
||||
inc tokenise_work1
|
||||
ldx #<basic_current_line_ptr
|
||||
iny
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<basic_current_line_ptr+0
|
||||
jsr poke_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
sta (basic_current_line_ptr),y
|
||||
#endif
|
||||
|
||||
lda tokenise_work1
|
||||
cmp tokenise_work2
|
||||
bne line_store_loop
|
||||
@@ -81,4 +98,3 @@ line_store_loop:
|
||||
|
||||
clc
|
||||
rts
|
||||
|
||||
@@ -101,8 +101,7 @@ basic_shift_mem_down_and_relink:
|
||||
|
||||
// Check if we still have any lines left
|
||||
ldy #0
|
||||
ldx #<basic_current_line_ptr
|
||||
jsr peek_pointer_null_check
|
||||
jsr peek_line_pointer_null_check
|
||||
bcs relink_down_next_line
|
||||
// Nope, so just return
|
||||
clc
|
||||
@@ -115,23 +114,46 @@ relink_down_next_line:
|
||||
|
||||
// Subtract tokenise_work3 from the pointer
|
||||
ldy #0
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<basic_current_line_ptr+0
|
||||
jsr peek_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (basic_current_line_ptr),y
|
||||
#endif
|
||||
|
||||
sec
|
||||
sbc tokenise_work3
|
||||
sta memmove_src+0
|
||||
iny
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
jsr peek_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (basic_current_line_ptr),y
|
||||
#endif
|
||||
|
||||
sbc #0
|
||||
sta memmove_src+1
|
||||
|
||||
ldy #0
|
||||
ldx #<basic_current_line_ptr
|
||||
lda memmove_src+0
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<basic_current_line_ptr+0
|
||||
jsr poke_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
sta (basic_current_line_ptr),y
|
||||
#endif
|
||||
|
||||
iny
|
||||
lda memmove_src+1
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
jsr poke_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
sta (basic_current_line_ptr),y
|
||||
#endif
|
||||
|
||||
relink_down_loop:
|
||||
// Now advance pointer to the next line,
|
||||
@@ -141,8 +163,7 @@ relink_down_loop:
|
||||
sta basic_current_line_ptr+1
|
||||
|
||||
// Have we run out of lines to patch?
|
||||
ldx #<basic_current_line_ptr
|
||||
jsr peek_pointer_null_check
|
||||
jsr peek_line_pointer_null_check
|
||||
bcs relink_down_next_line
|
||||
|
||||
clc
|
||||
|
||||
@@ -105,12 +105,24 @@ basic_shift_mem_up_and_relink:
|
||||
// pointer to itself, so that we can add the shift
|
||||
// to make it end up pointing to the next line
|
||||
ldy #0
|
||||
ldx #<basic_current_line_ptr+0
|
||||
|
||||
lda basic_current_line_ptr+0
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<basic_current_line_ptr+0
|
||||
jsr poke_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
sta (basic_current_line_ptr),y
|
||||
#endif
|
||||
|
||||
iny
|
||||
lda basic_current_line_ptr+1
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
jsr poke_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
sta (basic_current_line_ptr),y
|
||||
#endif
|
||||
|
||||
relink_up_next_line:
|
||||
// inc $d020
|
||||
@@ -118,15 +130,28 @@ relink_up_next_line:
|
||||
|
||||
// Advance pointer by tokenise_word3 bytes
|
||||
ldy #0
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<basic_current_line_ptr+0
|
||||
jsr peek_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (basic_current_line_ptr),y
|
||||
#endif
|
||||
|
||||
sta memmove_dst+0
|
||||
clc
|
||||
adc tokenise_work3
|
||||
sta memmove_src+0
|
||||
iny
|
||||
php
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
jsr peek_under_roms
|
||||
cmp #$00
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (basic_current_line_ptr),y
|
||||
#endif
|
||||
|
||||
sta memmove_dst+1
|
||||
plp
|
||||
adc #0
|
||||
@@ -147,13 +172,23 @@ relink_up_next_line:
|
||||
|
||||
// Write memmove_src back to current line pointer
|
||||
ldy #0
|
||||
ldx #<basic_current_line_ptr
|
||||
lda memmove_src+0
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<basic_current_line_ptr+0
|
||||
jsr poke_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
sta (basic_current_line_ptr),y
|
||||
#endif
|
||||
|
||||
iny
|
||||
lda memmove_src+1
|
||||
jsr poke_under_roms
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
jsr poke_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
sta (basic_current_line_ptr),y
|
||||
#endif
|
||||
|
||||
relink_up_loop:
|
||||
// Now advance pointer to the next line,
|
||||
@@ -163,8 +198,7 @@ relink_up_loop:
|
||||
sta basic_current_line_ptr+1
|
||||
|
||||
// Have we run out of lines to patch?
|
||||
ldx #<basic_current_line_ptr
|
||||
jsr peek_pointer_null_check
|
||||
jsr peek_line_pointer_null_check
|
||||
bcs relink_up_next_line
|
||||
|
||||
rts
|
||||
@@ -1,7 +1,11 @@
|
||||
// Clear screen etc, show READY prompt.
|
||||
|
||||
basic_warm_start:
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
// We need our helpers to get to filenames under ROMs or IO area
|
||||
jsr install_ram_routines
|
||||
#endif
|
||||
|
||||
// If warm start caused by BRK, print it address
|
||||
lda CMP0
|
||||
|
||||
+27
-2
@@ -10,10 +10,17 @@ cmd_list:
|
||||
sta basic_current_line_ptr+1
|
||||
|
||||
list_loop:
|
||||
ldx #<basic_current_line_ptr
|
||||
|
||||
ldy #1
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<basic_current_line_ptr+0
|
||||
jsr peek_under_roms
|
||||
cmp #$00
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (basic_current_line_ptr),y
|
||||
#endif
|
||||
|
||||
bne list_more_lines
|
||||
|
||||
// LIST terminates any running program,
|
||||
@@ -34,10 +41,22 @@ list_more_lines:
|
||||
list_single_line: // entry point needed by DOS wedge
|
||||
// Print line number
|
||||
ldy #3
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
jsr peek_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (basic_current_line_ptr),y
|
||||
#endif
|
||||
|
||||
pha
|
||||
dey
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
jsr peek_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (basic_current_line_ptr),y
|
||||
#endif
|
||||
|
||||
tax
|
||||
pla
|
||||
jsr print_integer
|
||||
@@ -51,9 +70,15 @@ list_single_line: // entry point needed by DOS wedge
|
||||
|
||||
ldy #4
|
||||
list_print_loop:
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<basic_current_line_ptr
|
||||
jsr peek_under_roms
|
||||
jsr peek_under_roms
|
||||
cmp #$00
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (basic_current_line_ptr),y
|
||||
#endif
|
||||
|
||||
beq list_end_of_line
|
||||
cmp #$22
|
||||
bne list_not_quote
|
||||
|
||||
@@ -144,9 +144,15 @@ basic_relink_program:
|
||||
basic_relink_loop:
|
||||
// Is the pointer to the end of the program
|
||||
ldy #1
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<basic_current_line_ptr+0
|
||||
jsr peek_under_roms
|
||||
cmp #$00
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (basic_current_line_ptr),y
|
||||
#endif
|
||||
|
||||
bne !+
|
||||
|
||||
// End of program
|
||||
@@ -156,8 +162,14 @@ basic_relink_loop:
|
||||
// Skip forward pointer and line number
|
||||
ldy #4
|
||||
end_of_line_search:
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<basic_current_line_ptr+0
|
||||
jsr peek_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (basic_current_line_ptr),y
|
||||
#endif
|
||||
|
||||
cmp #$00
|
||||
beq !+
|
||||
|
||||
@@ -182,13 +194,25 @@ end_of_line_search:
|
||||
pha
|
||||
php
|
||||
ldy #0
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<basic_current_line_ptr+0
|
||||
jsr poke_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
sta (basic_current_line_ptr),y
|
||||
#endif
|
||||
|
||||
plp
|
||||
lda basic_current_line_ptr+1
|
||||
adc #0
|
||||
ldy #1
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
jsr poke_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
sta (basic_current_line_ptr),y
|
||||
#endif
|
||||
|
||||
sta basic_current_line_ptr+1
|
||||
pla
|
||||
sta basic_current_line_ptr+0
|
||||
|
||||
+16
-3
@@ -44,12 +44,25 @@ basic_do_new:
|
||||
jsr JMEMTOP
|
||||
cpx #$80
|
||||
beq !+
|
||||
lda #>$f7ff
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
lda #>$F7FF
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda #>$9FFF
|
||||
#endif
|
||||
.byte $2C
|
||||
!: lda #>$7FFF
|
||||
!:
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
lda #>$F7FF
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda #>$9FFF
|
||||
#endif
|
||||
sta basic_top_of_memory_ptr+1
|
||||
sta basic_start_of_strings_ptr+1
|
||||
lda #<$f7ff
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
lda #<$F7FF
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda #<$9FFF
|
||||
#endif
|
||||
sta basic_top_of_memory_ptr+0
|
||||
sta basic_start_of_strings_ptr+0
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
// Return C=1 if a pointer in BASIC memory space is NULL, else C=0
|
||||
// X = ZP pointer to check
|
||||
|
||||
peek_line_pointer_null_check:
|
||||
|
||||
ldy #$00
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<basic_current_line_ptr+0
|
||||
jsr peek_under_roms
|
||||
cmp #$00
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (basic_current_line_ptr),y
|
||||
#endif
|
||||
|
||||
bne ptr_not_null
|
||||
iny
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
jsr peek_under_roms
|
||||
cmp #$00
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (basic_current_line_ptr),y
|
||||
#endif
|
||||
|
||||
bne ptr_not_null
|
||||
|
||||
// Pointer is NULL
|
||||
clc
|
||||
rts
|
||||
|
||||
ptr_not_null:
|
||||
sec
|
||||
rts
|
||||
@@ -1,20 +0,0 @@
|
||||
// Return C=1 if a pointer in BASIC memory space is NULL, else C=0
|
||||
// X = ZP pointer to check
|
||||
|
||||
peek_pointer_null_check:
|
||||
ldy #$00
|
||||
jsr peek_under_roms
|
||||
cmp #$00
|
||||
bne ptr_not_null
|
||||
iny
|
||||
jsr peek_under_roms
|
||||
cmp #$00
|
||||
bne ptr_not_null
|
||||
|
||||
// Pointer is NULL
|
||||
clc
|
||||
rts
|
||||
ptr_not_null:
|
||||
sec
|
||||
rts
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
// in ,aliases.s.
|
||||
// Thus those addresses are expressed using formulae.
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
|
||||
install_ram_routines:
|
||||
// Copy routines into place
|
||||
ldx #ram_routines_end-ram_routines_start-1
|
||||
@@ -106,3 +108,47 @@ smd1:
|
||||
jmp memmap_normal
|
||||
|
||||
ram_routines_end:
|
||||
|
||||
#else // CONFIG_MEMORY_MODEL_60K
|
||||
|
||||
shift_mem_up:
|
||||
// Move memmove_size bytes from memmove_src to memmove_dst,
|
||||
// where memmove_dst > memmove_src
|
||||
// This means we have to copy from the back end down.
|
||||
// This routine assumes the pointers are already pointed
|
||||
// to the end of the areas, and that Y is correctly initialised
|
||||
// to allow the copy to begin.
|
||||
php
|
||||
smu1:
|
||||
lda (memmove_src),y
|
||||
sta (memmove_dst),y
|
||||
dey
|
||||
bne smu1
|
||||
dec memmove_src+1
|
||||
dec memmove_dst+1
|
||||
dec memmove_size+1
|
||||
bne smu1
|
||||
plp
|
||||
rts
|
||||
|
||||
shift_mem_down:
|
||||
// Move memmove_size bytes from memmove_src to memmove_dst,
|
||||
// where memmove_dst > memmove_src
|
||||
// This means we have to copy from the back end down.
|
||||
// This routine assumes the pointers are already pointed
|
||||
// to the end of the areas, and that Y is correctly initialised
|
||||
// to allow the copy to begin.
|
||||
php
|
||||
smd1:
|
||||
lda (memmove_src),y
|
||||
sta (memmove_dst),y
|
||||
iny
|
||||
bne smd1
|
||||
inc memmove_src+1
|
||||
inc memmove_dst+1
|
||||
dec memmove_size+1
|
||||
bne smd1
|
||||
plp
|
||||
rts
|
||||
|
||||
#endif
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// START wedge support
|
||||
#if CONFIG_DOS_WEDGE
|
||||
|
||||
wedge_dos:
|
||||
|
||||
@@ -235,4 +235,4 @@ wedge_dos_setnam:
|
||||
ldy basic_current_statement_ptr+1
|
||||
jmp JSETNAM
|
||||
|
||||
// END wedge support
|
||||
#endif // CONFIG_DOS_WEDGE
|
||||
Reference in new issue
Block a user