some more work on string assignment
This commit is contained in:
1 parent
ac7fff95e5
commit
e349aa64f9
5 files changed
+140
-1
No files matched your search
@@ -24,6 +24,11 @@
|
||||
* silverdr - for the floating point routines [description](https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics)
|
||||
* the [C64 Wiki](https://www.c64-wiki.com) contributors
|
||||
|
||||
## other
|
||||
|
||||
* Gábor Lénárt - for his work on [XEMU Mega65 emulator](https://github.com/lgblgblgb/xemu)
|
||||
* Mads Nielsen - for the [Kick Assembler](http://www.theweb.dk/KickAssembler/Main.html#frontpage)
|
||||
|
||||
<br />
|
||||
|
||||
* ... and all the others we forgot
|
||||
@@ -117,6 +117,77 @@ cmd_let_assign_string:
|
||||
lda VALTYP
|
||||
bpl_16 do_TYPE_MISMATCH_error
|
||||
|
||||
// Copy the string descriptor to DSCPNT
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
|
||||
// XXX
|
||||
// XXX: implement this
|
||||
// XXX
|
||||
|
||||
#elif CONFIG_MEMORY_MODEL_46K || CONFIG_MEMORY_MODEL_50K
|
||||
// XXX consider optimized version without multiple JSRs
|
||||
|
||||
// XXX
|
||||
// XXX: implement this
|
||||
// XXX
|
||||
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
|
||||
ldy #$00
|
||||
lda (VARPNT), y
|
||||
sta DSCPNT+0
|
||||
iny
|
||||
lda (VARPNT), y
|
||||
sta DSCPNT+1
|
||||
iny
|
||||
lda (VARPNT), y
|
||||
sta DSCPNT+2
|
||||
|
||||
#endif
|
||||
|
||||
// First special case - check if the new string has size 0
|
||||
|
||||
// XXX
|
||||
|
||||
// Check if the source and destination strings are the same (VARPNT should now point just after variable name)
|
||||
|
||||
lda VARPNT+1
|
||||
cmp __FAC1+1
|
||||
bne !+
|
||||
iny
|
||||
lda VARPNT+2
|
||||
cmp __FAC1+2
|
||||
bne !+
|
||||
|
||||
// If we are here, than both source and destination strings are the same - nothing more to be done
|
||||
|
||||
rts
|
||||
!:
|
||||
// Strings are not the same - check if the new one is located within a text area, between TXTTAB and VARTAB
|
||||
|
||||
// XXX
|
||||
|
||||
// Check if size of both equals and the old on is above FRETOP
|
||||
|
||||
// XXX
|
||||
|
||||
// Check if new one is at least 3 bytes shorter and the old one is above FRETOP
|
||||
|
||||
// XXX
|
||||
|
||||
// Free the memory of the old string, it is not possible to reuse it
|
||||
|
||||
// XXX
|
||||
|
||||
// Check if the new string is a temporary one - if so, reuse already done alocation
|
||||
|
||||
// XXX
|
||||
|
||||
// No special case optimization is possible - alocate new memory area and copy the string
|
||||
|
||||
// XXX
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
|
||||
// XXX
|
||||
|
||||
@@ -133,7 +133,7 @@ fetch_variable_find_addr_loop:
|
||||
|
||||
fetch_variable_adjust_VARPNT:
|
||||
|
||||
// Adjust VARPNT to point just after variable name and quit
|
||||
// Adjust VARPNT to point just after variable name (XXX is it needed?) and quit
|
||||
|
||||
#if !HAS_OPCODES_65CE02
|
||||
|
||||
@@ -170,15 +170,72 @@ fetch_variable_alocate:
|
||||
|
||||
// First check if we have enough space for a new descriptor
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
|
||||
// XXX
|
||||
// XXX: implement this
|
||||
// XXX
|
||||
|
||||
#elif CONFIG_MEMORY_MODEL_46K || CONFIG_MEMORY_MODEL_50K
|
||||
// XXX consider optimized version without multiple JSRs
|
||||
|
||||
// XXX
|
||||
// XXX: implement this
|
||||
// XXX
|
||||
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
|
||||
// XXX
|
||||
// XXX: implement this
|
||||
// XXX
|
||||
|
||||
#endif
|
||||
|
||||
// If needed, move all the arrays up
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
|
||||
// XXX
|
||||
// XXX: implement this
|
||||
// XXX
|
||||
|
||||
#elif CONFIG_MEMORY_MODEL_46K || CONFIG_MEMORY_MODEL_50K
|
||||
// XXX consider optimized version without multiple JSRs
|
||||
|
||||
// XXX
|
||||
// XXX: implement this
|
||||
// XXX
|
||||
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
|
||||
// XXX
|
||||
// XXX: implement this
|
||||
// XXX
|
||||
|
||||
#endif
|
||||
|
||||
// Set pointer to new variable
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
|
||||
// XXX
|
||||
// XXX: implement this
|
||||
// XXX
|
||||
|
||||
#elif CONFIG_MEMORY_MODEL_46K || CONFIG_MEMORY_MODEL_50K
|
||||
// XXX consider optimized version without multiple JSRs
|
||||
|
||||
// XXX
|
||||
// XXX: implement this
|
||||
// XXX
|
||||
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
|
||||
// XXX
|
||||
// XXX: implement this
|
||||
// XXX
|
||||
|
||||
#endif
|
||||
|
||||
// Fill-in the new variable name, descriptor (it is enough to zero first 2 bytes of content)
|
||||
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
|
||||
// XXX test this routine
|
||||
|
||||
// XXX handle strings located in program area
|
||||
// XXX change DSCPNT format to be compliant with all other descriptors
|
||||
|
||||
varstr_free:
|
||||
|
||||
// First copy the string descriptor data to DSCPNT
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
|
||||
// XXX test this routine
|
||||
|
||||
// XXX change DSCPNT format to be compliant with all other descriptors
|
||||
|
||||
|
||||
varstr_garbage_collect:
|
||||
|
||||
// The routine utilizes the 'shift_mem_up' - which leaves INDEX+0 and INDEX+1
|
||||
|
||||
Reference in new issue
Block a user