source: branches/CpuSingleSize/Forms/FormHelp.pas

Last change on this file was 238, checked in by chronos, 16 months ago
  • Modified: Removed U prefix from unit names.
  • Fixed: Memory leaks.
File size: 1.6 KB
Line 
1unit FormHelp;
2
3interface
4
5uses
6 Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls;
7
8type
9
10 { TFormHelp }
11
12 TFormHelp = class(TForm)
13 Memo1: TMemo;
14 procedure FormCreate(Sender: TObject);
15 private
16 Output: string;
17 public
18 procedure AddText(Text: string);
19 procedure AddLine(Text: string = '');
20 end;
21
22
23implementation
24
25{$R *.lfm}
26
27uses
28 Instructions;
29
30{ TFormHelp }
31
32procedure TFormHelp.FormCreate(Sender: TObject);
33var
34 InstructionSet: TInstructionSet;
35 Instruction: TInstructionInfo;
36 I: Integer;
37 J: Integer;
38begin
39 Output := '';
40 InstructionSet := TInstructionSet.Create;
41 AddLine('Registers:');
42 AddLine('R0-R15: There are in total 16 registers available for general use.');
43 AddLine('SP (Stack Pointer) - points to the top of stack. It grows downwards.');
44 AddLine('IP (Instruction Pointer) - pointer to memory location where current executed instruction is located.');
45 AddLine;
46 AddLine('Instructions:');
47 for I := 0 to InstructionSet.Items.Count - 1 do begin
48 Instruction := InstructionSet.Items[I];
49 AddText(Instruction.Name);
50 for J := 0 to Length(Instruction.Params) - 1 do begin
51 if J > 0 then AddText(', ') else AddText(' ');
52 if Instruction.Params[J] = ptNumber then AddText('n')
53 else if Instruction.Params[J] = ptReg then AddText('R');
54 end;
55 AddLine;
56 AddLine(Instruction.Description);
57 AddLine;
58 end;
59
60 InstructionSet.Free;
61 Memo1.Text := Output;
62end;
63
64procedure TFormHelp.AddText(Text: string);
65begin
66 Output := Output + Text;
67end;
68
69procedure TFormHelp.AddLine(Text: string = '');
70begin
71 AddText(Text + LineEnding);
72end;
73
74end.
75
Note: See TracBrowser for help on using the repository browser.