From d8f738409178f85e75448cfc21108a4ae2b6c393 Mon Sep 17 00:00:00 2001 From: cuz Date: Tue, 1 Jun 2004 20:30:44 +0000 Subject: [PATCH] Fixed a bug git-svn-id: svn://svn.cc65.org/cc65/trunk@3066 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/cc65/codeopt.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/cc65/codeopt.c b/src/cc65/codeopt.c index cb91bb380..7d1109a6f 100644 --- a/src/cc65/codeopt.c +++ b/src/cc65/codeopt.c @@ -552,16 +552,20 @@ static unsigned OptPtrStore1 (CodeSeg* S) /* Delete the old code */ CS_DelEntry (S, I+7+K); /* jsr spaspidx */ CS_DelEntry (S, I+2); /* jsr ldauidx */ - CS_DelEntry (S, I); /* jsr pushax */ /* Create and insert the stores into the zp pointer if needed */ if (RegBank == 0) { X = NewCodeEntry (OP65_STA, AM65_ZP, "ptr1", 0, L[0]->LI); - CS_InsertEntry (S, X, I); - X = NewCodeEntry (OP65_STX, AM65_ZP, "ptr1+1", 0, L[0]->LI); CS_InsertEntry (S, X, I+1); + X = NewCodeEntry (OP65_STX, AM65_ZP, "ptr1+1", 0, L[0]->LI); + CS_InsertEntry (S, X, I+2); } + /* Delete more old code. Do it here to keep a label attached to + * entry I in place. + */ + CS_DelEntry (S, I); /* jsr pushax */ + /* Remember, we had changes */ ++Changes; -- 2.39.5