-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtzxblockunsupported.inc
64 lines (52 loc) · 1.39 KB
/
tzxblockunsupported.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Copyright 2022-2025 Zoran Vučenović
// SPDX-License-Identifier: Apache-2.0
{$ifdef tzx_header_section}
TTzxBlockUnsupported = class (TTzxBlockStandard)
private
FDetails: String;
strict protected
function Load2(const Stream: TStream; L: Integer): Boolean; override;
public
constructor Create(ATapePlayer: TTapePlayer); override;
class function GetBlockId: DWord; override;
{returns whole block length, without id byte}
class function GetBlockDescription: String; override;
procedure Details(out S: String); override;
end;
{$else}
class function TTzxBlockUnsupported.GetBlockId: DWord;
begin
Result := 0;
end;
class function TTzxBlockUnsupported.GetBlockDescription: String;
begin
Result := 'Block not supported';
end;
procedure TTzxBlockUnsupported.Details(out S: String);
begin
S := FDetails;
end;
function TTzxBlockUnsupported.Load2(const Stream: TStream; L: Integer
): Boolean;
var
B: Byte;
N: Integer;
begin
if GetBlockId = 0 then begin
Stream.Seek(-5, TSeekOrigin.soCurrent);
if Stream.Read(B{%H-}, 1) <> 1 then
Exit(False);
N := B;
FDetails := 'Unknown block — 0x' + IntToHex(N, 2);
L := L + 4;
end else
FDetails := 'Block not supported';
Stream.Seek(L, TSeekOrigin.soCurrent);
Result := True;
end;
constructor TTzxBlockUnsupported.Create(ATapePlayer: TTapePlayer);
begin
inherited Create(ATapePlayer);
FDetails := '';
end;
{$endif}