to naughtyboy: 我现在要用这两个指令读CMOS内容。你有没有什么办法?我的QQ:40342897,我在线上等你。 另外我用的是2000。
刚才说过了 2000下这两个指令不能用 如果你想操纵cmos,试试下面的例子(未调试)unit CMOS;Interfaceconst ClockSec = $00; { RTclock seconds } ClockMin = $02; { RTclock minutes } ClockHour = $04; { RTclock hours } ClockDOW = $06; { RTclock day of week } ClockDay = $07; { RTclock day in month } ClockMon = $08; { RTclock month } ClockYear = $09; { RTclock year (mod 100)} AlarmSec = $01; { Alarm seconds } AlarmMin = $03; { Alarm minutes } AlarmHour = $05; { Alarm hours } Diskettes = $10; { Floppy disk type byte } HardDisk = $12; { Regular hard disk type } HDExt1 = $19; { Extended hard disk type, unit 1 } HDExt2 = $1A; { Extended hard disk type, unit 2 } Equipment = $14; { Equipment list } CheckLo = $2F; { Checksum low } CheckHi = $2E; { Checksum high } BaseLo = $15; { Base mem low } BaseHi = $16; { Base mem high } ExpdLo = $17; { Expansion mem size low } ExpdHi = $18; { Expansion mem size high } StatRegA = $0A; { Status Register A } StatRegB = $0B; { Status register B } StatRegC = $0C; { Status register C } StatRegD = $0D; { Status register D } DiagStat = $0E; { Diagnostic status byte } ShutDown = $0F; { Shutdown status byte } Century = $32; { BCD Century number } AltExpdLo = $30; { Expansion mem size low (alternate) } AltExpdHi = $31; { Expansion mem size high (alternate) } InfoFlags = $33; { Bit 7 set = top 128k installed, bit 6 set = first user message (?) }function ReadCmos(Address: byte): byte; { Returns the byte at the given CMOS ADDRESS }procedure WriteCmos(Address, Data: byte); { Writes DATA to ADDRESS in CMOS ram }procedure SetCMOSCheckSum; { Sets the CMOS checksum after you've messed with it :-}{ The following bytes are RESERVED: $11, $13, $1B-$2D, and $34-$3F ($3F s the end of the CMOS area). You'll note that some of these are included in the checksum calculation. }implementationconst CmosAddr = $70; { CMOS control port } CmosData = $71; { CMOS data port }function ReadCmos(Address: byte): byte; begin port[CmosAddr] := Address; ReadCmos := port[CmosData] end; {ReadCmos}procedure WriteCmos(Address, Data: byte); begin port[CmosAddr] := Address; port[CmosData] := Data yend; {WriteCmos}procedure SetCMOSCheckSum; { The checksum is simply the sum of $10 to $2D (some of these bytes are reserved) }var I, Sum: word; begin Sum := 0; for I:= $10 to $2D do Sum := Sum + ReadCmos(I); WriteCmos(CheckHi, Hi(sum)); WriteCmos(CheckLo, Lo(sum)); end; {SetCMOSCheckSum}end.
procedure WritePort(PortAdress:word;Value:byte); pascal;
begin
asm
mov al,Value
mov dx,PortAdress
out dx,al
end;
end;function ReadPort(PortAdress:word) : byte; pascal;
begin
asm
mov dx,PortAdress
in al,dx
mov @result,al
end;
end;
mov dx, $378
mov al, $55h
out dx, al
end;
我用了你的函数,还是那个错误,我想主要是程序不让用这种指令(IN/OUT),应该在那个地方要加个什么编绎符号进入.
忘记提示你了
这样的程序只能在9x下运行
因为NT/2000不允许对I/O口直接读和写
IO口不是串口和并口。
对串口操作可以调用windows API函数
我现在要用这两个指令读CMOS内容。你有没有什么办法?我的QQ:40342897,我在线上等你。
另外我用的是2000。
2000下这两个指令不能用
如果你想操纵cmos,试试下面的例子(未调试)unit CMOS;Interfaceconst
ClockSec = $00; { RTclock seconds }
ClockMin = $02; { RTclock minutes }
ClockHour = $04; { RTclock hours }
ClockDOW = $06; { RTclock day of week }
ClockDay = $07; { RTclock day in month }
ClockMon = $08; { RTclock month }
ClockYear = $09; { RTclock year (mod 100)}
AlarmSec = $01; { Alarm seconds }
AlarmMin = $03; { Alarm minutes }
AlarmHour = $05; { Alarm hours }
Diskettes = $10; { Floppy disk type byte }
HardDisk = $12; { Regular hard disk type }
HDExt1 = $19; { Extended hard disk type, unit 1 }
HDExt2 = $1A; { Extended hard disk type, unit 2 }
Equipment = $14; { Equipment list }
CheckLo = $2F; { Checksum low }
CheckHi = $2E; { Checksum high }
BaseLo = $15; { Base mem low }
BaseHi = $16; { Base mem high }
ExpdLo = $17; { Expansion mem size low }
ExpdHi = $18; { Expansion mem size high }
StatRegA = $0A; { Status Register A }
StatRegB = $0B; { Status register B }
StatRegC = $0C; { Status register C }
StatRegD = $0D; { Status register D }
DiagStat = $0E; { Diagnostic status byte }
ShutDown = $0F; { Shutdown status byte }
Century = $32; { BCD Century number }
AltExpdLo = $30; { Expansion mem size low (alternate) }
AltExpdHi = $31; { Expansion mem size high (alternate) }
InfoFlags = $33; { Bit 7 set = top 128k installed, bit
6 set = first user message (?) }function ReadCmos(Address: byte): byte;
{ Returns the byte at the given CMOS ADDRESS }procedure WriteCmos(Address, Data: byte);
{ Writes DATA to ADDRESS in CMOS ram }procedure SetCMOSCheckSum;
{ Sets the CMOS checksum after you've messed with it :-}{ The following bytes are RESERVED: $11, $13, $1B-$2D, and
$34-$3F ($3F s the end of the CMOS area). You'll note that
some of these are included in the checksum calculation. }implementationconst
CmosAddr = $70; { CMOS control port }
CmosData = $71; { CMOS data port }function ReadCmos(Address: byte): byte;
begin
port[CmosAddr] := Address;
ReadCmos := port[CmosData]
end; {ReadCmos}procedure WriteCmos(Address, Data: byte);
begin
port[CmosAddr] := Address;
port[CmosData] := Data
yend; {WriteCmos}procedure SetCMOSCheckSum;
{ The checksum is simply the sum of $10 to $2D
(some of these bytes are reserved) }var
I, Sum: word;
begin
Sum := 0;
for I:= $10 to $2D do Sum := Sum + ReadCmos(I);
WriteCmos(CheckHi, Hi(sum));
WriteCmos(CheckLo, Lo(sum));
end; {SetCMOSCheckSum}end.