-
Notifications
You must be signed in to change notification settings - Fork 5
/
logfltr.pl
executable file
·93 lines (86 loc) · 1.86 KB
/
logfltr.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/perl
my $addr = "";
my $status = 0;
my @buf = ();
my $max = 5000;
while(<>) {
if ($status == 0) {
if (/([0-9A-F]{4}):( [0-9A-F]{2}){3}\s*LDA \$C08C,X/) {
# print("DEBUG: 0 LDA\n");
$status = 1;
push(@buf, $_);
$addr = $1;
}
else {
# print("DEBUG: 0 no LDA\n");
print;
}
}
elsif ($status == 1) {
if (/BPL \$$addr/) {
# print("DEBUG: 1 BPL\n");
$status = 2;
push(@buf, $_);
}
else {
# print("DEBUG: 1 no BPL\n");
$status = 0;
print @buf;
@buf = ();
print;
}
}
elsif ($status == 2) {
if (/EOR #\$D5/) {
# print("DEBUG: 2 EOR\n");
$status = 3;
push(@buf, $_);
}
else {
# print("DEBUG: 2 no EOR\n");
$status = 0;
print @buf;
@buf = ();
print;
}
}
elsif ($status == 3) {
if (/BNE \$$addr/) {
# print("DEBUG: 3 BNE\n");
$status = 4;
push(@buf, $_);
}
else {
# print("DEBUG: 3 no BNE\n");
$status = 0;
print @buf;
@buf = ();
print;
}
}
elsif ($status == 4) {
if (/$addr:( [0-9A-F]{2}){3}\s*LDA \$C08C,X/) {
# print("DEBUG: 4 LDA\n");
$status = 1;
@buf = ();
push(@buf, $_);
}
else {
# print("DEBUG: 4 no LDA\n");
$status = 0;
print @buf, "\n";
@buf = ();
print;
}
}
else {
# print("DEBUG: else\n");
$status = 0;
print @buf;
@buf = ();
print;
}
# if( -- $max <= 0 ) {
# last;
# }
}