From 124912a9aea7512180952f3d906fd2d3a5342ad8 Mon Sep 17 00:00:00 2001 From: Alexis Roda Date: Thu, 1 Aug 2019 13:29:38 +0200 Subject: Fix: bug accumulating cycles Fixes issue #8 --- README.md | 8 ++++---- z80count/z80count.py | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index e4efcd2..480b4a8 100644 --- a/README.md +++ b/README.md @@ -101,7 +101,7 @@ Processed with `z80count.py -s` results in: .fade_out_all_loop1 ld a, (hl) ; [7 .. 71] and 7 ; [7 .. 78] - jr z, no_fade_all_ink ; [12/7 .. 97/85] + jr z, no_fade_all_ink ; [12/7 .. 90/85] dec a ; [4 .. 89] .no_fade_all_ink @@ -109,7 +109,7 @@ Processed with `z80count.py -s` results in: ld a, (hl) ; [7 .. 100] and $38 ; [7 .. 107] - jr z, no_fade_all_paper ; [12/7 .. 126/114] + jr z, no_fade_all_paper ; [12/7 .. 119/114] sub 8 ; [7 .. 121] .no_fade_all_paper @@ -126,12 +126,12 @@ Processed with `z80count.py -s` results in: dec bc ; [6 .. 166] ld a, b ; [4 .. 170] or c ; [4 .. 174] - jr nz, fade_out_all_loop1 ; [12/7 .. 193/181] + jr nz, fade_out_all_loop1 ; [12/7 .. 186/181] pop bc ; [10 .. 191] pop hl ; [10 .. 201] dec e ; [4 .. 205] - jr nz, fade_out_all_loop0 ; [12/7 .. 224/212] + jr nz, fade_out_all_loop0 ; [12/7 .. 217/212] ``` Comments show subtotals, and there are two types: diff --git a/z80count/z80count.py b/z80count/z80count.py index f17fe8b..a609a0f 100644 --- a/z80count/z80count.py +++ b/z80count/z80count.py @@ -39,10 +39,10 @@ def z80count(line, parser, total, total_cond, subt, update, tabstop=2, debug=Fal cycles = entry["cycles"] if "/" in cycles: c = cycles.split("/") - total += int(c[1]) - total_cond += total + int(c[0]) + total_cond = total + int(c[0]) + total = total + int(c[1]) else: - total += int(cycles) + total = total + int(cycles) total_cond = 0 line = line.rstrip().rsplit(";", 1) -- cgit v1.2.3