summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author R. Belmont <rb6502@users.noreply.github.com>2019-06-30 12:19:41 -0400
committer GitHub <noreply@github.com>2019-06-30 12:19:41 -0400
commit5edd49b910a133b1ed833ea5c7d599733dbc84e7 (patch)
tree1dbe8d52680ba45ed20b45fdff8fedb5b0fb069d
parent0cde4ce6752fedb3bf8c97fe84d9edf6bedf012a (diff)
parent84f9bd799cd910078f09c17ad67da399924ce6f9 (diff)
Merge pull request #5297 from AmatCoder/AmatCoder-tzx_fix-1
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);