code size optimization in BASIC
This commit is contained in:
1 parent
8b629816d7
commit
7edf26fbb6
11 files changed
+24
-40
No files matched your search
@@ -9,10 +9,7 @@
|
|||||||
|
|
||||||
end_of_statement:
|
end_of_statement:
|
||||||
|
|
||||||
jsr fetch_character
|
jsr fetch_character_skip_spaces
|
||||||
|
|
||||||
cmp #$20 // check for space
|
|
||||||
beq end_of_statement
|
|
||||||
|
|
||||||
cmp #$3A // check for colon
|
cmp #$3A // check for colon
|
||||||
beq_16 execute_statements
|
beq_16 execute_statements
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
|
|
||||||
end_of_statement_check:
|
end_of_statement_check:
|
||||||
|
|
||||||
|
// XXX consider optimized version for 46K/56K memory models
|
||||||
|
|
||||||
ldy #$00
|
ldy #$00
|
||||||
|
|
||||||
#if CONFIG_MEMORY_MODEL_60K
|
#if CONFIG_MEMORY_MODEL_60K
|
||||||
|
|||||||
@@ -16,9 +16,7 @@ execute_statements:
|
|||||||
|
|
||||||
// Skip over any white spaces and colons (':')
|
// Skip over any white spaces and colons (':')
|
||||||
!:
|
!:
|
||||||
jsr fetch_character
|
jsr fetch_character_skip_spaces
|
||||||
cmp #$20 // space, can be skipped
|
|
||||||
beq !-
|
|
||||||
cmp #$3A // colon, can be skipped
|
cmp #$3A // colon, can be skipped
|
||||||
beq !-
|
beq !-
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
// #LAYOUT# STD * #TAKE
|
||||||
|
// #LAYOUT# * BASIC_0 #TAKE
|
||||||
|
// #LAYOUT# * * #IGNORE
|
||||||
|
|
||||||
|
//
|
||||||
|
// Fetches a single character, but skips spaces
|
||||||
|
//
|
||||||
|
|
||||||
|
fetch_character_skip_spaces:
|
||||||
|
|
||||||
|
jsr fetch_character
|
||||||
|
cmp #$20
|
||||||
|
beq fetch_character_skip_spaces
|
||||||
|
|
||||||
|
rts
|
||||||
@@ -18,9 +18,7 @@ fetch_uint16:
|
|||||||
|
|
||||||
// Fetch the first character (skip spaces), check if 0-9
|
// Fetch the first character (skip spaces), check if 0-9
|
||||||
|
|
||||||
jsr fetch_character
|
jsr fetch_character_skip_spaces
|
||||||
cmp #$20
|
|
||||||
beq fetch_uint16
|
|
||||||
|
|
||||||
jsr convert_PETSCII_to_digit
|
jsr convert_PETSCII_to_digit
|
||||||
bcs fetch_uint16_rts
|
bcs fetch_uint16_rts
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ fetch_coma_uint8:
|
|||||||
|
|
||||||
fetch_uint8:
|
fetch_uint8:
|
||||||
|
|
||||||
jsr injest_spaces
|
|
||||||
lda #IDX__EV2_0E // 'ILLEGAL QUANTITY ERROR'
|
lda #IDX__EV2_0E // 'ILLEGAL QUANTITY ERROR'
|
||||||
jsr fetch_uint16
|
jsr fetch_uint16
|
||||||
bcs !+
|
bcs !+
|
||||||
|
|||||||
@@ -11,11 +11,8 @@ fetch_variable:
|
|||||||
sta VARNAM+1
|
sta VARNAM+1
|
||||||
|
|
||||||
// Fetch the first character
|
// Fetch the first character
|
||||||
!:
|
|
||||||
jsr fetch_character
|
|
||||||
cmp #$20 // ignore all the spaces
|
|
||||||
beq !-
|
|
||||||
|
|
||||||
|
jsr fetch_character_skip_spaces
|
||||||
jsr is_AZ
|
jsr is_AZ
|
||||||
bcs_16 do_SYNTAX_error
|
bcs_16 do_SYNTAX_error
|
||||||
|
|
||||||
|
|||||||
@@ -9,11 +9,9 @@
|
|||||||
|
|
||||||
injest_assign:
|
injest_assign:
|
||||||
|
|
||||||
jsr fetch_character
|
jsr fetch_character_skip_spaces
|
||||||
cmp #$B2 // assign operator character
|
cmp #$B2 // assign operator character
|
||||||
beq injest_assign_found
|
beq injest_assign_found
|
||||||
cmp #$20 // space, can always be skipped
|
|
||||||
beq injest_assign
|
|
||||||
|
|
||||||
// Not found
|
// Not found
|
||||||
jsr unconsume_character
|
jsr unconsume_character
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
// #LAYOUT# STD * #TAKE
|
|
||||||
// #LAYOUT# * BASIC_0 #TAKE
|
|
||||||
// #LAYOUT# * * #IGNORE
|
|
||||||
|
|
||||||
//
|
|
||||||
// Injests all spaces
|
|
||||||
//
|
|
||||||
|
|
||||||
// XXX get rid of this when proper number parsing is implemented
|
|
||||||
|
|
||||||
|
|
||||||
injest_spaces:
|
|
||||||
|
|
||||||
jsr fetch_character
|
|
||||||
cmp #$20 // space, can be skipped
|
|
||||||
beq injest_spaces
|
|
||||||
|
|
||||||
jmp unconsume_character
|
|
||||||
@@ -37,8 +37,7 @@ wedge_arrow_H:
|
|||||||
|
|
||||||
// Make sure the syntax is correct
|
// Make sure the syntax is correct
|
||||||
|
|
||||||
jsr injest_spaces
|
jsr fetch_character_skip_spaces
|
||||||
jsr fetch_character
|
|
||||||
|
|
||||||
cmp #$00
|
cmp #$00
|
||||||
bne_16 do_SYNTAX_error
|
bne_16 do_SYNTAX_error
|
||||||
|
|||||||
@@ -13,8 +13,7 @@ wedge_tape_prepare_load:
|
|||||||
|
|
||||||
// Make sure the syntax is correct
|
// Make sure the syntax is correct
|
||||||
|
|
||||||
jsr injest_spaces
|
jsr fetch_character_skip_spaces
|
||||||
jsr fetch_character
|
|
||||||
|
|
||||||
cmp #$00
|
cmp #$00
|
||||||
beq wedge_tape_prepare_load_no_filename // branch if no file name given
|
beq wedge_tape_prepare_load_no_filename // branch if no file name given
|
||||||
|
|||||||
Reference in new issue
Block a user