TI$ variable can now be assigned
This commit is contained in:
1 parent
80e6d126b8
commit
8826394e80
4 files changed
+81
-3
No files matched your search
@@ -58,6 +58,7 @@ Ideas for the future, most of them suitable for Mega65 or other power machines o
|
|||||||
* `RUN` should be able to run program from device, as in BASIC V10
|
* `RUN` should be able to run program from device, as in BASIC V10
|
||||||
* `PAGE` and `DELAY` commands from Simons BASIC, or something similar
|
* `PAGE` and `DELAY` commands from Simons BASIC, or something similar
|
||||||
* `DUMP` command from Simons BASIC, or something similar
|
* `DUMP` command from Simons BASIC, or something similar
|
||||||
|
* it should be possbile to assign to `TI` special variable
|
||||||
* function to insert a substring starting from given position
|
* function to insert a substring starting from given position
|
||||||
* function to generate string of n duplicated characters
|
* function to generate string of n duplicated characters
|
||||||
* function to retrieve fractional part of a number
|
* function to retrieve fractional part of a number
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ cmd_print_string:
|
|||||||
|
|
||||||
// Print a string value
|
// Print a string value
|
||||||
|
|
||||||
|
// XXX add optimized 46K/50K version
|
||||||
|
|
||||||
ldy #$00
|
ldy #$00
|
||||||
!:
|
!:
|
||||||
cpy __FAC1 + 0
|
cpy __FAC1 + 0
|
||||||
|
|||||||
@@ -182,9 +182,10 @@ do_basic_error: // error code in .X
|
|||||||
jsr map_NORMAL
|
jsr map_NORMAL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// "?"
|
// Clear all temporary variables, print "?"
|
||||||
|
|
||||||
phx_trash_a
|
phx_trash_a
|
||||||
|
jsr tmpstr_free_all
|
||||||
ldx #IDX__STR_RET_QM
|
ldx #IDX__STR_RET_QM
|
||||||
jsr print_packed_misc_str
|
jsr print_packed_misc_str
|
||||||
plx_trash_a
|
plx_trash_a
|
||||||
|
|||||||
@@ -5,6 +5,80 @@
|
|||||||
|
|
||||||
assign_variable_TI_string:
|
assign_variable_TI_string:
|
||||||
|
|
||||||
// XXX implement
|
// Evaluate the expression, check if the result is suitable
|
||||||
|
|
||||||
jmp do_NOT_IMPLEMENTED_error
|
jsr FRMEVL
|
||||||
|
|
||||||
|
lda VALTYP
|
||||||
|
bpl_16 do_TYPE_MISMATCH_error // branch if not string
|
||||||
|
|
||||||
|
lda __FAC1+0
|
||||||
|
cmp #$06
|
||||||
|
bne_16 do_ILLEGAL_QUANTITY_error // we need exactly 6-character string
|
||||||
|
|
||||||
|
// Initialize new time counter, process all the digits
|
||||||
|
|
||||||
|
ldy #$00
|
||||||
|
|
||||||
|
sty INDEX+0
|
||||||
|
sty INDEX+1
|
||||||
|
sty INDEX+2
|
||||||
|
|
||||||
|
// FALLTROUGH
|
||||||
|
|
||||||
|
// XXX provide optimized version for memory models 46K/50K
|
||||||
|
|
||||||
|
assign_variable_TI_string_loop:
|
||||||
|
|
||||||
|
// First fetch the digit
|
||||||
|
|
||||||
|
#if CONFIG_MEMORY_MODEL_60K
|
||||||
|
ldx #<(__FAC1 + 1)
|
||||||
|
jsr peek_under_roms
|
||||||
|
#elif CONFIG_MEMORY_MODEL_46K || CONFIG_MEMORY_MODEL_50K
|
||||||
|
jsr peek_under_roms_via_FAC1_PLUS_1
|
||||||
|
#else // CONFIG_MEMORY_MODEL_38K
|
||||||
|
lda (__FAC1 + 1), y
|
||||||
|
#endif
|
||||||
|
|
||||||
|
jsr convert_PETSCII_to_digit
|
||||||
|
bcs_16 do_ILLEGAL_QUANTITY_error
|
||||||
|
|
||||||
|
tax // move decoded digit to .X
|
||||||
|
|
||||||
|
// Strangely, original implementation seems to be very permissive,
|
||||||
|
// it accepts any digit at any position; for compatibility
|
||||||
|
// we should better follow this convention
|
||||||
|
|
||||||
|
assign_variable_TI_string_loop_digit:
|
||||||
|
|
||||||
|
cpx #$00
|
||||||
|
beq assign_variable_TI_string_loop_next
|
||||||
|
|
||||||
|
clc
|
||||||
|
lda table_TI_lo, y
|
||||||
|
adc INDEX+0
|
||||||
|
sta INDEX+0
|
||||||
|
lda table_TI_mid, y
|
||||||
|
adc INDEX+1
|
||||||
|
sta INDEX+1
|
||||||
|
lda table_TI_hi, y
|
||||||
|
adc INDEX+2
|
||||||
|
sta INDEX+2
|
||||||
|
|
||||||
|
dex
|
||||||
|
bpl assign_variable_TI_string_loop_digit // branch always
|
||||||
|
|
||||||
|
assign_variable_TI_string_loop_next:
|
||||||
|
|
||||||
|
iny
|
||||||
|
cpy #$06
|
||||||
|
bne assign_variable_TI_string_loop
|
||||||
|
|
||||||
|
// Set the resulting value
|
||||||
|
|
||||||
|
ldy INDEX+0
|
||||||
|
ldx INDEX+1
|
||||||
|
lda INDEX+2
|
||||||
|
|
||||||
|
jmp JSETTIM
|
||||||
Reference in new issue
Block a user