/*****************************************************************************/
-/* 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
*
* 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:
*
* ldy xxx
* ldx #$00
* lda (ptr1),y
- * subop
+ * subop
* ldy yyy
* sta (ptr1),y
*
/* End of coptptrstore.h */
-#endif
-
-
-
+#endif