-
Notifications
You must be signed in to change notification settings - Fork 1
/
tzxblock34.inc
69 lines (54 loc) · 1.55 KB
/
tzxblock34.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
65
66
67
68
// Copyright 2022-2024 Zoran Vučenović
// SPDX-License-Identifier: Apache-2.0
{$ifdef tzx_header_section}
TTzxBlock34 = class (TTzxBlock)
strict private
FGeneralEmulationFlags: Word;
ScreenRefreshDelay: Byte;
InteruptFrequency: Word;
public
constructor Create(ATapePlayer: TTapePlayer); override;
class function GetBlockId: DWord; override;
{returns whole block length, but without id byte}
function GetBlockLength: Integer; override;
function LoadBlock(const Stream: TStream): Boolean; override;
class function GetBlockDescription: String; override;
end;
{$else}
constructor TTzxBlock34.Create(ATapePlayer: TTapePlayer);
begin
inherited Create(ATapePlayer);
ScreenRefreshDelay := 1;
FGeneralEmulationFlags := Word(%0000000011100111);
end;
class function {TTzxPlayer.}TTzxBlock34.GetBlockId: DWord;
begin
Result := $34;
end;
function {TTzxPlayer.}TTzxBlock34.GetBlockLength: Integer;
begin
Result := 8;
end;
function {TTzxPlayer.}TTzxBlock34.LoadBlock(const Stream: TStream): Boolean;
var
W: Word;
begin
Result := False;
if Stream.Size - Stream.Position >= 8 then begin
if Stream.Read(W{%H-}, 2) = 2 then begin
FGeneralEmulationFlags := LEtoN(W);
if Stream.Read(ScreenRefreshDelay, 1) = 1 then begin
if Stream.Read(W, 2) = 2 then begin
W := LEtoN(W);
InteruptFrequency := W mod 999;
Stream.Seek(3, TSeekOrigin.soCurrent);
end;
end;
end;
end;
end;
class function {TTzxPlayer.}TTzxBlock34.GetBlockDescription: String;
begin
Result := 'Emulation info';
end;
{$endif}