unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 =
class(TForm)
Button1: TButton;
RadioGroup1: TRadioGroup;
RadioGroup2: TRadioGroup;
procedure Button1Click(Sender: TObject);
procedure RadioGroup1Click(Sender: TObject);
procedure RadioGroup2Click(Sender: TObject);
private
{ Private declarations }
j:byte;
Data,Status,Control:Word;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.RadioGroup1Click(Sender: TObject);
var Data,Status,Control:Word;
begin
case RadioGroup1.ItemIndex
of 0 :
begin
Data := $378;
Status := $379;
Control := $37A;
end;
1 :
begin
Data := $278;
Status := $279;
Control := $27A;
end;
end;
end;
procedure TForm1.RadioGroup2Click(Sender: TObject);
//j sei die Fahrregleradresse
begin
case RadioGroup2.ItemIndex
of 0 :
begin
j:=$E0;
end;
1 :
begin
j:=$E1;
end;
2 :
begin
j:=$E2;
end;
3 :
begin
j:=$E3;
end;
end;
end;
procedure ControlOut;
var Control:word;
begin
asm //erklärt dem Compiler, dass Assembler Code anfängt
mov dx,Control
mov al,4
out dx,al
end;
end;
procedure DataOut(j:byte);
var Data:word;
begin
asm //erklärt dem Compiler, dass Assembler Code anfängt
mov dx,Data
mov al,j
out dx,al
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ControlOut;
DataOut(j);
showmessage(inttostr(j));
showmessage(inttostr(Control));
showmessage(inttostr(Status));
showmessage(inttostr(Data));
end;
end.