summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author AmatCoder <AmatCoder@users.noreply.github.com>2019-06-30 16:52:10 +0200
committer GitHub <noreply@github.com>2019-06-30 16:52:10 +0200
commit84f9bd799cd910078f09c17ad67da399924ce6f9 (patch)
tree72fe6fcad5655edb32464f6cab53d95691e49572
parent66939696f1e68ec35964c3577b256131603fcc8a (diff)
tzx_cass.cpp: Fix loading of Generalized Data blocks
-rw-r--r--src/lib/formats/tzx_cas.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/lib/formats/tzx_cas.cpp b/src/lib/formats/tzx_cas.cpp
index 431a1c7571d..976f0eae4fe 100644
--- a/src/lib/formats/tzx_cas.cpp
+++ b/src/lib/formats/tzx_cas.cpp
@@ -348,11 +348,12 @@ static inline int tzx_handle_symbol(int16_t **buffer, const uint8_t *symtable, u
switch (starttype)
{
case 0x00:
- toggle_wave_data();
+ // pulse level has already been toggled so don't change
break;
case 0x01:
- // don't change
+ // pulse level has already been toggled so revert
+ toggle_wave_data();
break;
case 0x02:
@@ -383,9 +384,7 @@ static inline int tzx_handle_symbol(int16_t **buffer, const uint8_t *symtable, u
}
else
{
- toggle_wave_data();
- i = maxp;
- continue;
+ break;
}
}
@@ -425,7 +424,7 @@ static int tzx_handle_generalized(int16_t **buffer, const uint8_t *bytes, int pa
const uint8_t *table2 = symtable + (2 * npp + 1)*asp;
// the Pilot and sync data stream has an RLE encoding
- for (int i = 0; i < totp; i+=3)
+ for (int i = 0; i < totp*3; i+=3)
{
uint8_t symbol = table2[i + 0];
uint16_t repetitions = table2[i + 1] + (table2[i + 2] << 8);