small rework towards TI$ assignment and arrays support
This commit is contained in:
1 parent
a59f4647ad
commit
80e6d126b8
4 files changed
+128
-80
No files matched your search
@@ -7,7 +7,7 @@ assign_variable:
|
||||
|
||||
// Fetch variable name, should be followed by assign operator
|
||||
|
||||
jsr fetch_variable
|
||||
jsr fetch_variable_name
|
||||
|
||||
#if HAS_OPCODES_65CE02
|
||||
|
||||
@@ -26,6 +26,21 @@ assign_variable:
|
||||
|
||||
#endif
|
||||
|
||||
// Check for special variables
|
||||
|
||||
jsr is_var_TI_string
|
||||
beq_16 assign_variable_TI_string
|
||||
|
||||
jsr is_var_TI
|
||||
beq_16 do_SYNTAX_error
|
||||
|
||||
jsr is_var_ST
|
||||
beq_16 do_SYNTAX_error
|
||||
|
||||
// Retrieve the variable address
|
||||
|
||||
jsr fetch_variable_find_addr
|
||||
|
||||
// Determine variable type and push it to the stack
|
||||
|
||||
lda #$00
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
assign_variable_TI_string:
|
||||
|
||||
// XXX implement
|
||||
|
||||
jmp do_NOT_IMPLEMENTED_error
|
||||
@@ -9,89 +9,13 @@
|
||||
|
||||
fetch_variable:
|
||||
|
||||
// Set default second character and variable type
|
||||
// Start by fetching variable name
|
||||
|
||||
lda #$00
|
||||
sta VARNAM+1
|
||||
|
||||
// Fetch the first character of variable name
|
||||
|
||||
jsr fetch_character_skip_spaces
|
||||
jsr is_AZ
|
||||
jsr fetch_variable_name
|
||||
bcc !+
|
||||
|
||||
#if !HAS_OPCODES_65CE02
|
||||
jsr unconsume_character
|
||||
#else
|
||||
dew TXTPTR
|
||||
#endif
|
||||
|
||||
sec
|
||||
rts
|
||||
!:
|
||||
sta VARNAM+0
|
||||
|
||||
// Fetch the (optional) second character
|
||||
|
||||
jsr fetch_character
|
||||
jsr is_09_AZ
|
||||
bcs fetch_variable_check_type
|
||||
|
||||
sta VARNAM+1
|
||||
|
||||
// Fetch the remaining variable characters - ignore them
|
||||
!:
|
||||
jsr fetch_character
|
||||
jsr is_09_AZ
|
||||
bcc !-
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
fetch_variable_check_type:
|
||||
|
||||
// Encode variable type within name, as documented in:
|
||||
// - https://sites.google.com/site/h2obsession/CBM/basic/variable-format
|
||||
|
||||
cmp #$24 // '$'
|
||||
beq fetch_variable_type_string
|
||||
cmp #$25 // '%'
|
||||
beq fetch_variable_type_integer
|
||||
|
||||
// FALLTORUGH
|
||||
|
||||
fetch_variable_type_float:
|
||||
|
||||
#if !HAS_OPCODES_65CE02
|
||||
jsr unconsume_character
|
||||
#else
|
||||
dew TXTPTR
|
||||
#endif
|
||||
|
||||
jmp_8 fetch_variable_special
|
||||
|
||||
fetch_variable_type_integer:
|
||||
|
||||
lda VARNAM+0
|
||||
ora #$80
|
||||
sta VARNAM+0
|
||||
|
||||
lda #$00
|
||||
skip_2_bytes_trash_nvz
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
fetch_variable_type_string:
|
||||
|
||||
lda #$80
|
||||
sta VALTYP
|
||||
|
||||
lda VARNAM+1
|
||||
ora #$80
|
||||
sta VARNAM+1
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
fetch_variable_special:
|
||||
// Handle special variables - TI$, TI, ST
|
||||
|
||||
jsr is_var_TI_string
|
||||
beq_16 fetch_variable_TI_string
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Carry set = failure, not recognized variable name
|
||||
//
|
||||
|
||||
|
||||
fetch_variable_name:
|
||||
|
||||
// Set default second character and variable type
|
||||
|
||||
lda #$00
|
||||
sta VARNAM+1
|
||||
|
||||
// Fetch the first character of variable name
|
||||
|
||||
jsr fetch_character_skip_spaces
|
||||
jsr is_AZ
|
||||
bcc !+
|
||||
|
||||
#if !HAS_OPCODES_65CE02
|
||||
jsr unconsume_character
|
||||
#else
|
||||
dew TXTPTR
|
||||
#endif
|
||||
|
||||
sec
|
||||
rts
|
||||
!:
|
||||
sta VARNAM+0
|
||||
|
||||
// Fetch the (optional) second character
|
||||
|
||||
jsr fetch_character
|
||||
jsr is_09_AZ
|
||||
bcs fetch_variable_check_type
|
||||
|
||||
sta VARNAM+1
|
||||
|
||||
// Fetch the remaining variable characters - ignore them
|
||||
!:
|
||||
jsr fetch_character
|
||||
jsr is_09_AZ
|
||||
bcc !-
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
fetch_variable_check_type:
|
||||
|
||||
// Encode variable type within name, as documented in:
|
||||
// - https://sites.google.com/site/h2obsession/CBM/basic/variable-format
|
||||
|
||||
cmp #$24 // '$'
|
||||
beq fetch_variable_type_string
|
||||
cmp #$25 // '%'
|
||||
beq fetch_variable_type_integer
|
||||
|
||||
// FALLTORUGH
|
||||
|
||||
fetch_variable_type_float:
|
||||
|
||||
#if !HAS_OPCODES_65CE02
|
||||
jsr unconsume_character
|
||||
#else
|
||||
dew TXTPTR
|
||||
#endif
|
||||
|
||||
jmp_8 fetch_variable_name_check_array
|
||||
|
||||
fetch_variable_type_integer:
|
||||
|
||||
lda VARNAM+0
|
||||
ora #$80
|
||||
sta VARNAM+0
|
||||
|
||||
lda #$00
|
||||
skip_2_bytes_trash_nvz
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
fetch_variable_type_string:
|
||||
|
||||
lda #$80
|
||||
sta VALTYP
|
||||
|
||||
lda VARNAM+1
|
||||
ora #$80
|
||||
sta VARNAM+1
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
fetch_variable_name_check_array:
|
||||
|
||||
// XXX add check for array
|
||||
|
||||
clc
|
||||
rts
|
||||
Reference in new issue
Block a user