Skip to content

Commit 1c93a51

Browse files
committed
include\opt_BP.inc optimizations
1 parent 43de2f7 commit 1c93a51

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed

origin/include/opt6502/opt_BP.inc

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,43 @@ begin
753753
end;
754754

755755

756+
if STA_BP2_Y(i+12) and // sta (:bp2),y ; 12
757+
758+
ldy_im_0(i) and (listing[i] = listing[i+7]) and // ldy #$00 ; 0
759+
760+
lda_bp2_y(i+1) and // lda (:bp2),y ; 1
761+
sta_stack(i+2) and // sta :STACKORIGIN ; 2
762+
iny(i+3) and // iny ; 3
763+
lda_bp2_y(i+4) and // lda (:bp2),y ; 4
764+
sta_stack(i+5) and // sta :STACKORIGIN+STACKWIDTH ; 5
765+
mwy_bp2(i+6) and // mwy X :bp2 ; 6
766+
// ldy_im_0(i+7) and // ldy #$00 ; 7
767+
lda_stack(i+8) and // lda :STACKORIGIN ; 8
768+
STA_BP2_Y(i+9) and // sta (:bp2),y ; 9
769+
iny(i+10) and // iny ; 10
770+
lda_stack(i+11) then // lda :STACKORIGIN+STACKWIDTH ; 11
771+
// STA_BP2_Y(i+12) then // sta (:bp2),y ; 12
772+
if argMatch(i+2, i+8) and
773+
argMatch(i+5, i+11) then
774+
begin
775+
listing[i] := #9'mwy ' + GetString(i+6) + ' :TMP';
776+
listing[i+1] := #9'ldy #$00';
777+
listing[i+2] := #9'lda (:bp2),y';
778+
listing[i+3] := #9'sta (:TMP),y';
779+
listing[i+4] := #9'iny';
780+
listing[i+5] := #9'lda (:bp2),y';
781+
listing[i+6] := #9'sta (:TMP),y';
782+
listing[i+7] := '';
783+
listing[i+8] := '';
784+
listing[i+9] := '';
785+
listing[i+10]:= '';
786+
listing[i+11]:= '';
787+
listing[i+12]:= '';
788+
789+
exit(false);
790+
end;
791+
792+
756793
if STA_BP2_Y(i+7) and // sta (:bp2),y ; 7
757794

758795
lda_a(i) and (iy(i) = false) and // lda ; 0

src/include/opt6502/opt_BP.inc

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,43 @@ begin
753753
end;
754754

755755

756+
if STA_BP2_Y(i+12) and // sta (:bp2),y ; 12
757+
758+
ldy_im_0(i) and (listing[i] = listing[i+7]) and // ldy #$00 ; 0
759+
760+
lda_bp2_y(i+1) and // lda (:bp2),y ; 1
761+
sta_stack(i+2) and // sta :STACKORIGIN ; 2
762+
iny(i+3) and // iny ; 3
763+
lda_bp2_y(i+4) and // lda (:bp2),y ; 4
764+
sta_stack(i+5) and // sta :STACKORIGIN+STACKWIDTH ; 5
765+
mwy_bp2(i+6) and // mwy X :bp2 ; 6
766+
// ldy_im_0(i+7) and // ldy #$00 ; 7
767+
lda_stack(i+8) and // lda :STACKORIGIN ; 8
768+
STA_BP2_Y(i+9) and // sta (:bp2),y ; 9
769+
iny(i+10) and // iny ; 10
770+
lda_stack(i+11) then // lda :STACKORIGIN+STACKWIDTH ; 11
771+
// STA_BP2_Y(i+12) then // sta (:bp2),y ; 12
772+
if argMatch(i+2, i+8) and
773+
argMatch(i+5, i+11) then
774+
begin
775+
listing[i] := #9'mwy ' + GetString(i+6) + ' :TMP';
776+
listing[i+1] := #9'ldy #$00';
777+
listing[i+2] := #9'lda (:bp2),y';
778+
listing[i+3] := #9'sta (:TMP),y';
779+
listing[i+4] := #9'iny';
780+
listing[i+5] := #9'lda (:bp2),y';
781+
listing[i+6] := #9'sta (:TMP),y';
782+
listing[i+7] := '';
783+
listing[i+8] := '';
784+
listing[i+9] := '';
785+
listing[i+10]:= '';
786+
listing[i+11]:= '';
787+
listing[i+12]:= '';
788+
789+
exit(false);
790+
end;
791+
792+
756793
if STA_BP2_Y(i+7) and // sta (:bp2),y ; 7
757794

758795
lda_a(i) and (iy(i) = false) and // lda ; 0

0 commit comments

Comments
 (0)