From d8fa43d7a6c08edd18d87b2500dd0d9c3a28ebd8 Mon Sep 17 00:00:00 2001 From: cuz Date: Wed, 5 Jan 2005 20:05:27 +0000 Subject: [PATCH] Save a few bytes git-svn-id: svn://svn.cc65.org/cc65/trunk@3344 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- libsrc/common/free.s | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/libsrc/common/free.s b/libsrc/common/free.s index fe119d9ed..8cf354b62 100644 --- a/libsrc/common/free.s +++ b/libsrc/common/free.s @@ -75,19 +75,16 @@ _free: sta ptr2 ; Is the argument NULL? If so, bail out. ora ptr2+1 ; Is the argument NULL? - bne @L0 ; Jump if no + bne @L1 ; Jump if no rts ; Bail out if yes ; There's a pointer below the user space that points to the real start of the -; raw block. The first word of the raw block is the total size of the block. -; Remember the block size in ptr1. - -@L0: lda ptr2 - sub #2 - sta ptr2 - bcs @L1 - dec ptr2+1 -@L1: ldy #1 +; raw block. We will decrement the high pointer byte and use an offset of 254 +; to save some code. The first word of the raw block is the total size of the +; block. Remember the block size in ptr1. + +@L1: dec ptr2+1 ; Decrement high pointer byte + ldy #$FF lda (ptr2),y ; High byte of real block address tax dey -- 2.39.5