diff --git a/skoolkit/tapinfo.py b/skoolkit/tapinfo.py index a4725bef..d96b2d9b 100644 --- a/skoolkit/tapinfo.py +++ b/skoolkit/tapinfo.py @@ -1,4 +1,4 @@ -# Copyright 2013, 2015, 2017, 2020, 2022, 2023 +# Copyright 2013, 2015, 2017, 2020, 2022-2024 # Richard Dymond (rjdymond@gmail.com) # # This file is part of SkoolKit. @@ -305,7 +305,12 @@ def _get_block_info(data, i, block_num): i += length + 10 elif block_id == 21: header = 'Direct recording' - i += get_word3(data, i + 5) + 8 + info.append('T-states per sample: {}'.format(get_word(data, i))) + info.append('Pause: {}ms'.format(get_word(data, i + 2))) + info.append('Used bits in last byte: {}'.format(data[i + 4])) + samples_length = get_word3(data, i + 5) + info.append('Length: {}'.format(samples_length)) + i += 8 + samples_length elif block_id == 24: header = 'CSW recording' i += get_dword(data, i) + 4 diff --git a/sphinx/source/changelog.rst b/sphinx/source/changelog.rst index 2d4e2139..05bf8966 100644 --- a/sphinx/source/changelog.rst +++ b/sphinx/source/changelog.rst @@ -4,6 +4,7 @@ Changelog 9.2b1 ----- * Added support to :ref:`tap2sna.py` for TZX block type 0x15 (direct recording) +* :ref:`tapinfo.py` now shows info for TZX block type 0x15 (direct recording) 9.1 (2024-02-03) ---------------- diff --git a/sphinx/source/commands.rst b/sphinx/source/commands.rst index 63504bf7..8bc4bb8f 100644 --- a/sphinx/source/commands.rst +++ b/sphinx/source/commands.rst @@ -1769,6 +1769,8 @@ To list the options supported by `tapinfo.py`, run it with no arguments:: +---------+-------------------------------------------------------------------+ | Version | Changes | +=========+===================================================================+ +| 9.2 | Shows info for TZX block type 0x15 (direct recording) | ++---------+-------------------------------------------------------------------+ | 9.0 | Shows the LINE number (if present) for 'Program:' header blocks; | | | renders BASIC tokens in header block names | +---------+-------------------------------------------------------------------+ diff --git a/tests/test_tapinfo.py b/tests/test_tapinfo.py index ea5468dd..4e39b795 100644 --- a/tests/test_tapinfo.py +++ b/tests/test_tapinfo.py @@ -256,11 +256,21 @@ def test_tzx_block_0x14(self): self._test_tzx_block(block, exp_output) def test_tzx_block_0x15(self): - block = [21] # Block ID - block.extend([0] * 5) - block.extend((2, 0, 0)) # Length of samples - block.extend((128, 12)) # Samples - exp_output = '1: Direct recording (0x15)' + block = ( + 21, # Block ID + 80, 0, # T-states per sample + 100, 0, # Pause + 4, # Used bits in last byte + 2, 0, 0, # Length of samples data + 128, 12 # Samples + ) + exp_output = """ + 1: Direct recording (0x15) + T-states per sample: 80 + Pause: 100ms + Used bits in last byte: 4 + Length: 2 + """ self._test_tzx_block(block, exp_output) def test_tzx_block_0x18(self):