下面是读取Flash Rom BIOS内容的部分代码,至于写入的代码,
比较危险,我觉得应该先熟悉汇编之后,再进行,否则很容易出错。
function Treg_edit.inportb(portAddr: word): byte;
asm
mov dx, portAddr
in al, dx
end;
procedure Treg_edit.outportb(portAddr: word; bytePut: byte);
asm
mov cl, bytePut //save dl to cl, bytePut is Passed by DL Register
mov dx, portAddr
mov al, cl
out dx, al
end;
procedure Treg_edit.SpeedButton2Click(Sender: TObject);
var _buf: array[0..127] of byte;
i:integer;
_coms:string;
begin
memo1.Text:='COMS数据';
for i:=0 to 127 do
begin
outportb($70,i);
_buf:=inportb($71);
appendstr(_coms,inttohex(_buf,2));
appendstr(_coms,#32);
end;
memo1.Lines.Add(_coms);
end;