aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexis Roda <alexis.roda.villalonga@gmail.com>2019-08-01 13:29:38 +0200
committerJuan J. Martínez <jjm@usebox.net>2019-08-01 12:29:38 +0100
commit124912a9aea7512180952f3d906fd2d3a5342ad8 (patch)
tree391afb088c9237651158ff0d3102f43216a1c58c
parent1737cac3f5fda65b1f39a417980353da12599d84 (diff)
downloadz80count-124912a9aea7512180952f3d906fd2d3a5342ad8.tar.gz
z80count-124912a9aea7512180952f3d906fd2d3a5342ad8.zip
Fix: bug accumulating cycles
Fixes issue #8
-rw-r--r--README.md8
-rw-r--r--z80count/z80count.py6
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)