TZX support fully supported added batman.tzx
This commit is contained in:
@@ -41,6 +41,51 @@ namespace Core.Io
|
||||
stdBlock.Data = br.ReadBytes(stdBlock.DataLength);
|
||||
blocks.Add(stdBlock);
|
||||
break;
|
||||
case 0x11: // Turbo Speed Data Block
|
||||
var turboBlock = new TurboSpeedBlock
|
||||
{
|
||||
PilotPulseLength = br.ReadUInt16(),
|
||||
SyncFirstPulseLength = br.ReadUInt16(),
|
||||
SyncSecondPulseLength = br.ReadUInt16(),
|
||||
ZeroBitPulseLength = br.ReadUInt16(),
|
||||
OneBitPulseLength = br.ReadUInt16(),
|
||||
PilotToneLength = br.ReadUInt16(),
|
||||
UsedBitsInLastByte = br.ReadByte(),
|
||||
PauseAfterMs = br.ReadUInt16()
|
||||
};
|
||||
|
||||
// Z80 files are Little-Endian. Read 3 bytes and combine them into a 24-bit integer.
|
||||
byte len0 = br.ReadByte();
|
||||
byte len1 = br.ReadByte();
|
||||
byte len2 = br.ReadByte();
|
||||
turboBlock.DataLength = len0 | (len1 << 8) | (len2 << 16);
|
||||
|
||||
// Read the actual tape data
|
||||
turboBlock.Data = br.ReadBytes(turboBlock.DataLength);
|
||||
|
||||
blocks.Add(turboBlock);
|
||||
break;
|
||||
case 0x32: // Archive Info Block
|
||||
var archiveBlock = new ArchiveInfoBlock();
|
||||
|
||||
// The total length of the block (we read it to advance the stream,
|
||||
// but the string count is what we actually use to loop)
|
||||
ushort totalLength = br.ReadUInt16();
|
||||
byte stringCount = br.ReadByte();
|
||||
|
||||
for (int i = 0; i < stringCount; i++)
|
||||
{
|
||||
byte textId = br.ReadByte();
|
||||
byte textLength = br.ReadByte();
|
||||
|
||||
// Read the raw bytes and convert them to an ASCII string
|
||||
string text = System.Text.Encoding.ASCII.GetString(br.ReadBytes(textLength));
|
||||
|
||||
archiveBlock.Metadata[textId] = text;
|
||||
}
|
||||
|
||||
blocks.Add(archiveBlock);
|
||||
break;
|
||||
|
||||
// TODO: Add cases for 0x11 (Turbo), 0x12 (Tone), 0x13 (Pulses), etc.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user