filled-in gaps in string memory release routine
This commit is contained in:
1 parent
8c70b51123
commit
ae174b0ad3
3 files changed
+41
-17
No files matched your search
@@ -171,12 +171,10 @@ cmd_let_assign_string:
|
||||
lda __FAC1+0
|
||||
bne cmd_let_assign_string_not_empty
|
||||
|
||||
// Yes, it is empty - check if the old one is, free it if necessary
|
||||
// Yes, it is empty - free the old one
|
||||
|
||||
lda DSCPNT+0
|
||||
bne !+
|
||||
jsr varstr_free
|
||||
!:
|
||||
|
||||
// Set the new variable as empty string
|
||||
|
||||
ldy #$00
|
||||
@@ -276,9 +274,7 @@ cmd_let_assign_string_not_text_area:
|
||||
// No special case optimization is possible
|
||||
// Free the memory belonging to the old string
|
||||
|
||||
// XXX
|
||||
// jsr varstr_free
|
||||
|
||||
jsr varstr_free
|
||||
|
||||
// And allocate memory for the new string
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Check string address (DSCPNT+1/+2) vs FRETOP
|
||||
//
|
||||
// Output:
|
||||
// - Zero flag set - this is the first variable of the string area
|
||||
// - Carry flag set - this string belongs to the string area
|
||||
|
||||
|
||||
varstr_cmp_fretop:
|
||||
|
||||
lda DSCPNT+2
|
||||
cmp FRETOP+1
|
||||
beq !+
|
||||
rts
|
||||
!:
|
||||
lda DSCPNT+2
|
||||
cmp FRETOP+1
|
||||
rts
|
||||
|
||||
@@ -6,27 +6,32 @@
|
||||
// Releases back memory used by string
|
||||
//
|
||||
// Input:
|
||||
// - DSCPNT+0 - string size
|
||||
// - DSCPNT+1, DSCPNT+2 - pointer to string
|
||||
//
|
||||
|
||||
// XXX test this routine
|
||||
// XXX check if this entry point is needed
|
||||
|
||||
|
||||
varstr_free:
|
||||
|
||||
// XXX consider moving size check (DSCPNT+0) here
|
||||
// Check the string size - do not do anything if 0
|
||||
|
||||
// XXX
|
||||
// XXX check if string is located above FRETOP, handle case if it is not
|
||||
// XXX
|
||||
lda DSCPNT+0
|
||||
bne !+
|
||||
rts
|
||||
!:
|
||||
// Check if string is above FRETOP (in string area)
|
||||
|
||||
// Quick check - is the string the lowest one?
|
||||
jsr varstr_cmp_fretop
|
||||
bcs !+
|
||||
|
||||
// No, it does not belong to string area - quit
|
||||
|
||||
rts
|
||||
!:
|
||||
// Check if this is the lowest string
|
||||
|
||||
cmp FRETOP+0
|
||||
bne varstr_free_inside
|
||||
lda DSCPNT+2
|
||||
cmp FRETOP+1
|
||||
bne varstr_free_inside
|
||||
|
||||
// This is the lowest string - so just increase FRETOP, this way
|
||||
|
||||
Reference in new issue
Block a user