| 1 | unit FormHelp;
|
|---|
| 2 |
|
|---|
| 3 | interface
|
|---|
| 4 |
|
|---|
| 5 | uses
|
|---|
| 6 | Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls;
|
|---|
| 7 |
|
|---|
| 8 | type
|
|---|
| 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 |
|
|---|
| 23 | implementation
|
|---|
| 24 |
|
|---|
| 25 | {$R *.lfm}
|
|---|
| 26 |
|
|---|
| 27 | uses
|
|---|
| 28 | Instructions;
|
|---|
| 29 |
|
|---|
| 30 | { TFormHelp }
|
|---|
| 31 |
|
|---|
| 32 | procedure TFormHelp.FormCreate(Sender: TObject);
|
|---|
| 33 | var
|
|---|
| 34 | InstructionSet: TInstructionSet;
|
|---|
| 35 | Instruction: TInstructionInfo;
|
|---|
| 36 | I: Integer;
|
|---|
| 37 | J: Integer;
|
|---|
| 38 | begin
|
|---|
| 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;
|
|---|
| 62 | end;
|
|---|
| 63 |
|
|---|
| 64 | procedure TFormHelp.AddText(Text: string);
|
|---|
| 65 | begin
|
|---|
| 66 | Output := Output + Text;
|
|---|
| 67 | end;
|
|---|
| 68 |
|
|---|
| 69 | procedure TFormHelp.AddLine(Text: string = '');
|
|---|
| 70 | begin
|
|---|
| 71 | AddText(Text + LineEnding);
|
|---|
| 72 | end;
|
|---|
| 73 |
|
|---|
| 74 | end.
|
|---|
| 75 |
|
|---|