aboutsummaryrefslogtreecommitdiff
path: root/z80count.py
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2019-03-19 21:00:37 +0000
committerJuan J. Martinez <jjm@usebox.net>2019-03-19 21:00:37 +0000
commit26c1712e16a1ce80ad84fdf7b9dfefb341204a3b (patch)
treed64420b9ea4a2af5f2a9efa93707d29c194b6e72 /z80count.py
parentbe2b90e229ef012596cb3f1fc426623d64b8bef3 (diff)
downloadz80count-26c1712e16a1ce80ad84fdf7b9dfefb341204a3b.tar.gz
z80count-26c1712e16a1ce80ad84fdf7b9dfefb341204a3b.zip
Make more sense of the subtotals
Diffstat (limited to 'z80count.py')
-rwxr-xr-xz80count.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/z80count.py b/z80count.py
index f361134..4111391 100755
--- a/z80count.py
+++ b/z80count.py
@@ -63,7 +63,7 @@ def main():
our_comment = re.compile(r"(\[[0-9.\s/]+\])")
- total = [0, 0]
+ total = total_cond = 0
while True:
line = in_f.readline()
if not line:
@@ -75,16 +75,19 @@ def main():
cycles = entry["cycles"]
if "/" in cycles:
c = cycles.split("/")
- total[0] += int(c[0])
- total[1] += int(c[1])
+ total += int(c[1])
+ total_cond = total + int(c[0])
else:
- total[0] += int(cycles)
- total[1] += int(cycles)
+ total += int(cycles)
+ total_cond = 0
line = line.rstrip().rsplit(";", 1)
comment = "; [%s" % cycles
if args.subt:
- comment += " .. %d/%d]" % (total[0], total[1])
+ if total_cond:
+ comment += " .. %d/%d]" % (total_cond, total)
+ else:
+ comment += " .. %d]" % total
else:
comment += "]"
if args.debug: