more Mega65 optimizations in BASIC

This commit is contained in:
FeralChild64 committed 2020-07-12 12:40:22 +02:00
1 parent 1432935f03
commit cec9adce25
13 files changed
+83 -55

No files matched your search

+4
View File
@@ -19,7 +19,11 @@ cmd_print:
cmd_print_loop:
#if !HAS_OPCODES_65CE02
jsr unconsume_character
#else
dew TXTPTR
#endif
// FALLTROUGH
+4
View File
@@ -178,7 +178,11 @@ FRMEVL_fetch_string:
!:
// No closing quote, but end of the data
#if !HAS_OPCODES_65CE02
jsr unconsume_character
#else
dew TXTPTR
#endif
// FALLTROUGH
@@ -26,7 +26,11 @@ end_of_statement_check:
cmp #$20
bne !+
#if !HAS_OPCODES_65CE02
jsr consume_character
#else
inw TXTPTR
#endif
jmp end_of_statement_check
!:
cmp #$00
@@ -254,5 +254,9 @@ execute_statements_var_assign:
// Try variable assignment - execute as LET command
#if !HAS_OPCODES_65CE02
jsr unconsume_character
#else
dew TXTPTR
#endif
jmp cmd_let
+4 -2
View File
@@ -29,14 +29,14 @@ fetch_character:
#endif
#if !HAS_OPCODES_65CE02
// FALLTHROUGH
consume_character:
// Advance basic text pointer
#if !HAS_OPCODES_65CE02
inc TXTPTR+0
bne !+
inc TXTPTR+1
@@ -44,6 +44,8 @@ consume_character:
#else // HAS_OPCODES_65CE02
// Advance basic text pointer
inw TXTPTR
#endif
+30 -9
View File
@@ -2,7 +2,7 @@
// #LAYOUT# * * #IGNORE
//
// Fetches a single character - optimized version
// Fetches a single character (depending on version - also skips spaces) - optimized version
//
@@ -18,9 +18,14 @@ fetch_character:
lda #$26
sta CPU_R6510
// Retrieve value from under ROMs
// Retrieve value from under ROMs, advance text pointer
lda (TXTPTR), y
inw TXTPTR
// FALLTROUGH
fetch_character_end:
// Restore memory mapping
@@ -29,14 +34,30 @@ fetch_character:
sta CPU_R6510
pla
// FALLTROUGH
consume_character:
// Advance basic text pointer
inw TXTPTR
rts
fetch_character_skip_spaces:
ldy #0
// Unmap BASIC lower ROM
lda #$26
sta CPU_R6510
// Retrieve value from under ROMs, advance text pointer
!:
lda (TXTPTR), y
inw TXTPTR
// Skip space characters
cmp #$20
beq !-
// Restore memory mapping
bra fetch_character_end
#endif
@@ -1,41 +0,0 @@
// #LAYOUT# M65 BASIC_0 #TAKE-HIGH
// #LAYOUT# * * #IGNORE
//
// Fetches a single character, but skips spaces - optimized version
//
#if CONFIG_MEMORY_MODEL_46K || CONFIG_MEMORY_MODEL_50K
fetch_character_skip_spaces:
ldy #0
// Unmap BASIC lower ROM
lda #$26
sta CPU_R6510
// Retrieve value from under ROMs, advance text pointer
!:
lda (TXTPTR), y
inw TXTPTR
// Skip space characters
cmp #$20
beq !-
// Restore memory mapping
pha
lda #$27
sta CPU_R6510
pla
rts
#endif
+12
View File
@@ -41,7 +41,11 @@ fetch_operator_success:
fetch_operator_failed:
#if !HAS_OPCODES_65CE02
jsr unconsume_character
#else
dew TXTPTR
#endif
sec
rts
@@ -57,7 +61,11 @@ fetch_operator_try_gteq:
// This is a '>'
#if !HAS_OPCODES_65CE02
jsr unconsume_character
#else
dew TXTPTR
#endif
lda #$07
bne fetch_operator_success // branch always
!:
@@ -79,7 +87,11 @@ fetch_operator_try_lteq_neq:
// This is a '<'
#if !HAS_OPCODES_65CE02
jsr unconsume_character
#else
dew TXTPTR
#endif
lda #$09
bne fetch_operator_success // branch always
!:
+4
View File
@@ -88,7 +88,11 @@ fetch_uint16_loop:
fetch_uint16_end:
#if !HAS_OPCODES_65CE02
jsr unconsume_character
#else
dew TXTPTR
#endif
clc
// FALLTROUGH
+4
View File
@@ -48,7 +48,11 @@ fetch_variable_check_type:
fetch_variable_type_float:
#if !HAS_OPCODES_65CE02
jsr unconsume_character
#else
dew TXTPTR
#endif
#if HAS_OPCODES_65C02
bra fetch_variable_find_addr
+4
View File
@@ -14,7 +14,11 @@ injest_assign:
beq injest_assign_found
// Not found
#if !HAS_OPCODES_65CE02
jsr unconsume_character
#else
dew TXTPTR
#endif
sec
rts
+6 -3
View File
@@ -9,14 +9,17 @@
injest_comma:
jsr fetch_character
jsr fetch_character_skip_spaces
cmp #$2C // comma character
beq injest_comma_found
cmp #$20 // space, can always be skipped
beq injest_comma
// Not found
#if !HAS_OPCODES_65CE02
jsr unconsume_character
#else
dew TXTPTR
#endif
sec
rts
+3
View File
@@ -6,6 +6,7 @@
// Reverses character fetch
//
#if !HAS_OPCODES_65CE02
unconsume_character:
@@ -18,3 +19,5 @@ unconsume_character:
sta TXTPTR+1
rts
#endif