如何用DELPHI讀寫MBR(100分)

  • 主题发起人 主题发起人 LEOKONG
  • 开始时间 开始时间
L

LEOKONG

Unregistered / Unconfirmed
GUEST, unregistred user!
W我已往都是用ASSY來做這种工作,單現在情況所逼,請問用DELPHI如何
做這種工作.
 
标记一下
俺也想知道
 
看样子只好再 delphi里内欠assy了!
 
一段读取MBR的简单代码!

Uses CRT, DOS;

var
buffermbr : array[ 0 .. 512 ] of byte; { Buffer for Master Boot Record }
regs : registers;
device : word;
s : string;

Procedure readpart;
begin
with regs do
begin
ah := $02; { Read sector service request }
al := $01; { Number of sectors to read }
ch := $00; { Cylinder number or track number for floppies }
cl := $01; { Sector Number, bits 6,7 -two high bits of 10 bit
cylinder number }
dh := $00; { Head Number }
dl := device; { C=80h, D=81H, etc }
es := seg( buffermbr );
bx := ofs( buffermbr );
end;
intr( $13, regs )
end;

调用示例:
begin
clrscr;
s := paramstr( 1 );
s[ 1 ] := upcase( s[ 1 ] );
if s[ 1 ] = 'C' then
begin
device := $80;
end
else
begin
device := Ord( s[ 1 ] ) - Ord( 'A' );
if device > 1 then
device := $80 + ( device - 2 );
end;
readpart;
end.
 
多謝YB_unique,多謝大家!
 
多人接受答案了。
 
后退
顶部