c的代码:
main()
{
int n;
char cmos;
char result;
char temp=0;
printf("This program only is tested at win98 and award bios!!/n");
printf("The password of the cmos is:");
outportb(0x70,0x1d);
cmos=inportb(0x71);
for(n=6;n>=0;n-=2)
{temp=cmos ;
temp>>=n;
temp=temp&0x03;
printf("%d",temp);
}
outportb(0x70,0x1c);
result=inportb(0x71);
for(n=6;n>=0;n-=2)
{ temp=result;
temp>>=n;
temp=temp&0x03;
printf("%d",temp);
}
}
DELPHI代码:
procedure TForm1.Button1Click(Sender: TObject);
var
a:integer;
al:integer;
ax:integer;
s:integer;
i:integer;
temp:integer;
te:integer;
begin
begin
te:=6;
asm
mov dx,70h
mov al,1dh
out dx,al
mov dx,71h
in al,dx
end;
for i:=0 to 3do
begin
te:=te-2;
temp:=al;
temp:=temp shr te;
temp:=temp and 3;
listbox1.Items.Add(inttostr(temp));
end;
end;
begin
te:=6;
asm
mov dx,70h
mov al,1ch
out dx,al
mov dx,71h
in al,dx
end;
for i:=0 to 3do
begin
te:=te-2;
temp:=al;
temp:=temp shr te;
temp:=temp and 3;
listbox1.Items.Add(inttostr(temp));
end;
end;
end;
是不是有地方改错了?它的结果与C的不一样