]> git.sur5r.net Git - cc65/blobdiff - src/cc65/coptptrstore.h
Fixed the cc65 code that handled an addition of a pointer to a 32-bit offset.
[cc65] / src / cc65 / coptptrstore.h
index 63568c30437c74fb9dc67835b19ab1e08333a4a4..3f8fc91f975cba72a7a88848ea3e5ce12a8e6290 100644 (file)
 
 
 /*****************************************************************************/
-/*                                  Code                                    */
+/*                                   Code                                    */
 /*****************************************************************************/
 
 
 
 unsigned OptPtrStore1 (CodeSeg* S);
 /* Search for the sequence:
- *
- *      clc
- *      adc     xxx
- *      bcc     L
- *      inx
- * L:   jsr    pushax
- *     ldx     #$00
- *     lda     yyy
- *     ldy     #$00
- *      jsr     staspidx
- *
- * and replace it by:
- *
- *      sta     ptr1
- *      stx     ptr1+1
- *      ldy     xxx
- *      ldx     #$00
- *      lda     yyy
- *      sta     (ptr1),y
- *
- * or by
- *
- *      ldy     xxx
- *      ldx     #$00
- *      lda     yyy
- *      sta     label,y
- *
- * or by
- *
- *      ldy     xxx
- *      ldx     #$00
- *      lda     yyy
- *      sta     $xxxx,y
- *
- * or by
- *
- *      ldy     xxx
- *      ldx     #$00
- *      lda     yyy
- *      sta     (zp),y
- *
- * depending on the two instructions preceeding the sequence above.
- */                                
+**
+**      clc
+**      adc     xxx
+**      bcc     L
+**      inx
+** L:   jsr     pushax
+**      ldx     #$00
+**      lda     yyy
+**      ldy     #$00
+**      jsr     staspidx
+**
+** and replace it by:
+**
+**      sta     ptr1
+**      stx     ptr1+1
+**      ldy     xxx
+**      ldx     #$00
+**      lda     yyy
+**      sta     (ptr1),y
+**
+** or by
+**
+**      ldy     xxx
+**      ldx     #$00
+**      lda     yyy
+**      sta     (zp),y
+**
+** or by
+**
+**      ldy     xxx
+**      ldx     #$00
+**      lda     yyy
+**      sta     label,y
+**
+** or by
+**
+**      ldy     xxx
+**      ldx     #$00
+**      lda     yyy
+**      sta     $xxxx,y
+**
+** depending on the two instructions preceeding the sequence above.
+*/
 
 unsigned OptPtrStore2 (CodeSeg* S);
 /* Search for the sequence:
- *
- *      lda     #<(label+0)
- *      ldx     #>(label+0)
- *      ldy     aaa
- *      clc
- *      adc     (sp),y
- *      bcc     L
- *      inx
- * L:   jsr    pushax
- *     ldx     #$00
- *     lda     yyy
- *     ldy     #$00
- *      jsr     staspidx
- *
- * and replace it by:
- *
- *      ldy     aaa
- *     ldx     #$00
- *     lda     (sp),y
- *      tay
- *      lda     yyy
- *      sta    label,y
- */
+**
+**      clc
+**      adc     xxx
+**      bcc     L
+**      inx
+** L:   jsr     pushax
+**      ldy     yyy
+**      ldx     #$00
+**      lda     (sp),y
+**      ldy     #$00
+**      jsr     staspidx
+**
+** and replace it by:
+**
+**      sta     ptr1
+**      stx     ptr1+1
+**      ldy     yyy-2
+**      ldx     #$00
+**      lda     (sp),y
+**      ldy     xxx
+**      sta     (ptr1),y
+**
+** or by
+**
+**      ldy     yyy-2
+**      ldx     #$00
+**      lda     (sp),y
+**      ldy     xxx
+**      sta     (zp),y
+**
+** or by
+**
+**      ldy     yyy-2
+**      ldx     #$00
+**      lda     (sp),y
+**      ldy     xxx
+**      sta     label,y
+**
+** or by
+**
+**      ldy     yyy-2
+**      ldx     #$00
+**      lda     (sp),y
+**      ldy     xxx
+**      sta     $xxxx,y
+**
+** depending on the code preceeding the sequence above.
+*/
 
 unsigned OptPtrStore3 (CodeSeg* S);
 /* Search for the sequence:
- *
- *      lda     #<(label+0)
- *      ldx     #>(label+0)
- *      ldy     aaa
- *      clc
- *      adc     (sp),y
- *      bcc     L
- *      inx
- * L:   jsr    pushax
- *      ldy     #bbb
- *     ldx     #$00
- *     lda     (sp),y
- *     ldy     #$00
- *      jsr     staspidx
- *
- * and replace it by:
- *
- *      ldy     aaa
- *     lda     (sp),y
- *      tax
- *      ldy     #bbb-2
- *      lda     (sp),y
- *      sta    label,x
- *     ldx     #$00
- */
-
-unsigned OptPtrStore4 (CodeSeg* S);
-/* Search for the sequence:
- *
- *      clc
- *      adc     xxx
- *      bcc     L
- *      inx
- * L:   jsr    pushax
- *      ldy     yyy
- *     ldx     #$00
- *     lda     (sp),y
- *     ldy     #$00
- *      jsr     staspidx
- *
- * and replace it by:
- *
- *      sta     ptr1
- *      stx     ptr1+1
- *      ldy     yyy-2
- *      ldx     #$00
- *      lda     (sp),y
- *      ldy     xxx
- *      sta     (ptr1),y
- *
- * In case a/x is loaded from the register bank before the clc, we can even
- * use the register bank instead of ptr1.
- */
-
-unsigned OptPtrStore5 (CodeSeg* S);
-/* Search for the sequence:
- *
- *     jsr     pushax
- *      ldy     xxx
- *      jsr     ldauidx
- *      subop
- *      ldy     yyy
- *     jsr     staspidx
- *
- * and replace it by:
- *
- *      sta     ptr1
- *      stx     ptr1+1
- *      ldy     xxx
- *      ldx     #$00
- *      lda     (ptr1),y
- *     subop
- *      ldy     yyy
- *      sta     (ptr1),y
- *
- * In case a/x is loaded from the register bank before the pushax, we can even
- * use the register bank instead of ptr1.
- *
- */
+**
+**      jsr     pushax
+**      ldy     xxx
+**      jsr     ldauidx
+**      subop
+**      ldy     yyy
+**      jsr     staspidx
+**
+** and replace it by:
+**
+**      sta     ptr1
+**      stx     ptr1+1
+**      ldy     xxx
+**      ldx     #$00
+**      lda     (ptr1),y
+**      subop
+**      ldy     yyy
+**      sta     (ptr1),y
+**
+** In case a/x is loaded from the register bank before the pushax, we can even
+** use the register bank instead of ptr1.
+*/
 
 
 
 /* End of coptptrstore.h */
-#endif
-
-
-
 
+#endif