]> git.sur5r.net Git - cc65/blobdiff - src/cc65/coptptrstore.h
Merge remote-tracking branch 'upstream/master' into a5200
[cc65] / src / cc65 / coptptrstore.h
index bb21a9966c02a834a3635dad4e2581dee023d89a..b784a889a880a8c0f957f6db09e8bf275e2d2c24 100644 (file)
@@ -44,7 +44,7 @@
 
 
 /*****************************************************************************/
-/*                                  Code                                    */
+/*                                   Code                                    */
 /*****************************************************************************/
 
 
 unsigned OptPtrStore1 (CodeSeg* S);
 /* Search for the sequence:
  *
- *      lda     #<(label+0)
- *      ldx     #>(label+0)
  *      clc
  *      adc     xxx
  *      bcc     L
  *      inx
- * L:   jsr    pushax
- *     ldx     #$00
- *     lda     yyy
- *     ldy     #$00
+ * 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    label,y
- */
-
-unsigned OptPtrStore2 (CodeSeg* S);
-/* Search for the sequence:
+ *      ldx     #$00
+ *      lda     yyy
+ *      sta     (ptr1),y
  *
- *      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
+ * or by
  *
- * and replace it by:
+ *      ldy     xxx
+ *      ldx     #$00
+ *      lda     yyy
+ *      sta     (zp),y
+ *
+ * or by
  *
- *      ldy     aaa
- *     ldx     #$00
- *     lda     (sp),y
- *      tay
+ *      ldy     xxx
+ *      ldx     #$00
  *      lda     yyy
- *      sta    label,y
- */
-
-unsigned OptPtrStore3 (CodeSeg* S);
-/* Search for the sequence:
+ *      sta     label,y
  *
- *      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
+ * or by
  *
- * and replace it by:
+ *      ldy     xxx
+ *      ldx     #$00
+ *      lda     yyy
+ *      sta     $xxxx,y
  *
- *      ldy     aaa
- *     lda     (sp),y
- *      tax
- *      ldy     #bbb-2
- *      lda     (sp),y
- *      sta    label,x
- *     ldx     #$00
+ * depending on the two instructions preceeding the sequence above.
  */
 
-unsigned OptPtrStore4 (CodeSeg* S);
+unsigned OptPtrStore2 (CodeSeg* S);
 /* Search for the sequence:
  *
- *      ldy     #offs1
  *      clc
- *      adc     (sp),y
+ *      adc     xxx
  *      bcc     L
  *      inx
  * L:   jsr     pushax
- *     ldy     #offs2
+ *      ldy     yyy
  *      ldx     #$00
  *      lda     (sp),y
  *      ldy     #$00
@@ -145,50 +113,48 @@ unsigned OptPtrStore4 (CodeSeg* S);
  *
  *      sta     ptr1
  *      stx     ptr1+1
+ *      ldy     yyy-2
  *      ldx     #$00
- *      ldy     #offs2-2
  *      lda     (sp),y
- *      ldy     #offs1
+ *      ldy     xxx
  *      sta     (ptr1),y
- */
-
-unsigned OptPtrStore5 (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
+ * or by
  *
- * and replace it by:
+ *      ldy     yyy-2
+ *      ldx     #$00
+ *      lda     (sp),y
+ *      ldy     xxx
+ *      sta     (zp),y
+ *
+ * or by
  *
- *      sta     ptr1
- *      stx     ptr1+1
  *      ldy     yyy-2
  *      ldx     #$00
  *      lda     (sp),y
  *      ldy     xxx
- *      sta     (ptr1),y
+ *      sta     label,y
  *
- * In case a/x is loaded from the register bank before the clc, we can even
- * use the register bank instead of ptr1.
+ * or by
+ *
+ *      ldy     yyy-2
+ *      ldx     #$00
+ *      lda     (sp),y
+ *      ldy     xxx
+ *      sta     $xxxx,y
+ *
+ * depending on the code preceeding the sequence above.
  */
-                                   
-unsigned OptPtrStore6 (CodeSeg* S);
+
+unsigned OptPtrStore3 (CodeSeg* S);
 /* Search for the sequence:
  *
- *     jsr     pushax
+ *      jsr     pushax
  *      ldy     xxx
  *      jsr     ldauidx
  *      subop
  *      ldy     yyy
- *     jsr     staspidx
+ *      jsr     staspidx
  *
  * and replace it by:
  *
@@ -197,7 +163,7 @@ unsigned OptPtrStore6 (CodeSeg* S);
  *      ldy     xxx
  *      ldx     #$00
  *      lda     (ptr1),y
- *     subop
+ *      subop
  *      ldy     yyy
  *      sta     (ptr1),y
  *
@@ -209,8 +175,5 @@ unsigned OptPtrStore6 (CodeSeg* S);
 
 
 /* End of coptptrstore.h */
-#endif
-
-
-
 
+#endif