improve copy16 refactor

This commit is contained in:
Joshua Bell 2018-02-25 19:05:59 -08:00
parent e34f63fa12
commit 2f0416e4cc
4 changed files with 24 additions and 60 deletions

View File

@ -7827,10 +7827,7 @@ L4FF6: lda ($06),y
MLI_RELAY_CALL CREATE, create_params
beq L5027
jsr DESKTOP_SHOW_ALERT0
lda L504E
sta L4F68
lda L504F
sta L4F69
copy16 L504E, L4F68
jmp L4FC6
rts

View File

@ -48,10 +48,7 @@ L9017: lda $0C00
rts
L903C: ldx #$01
lda $DB1C
sta L904B
lda $DB1D
sta L904C
copy16 $DB1C, L904B
.byte $AD
L904B: .byte $34
L904C: .byte $12
@ -93,10 +90,7 @@ L9088: sta L9104
bpl L9093
jmp L9016
L9093: lda $0C00
sta L938B
lda $0C01
sta L938C
L9093: copy16 $0C00, L938B
lda L9103
cmp #$01
bne L90D3
@ -107,10 +101,7 @@ L9093: lda $0C00
lda L938B
jsr L9A0A
inc $0C00
lda $DB1C
sta L90C6
lda $DB1D
sta L90C7
copy16 $DB1C, L90C6
.byte $EE
L90C6: .byte $34
L90C7: .byte $12
@ -281,10 +272,7 @@ L9215: lda L938D
L9220: ldx L938B
inc L938B
inc $0C00
lda $DB1C
sta L9236
lda $DB1D
sta L9237
copy16 $DB1C, L9236
.byte $EE
L9236: .byte $34
L9237: .byte $12
@ -1103,10 +1091,7 @@ L9AA1: tax
bne L9AC0
L9AA8: dec $0C00
dec L938B
lda $DB1C
sta L9ABB
lda $DB1D
sta L9ABC
copy16 $DB1C, L9ABB
.byte $CE
L9ABB: .byte $34
L9ABC: .byte $12

View File

@ -1406,10 +1406,7 @@ L5F5B: jsr L5ECB
sta L50A9
lda #$01
sta L6069
lda $1423
sta L606A
lda $1424
sta L606B
copy16 $1423, L606A
lda $1425
and #$7F
sta $177F
@ -2035,10 +2032,7 @@ L658B: cmp #$09
jsr L62C8
jsr L6E45
stax $06
lda $DAA8
sta $08
lda $DAA9
sta $09
copy16 $DAA8, $08
MGTK_RELAY_CALL MGTK::MoveTo, $06
bit $D8EB
bpl L65C8
@ -2060,10 +2054,7 @@ L65D6: copy16 #$D8EF, $06
jsr L62C8
jsr L6E72
stax $06
lda $DAB4
sta $08
lda $DAB5
sta $09
copy16 $DAB4, $08
MGTK_RELAY_CALL MGTK::MoveTo, $06
bit $D8EB
bpl L6626
@ -2382,10 +2373,7 @@ L69D5: lda L6A17
jsr L6E45
inc $D402
stax $06
lda $DAA8
sta $08
lda $DAA9
sta $09
copy16 $DAA8, $08
lda $D5B7
jsr L62C8
MGTK_RELAY_CALL MGTK::MoveTo, $06
@ -2402,10 +2390,7 @@ L6A17: .byte 0
L6A1E: dec $D402
jsr L6E45
stax $06
lda $DAA8
sta $08
lda $DAA9
sta $09
copy16 $DAA8, $08
lda $D5B7
jsr L62C8
MGTK_RELAY_CALL MGTK::MoveTo, $06
@ -2433,10 +2418,7 @@ L6A6B: ldx $D402
inc $D484
jsr L6E45
stax $06
lda $DAA8
sta $08
lda $DAA9
sta $09
copy16 $DAA8, $08
lda $D5B7
jsr L62C8
MGTK_RELAY_CALL MGTK::MoveTo, $06
@ -2540,10 +2522,7 @@ L6B81: lda L6BC3
jsr L6E72
inc $D443
stax $06
lda $DAB4
sta $08
lda $DAB5
sta $09
copy16 $DAB4, $08
lda $D5B7
jsr L62C8
MGTK_RELAY_CALL MGTK::MoveTo, $06
@ -2560,10 +2539,7 @@ L6BC3: .byte 0
L6BCA: dec $D443
jsr L6E72
stax $06
lda $DAB4
sta $08
lda $DAB5
sta $09
copy16 $DAB4, $08
lda $D5B7
jsr L62C8
MGTK_RELAY_CALL MGTK::MoveTo, $06
@ -2591,10 +2567,7 @@ L6C17: ldx $D443
inc $D484
jsr L6E72
stax $06
lda $DAB4
sta $08
lda $DAB5
sta $09
copy16 $DAB4, $08
lda $D5B7
jsr L62C8
MGTK_RELAY_CALL MGTK::MoveTo, $06

View File

@ -142,6 +142,15 @@ $text =~ s/
\s+ sta \s+ ([L\$][0-9A-F]{2,4}) \b
/(hex(substr($2,1)) + 1 == hex(substr($4,1))) ? "copy16 #\$$3$1, $2" : $&/egx;
$text =~ s/
\b lda \s+ ([L\$][0-9A-F]{2,4}) \n
\s+ sta \s+ ([L\$][0-9A-F]{2,4}) \n
\s+ lda \s+ ([L\$][0-9A-F]{2,4}) \n
\s+ sta \s+ ([L\$][0-9A-F]{2,4}) \b
/(hex(substr($1,1)) + 1 == hex(substr($3,1))) &&
(hex(substr($2,1)) + 1 == hex(substr($4,1)))
? "copy16 $1, $2" : $&/egx;
$text =~ s/
\b lda \s+ ([L\$][0-9A-F]{2,4}) \n
\s+ clc \n