S
smartfighter
Unregistered / Unconfirmed
GUEST, unregistred user!
这个是什么错误?没见过?
这个是什么错误?
程序的源文件是:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,nb30;
type
TForm1 = class(TForm)
Label1: TLabel;
Edit1: TEdit;
Button1: TButton;
Label2: TLabel;
Edit2: TEdit;
Button2: TButton;
procedure Button1Click(Sender: TObject);
Function NBGetAdapterAddress(a:integer):String;
function GetMasm:word;
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function TForm1.GetMasm:word;
var
Addr:word;
begin
asm
xor bx,bx
mov cx,16
@@L3: mov al,88h
out dx,al
mov al,8ch
out dx,al
shl bx,1
in al,dx
and al,01h
jz @@L4
or bx,1
@@L4: loop @@L3
mov al,88h
out dx,al
mov al,00h
out dx,al
xchg bh,bl
mov addr,bx
end;
result:=addr;
end;
function TForm1.NBGetAdapterAddress(a: integer): String;
Var
NC:TNCB;
ADAPTE : TADAPTERSTATUS;
LANAENU : TLANAENUM;
intId : Integer;
cR : Char;
strTem : String;
Begin
Result := '';
Try
ZeroMemory(@NC, SizeOf(NC));
NC.ncb_command:=Chr(NCBENUM);
cR := NetBios(@NC);
// Reissue enum command
NC.ncb_buffer := @LANAENU;
NC.ncb_length := SizeOf(LANAENU);
cR := NetBios(@NC);
If Ord(cR)<>0 Then
exit;
ZeroMemory(@NC, SizeOf(NC));
NC.ncb_command := Chr(NCBRESET);
NC.ncb_lana_num := LANAENU.lana[a];
cR := NetBios(@NC);
If Ord(cR)<>0 Then
exit;
ZeroMemory(@NC, SizeOf(NC));
NC.ncb_command := Chr(NCBASTAT);
NC.ncb_lana_num := LANAENU.lana[a];
StrPCopy(NC.ncb_callname, '*');
NC.ncb_buffer := @ADAPTE;
NC.ncb_length := SizeOf(ADAPTE);
cR := NetBios(@NC);
strTem := '';
For intId := 0 To 5 Do
strTem := strTem+ InttoHex(Integer(ADAPTE.adapter_address[intId]),2);
Result := strTem;
Finally
End;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
edit1.text:=NBGetAdapterAddress(0);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
edit2.text:=inttostr(GetMasm);
end;
end.
没提示语法错误,调用那段汇编过程的时候出现了下面的出错提示,就是在out dx,al后面停下了
然后出现提示窗口
窗口的名字是Debugger Exception Notification
内容是:project project1.exe raised excepton class EPrivillege with message 'Priviliged
instruction',process stopped.Use step or Run to continue.
是什么意思?
上面汇编的目的是要对rtl8139里面的eeprom进行读写
不过好像不行,是不是在那段汇编之前作些其他的工作,比如查找出它的i/o地址?
高手指教啊!
这个是什么错误?
程序的源文件是:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,nb30;
type
TForm1 = class(TForm)
Label1: TLabel;
Edit1: TEdit;
Button1: TButton;
Label2: TLabel;
Edit2: TEdit;
Button2: TButton;
procedure Button1Click(Sender: TObject);
Function NBGetAdapterAddress(a:integer):String;
function GetMasm:word;
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function TForm1.GetMasm:word;
var
Addr:word;
begin
asm
xor bx,bx
mov cx,16
@@L3: mov al,88h
out dx,al
mov al,8ch
out dx,al
shl bx,1
in al,dx
and al,01h
jz @@L4
or bx,1
@@L4: loop @@L3
mov al,88h
out dx,al
mov al,00h
out dx,al
xchg bh,bl
mov addr,bx
end;
result:=addr;
end;
function TForm1.NBGetAdapterAddress(a: integer): String;
Var
NC:TNCB;
ADAPTE : TADAPTERSTATUS;
LANAENU : TLANAENUM;
intId : Integer;
cR : Char;
strTem : String;
Begin
Result := '';
Try
ZeroMemory(@NC, SizeOf(NC));
NC.ncb_command:=Chr(NCBENUM);
cR := NetBios(@NC);
// Reissue enum command
NC.ncb_buffer := @LANAENU;
NC.ncb_length := SizeOf(LANAENU);
cR := NetBios(@NC);
If Ord(cR)<>0 Then
exit;
ZeroMemory(@NC, SizeOf(NC));
NC.ncb_command := Chr(NCBRESET);
NC.ncb_lana_num := LANAENU.lana[a];
cR := NetBios(@NC);
If Ord(cR)<>0 Then
exit;
ZeroMemory(@NC, SizeOf(NC));
NC.ncb_command := Chr(NCBASTAT);
NC.ncb_lana_num := LANAENU.lana[a];
StrPCopy(NC.ncb_callname, '*');
NC.ncb_buffer := @ADAPTE;
NC.ncb_length := SizeOf(ADAPTE);
cR := NetBios(@NC);
strTem := '';
For intId := 0 To 5 Do
strTem := strTem+ InttoHex(Integer(ADAPTE.adapter_address[intId]),2);
Result := strTem;
Finally
End;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
edit1.text:=NBGetAdapterAddress(0);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
edit2.text:=inttostr(GetMasm);
end;
end.
没提示语法错误,调用那段汇编过程的时候出现了下面的出错提示,就是在out dx,al后面停下了
然后出现提示窗口
窗口的名字是Debugger Exception Notification
内容是:project project1.exe raised excepton class EPrivillege with message 'Priviliged
instruction',process stopped.Use step or Run to continue.
是什么意思?
上面汇编的目的是要对rtl8139里面的eeprom进行读写
不过好像不行,是不是在那段汇编之前作些其他的工作,比如查找出它的i/o地址?
高手指教啊!