small rework towards TI$ assignment and arrays support

This commit is contained in:
FeralChild64 committed 2020-07-19 14:51:29 +02:00
1 parent a59f4647ad
commit 80e6d126b8
4 files changed
+128 -80

No files matched your search

+3 -79
View File
@@ -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