From d6163f7cf7d5c0766f4531bef03865ea29656a2a Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Thu, 23 Jul 2020 16:36:31 +0200 Subject: [PATCH] small optimization in string handling code --- src/basic/engine_variables/tmpstr_free.s | 2 +- src/basic/engine_variables/tmpstr_free_all.s | 2 +- src/basic/engine_variables/varstr_free.s | 13 ++++++------- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/basic/engine_variables/tmpstr_free.s b/src/basic/engine_variables/tmpstr_free.s index b21678dd..14d41291 100644 --- a/src/basic/engine_variables/tmpstr_free.s +++ b/src/basic/engine_variables/tmpstr_free.s @@ -64,7 +64,7 @@ tmpstr_free_loop: sty DSCPNT+0 phx_trash_a - jsr varstr_free_non_0 + jsr varstr_free_no_checks plx_trash_a // Mark empty string as free and quit diff --git a/src/basic/engine_variables/tmpstr_free_all.s b/src/basic/engine_variables/tmpstr_free_all.s index 86e5f6fe..bd0f3067 100644 --- a/src/basic/engine_variables/tmpstr_free_all.s +++ b/src/basic/engine_variables/tmpstr_free_all.s @@ -28,7 +28,7 @@ tmpstr_free_all_loop: sta DSCPNT+2 phx_trash_a - jsr varstr_free_non_0 + jsr varstr_free_no_checks plx_trash_a !: inx diff --git a/src/basic/engine_variables/varstr_free.s b/src/basic/engine_variables/varstr_free.s index 1f57d165..b4815d7a 100644 --- a/src/basic/engine_variables/varstr_free.s +++ b/src/basic/engine_variables/varstr_free.s @@ -16,21 +16,20 @@ varstr_free: // Check the string size - do not do anything if 0 lda DSCPNT+0 - bne varstr_free_non_0 + bne !+ rts - -varstr_free_non_0: // entry point to be used when it is clear that string is not empty - +!: // Check if string is above FRETOP (in string area) - // XXX move this check out of the routine jsr helper_cmp_fretop - bcs !+ + bcs varstr_free_no_checks // No, it does not belong to string area - quit rts -!: + +varstr_free_no_checks: // entry point to be used when it is clear that string is not empty and above FRETOP + // Check if this is the lowest string bne varstr_free_inside