From e99bb9356a431fb4a7d3b87928bf7343d78db300 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sat, 18 Jul 2020 20:53:52 +0200 Subject: [PATCH] added hooks for ST, TI and TI$ variables --- src/basic/engine/fetch_variable.s | 30 +++++++++++++++++++-- src/basic/engine/fetch_variable_ST.s | 10 +++++++ src/basic/engine/fetch_variable_TI.s | 10 +++++++ src/basic/engine/fetch_variable_TI_string.s | 10 +++++++ src/basic/engine/varstr_alloc.s | 3 +++ 5 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 src/basic/engine/fetch_variable_ST.s create mode 100644 src/basic/engine/fetch_variable_TI.s create mode 100644 src/basic/engine/fetch_variable_TI_string.s diff --git a/src/basic/engine/fetch_variable.s b/src/basic/engine/fetch_variable.s index 7c90b2fa..d0f50689 100644 --- a/src/basic/engine/fetch_variable.s +++ b/src/basic/engine/fetch_variable.s @@ -68,9 +68,9 @@ fetch_variable_type_float: #endif #if HAS_OPCODES_65C02 - bra fetch_variable_find_addr + bra fetch_variable_special #else - jmp fetch_variable_find_addr + jmp fetch_variable_special #endif fetch_variable_type_integer: @@ -89,6 +89,32 @@ fetch_variable_type_string: // FALLTROUGH +fetch_variable_special: + + lda VARNAM+0 + cmp #$54 // 'T' + beq !+ + cmp #$53 // 'S' + bne fetch_variable_find_addr + + // First character is 'S', check the second one + + lda VARNAM+1 + cmp #$54 // 'T' + bne fetch_variable_find_addr + + jmp fetch_variable_ST +!: + // First character is 'T', check the second one + + lda VARNAM+1 + cmp #$49 + beq_16 fetch_variable_TI + cmp #$C9 + beq_16 fetch_variable_TI_string + + // FALLTROUGH + fetch_variable_find_addr: // Now try to find variable address between VARTAB and ARYTAB, see diff --git a/src/basic/engine/fetch_variable_ST.s b/src/basic/engine/fetch_variable_ST.s new file mode 100644 index 00000000..15f46d76 --- /dev/null +++ b/src/basic/engine/fetch_variable_ST.s @@ -0,0 +1,10 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + + +fetch_variable_ST: + + // XXX implement this + + jmp do_NOT_IMPLEMENTED_error diff --git a/src/basic/engine/fetch_variable_TI.s b/src/basic/engine/fetch_variable_TI.s new file mode 100644 index 00000000..c00e9012 --- /dev/null +++ b/src/basic/engine/fetch_variable_TI.s @@ -0,0 +1,10 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + + +fetch_variable_TI: + + // XXX implement this + + jmp do_NOT_IMPLEMENTED_error diff --git a/src/basic/engine/fetch_variable_TI_string.s b/src/basic/engine/fetch_variable_TI_string.s new file mode 100644 index 00000000..e0220720 --- /dev/null +++ b/src/basic/engine/fetch_variable_TI_string.s @@ -0,0 +1,10 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + + +fetch_variable_TI_string: + + // XXX implement this + + jmp do_NOT_IMPLEMENTED_error diff --git a/src/basic/engine/varstr_alloc.s b/src/basic/engine/varstr_alloc.s index ee06e329..f429e601 100644 --- a/src/basic/engine/varstr_alloc.s +++ b/src/basic/engine/varstr_alloc.s @@ -20,6 +20,9 @@ // - fills-in pointer in the string descriptor // +// NOTE: if FAC1 or FAC2 contains a value (not a string descriptor - these are going to be updated +// if garbage collector starts), then preserve __FAC1+1/+2 and __FAC2+1/+2 somewhere, as there +// is a small chance they'll get damaged! varstr_alloc: