function SerialPort_ReadAllValues(
BaseAddr: word;
var I_CTS, I_DSR, I_RI, I_DCD: boolean): boolean;
begin
result := SerialPort_ReadModemStatusValues(
BaseAddr,
I_CTS, I_DSR, I_RI, I_DCD);
end;
function SerialPort_ReadModemStatusValues(
BaseAddr: word;
var I_CTS, I_DSR, I_RI, I_DCD: boolean): boolean;
var
Data: DWord;
Addr: DWord;
begin
if FHandle = INVALID_HANDLE_VALUE then exit;
Addr := BaseAddr + 6;
// read value on COM port if system IS NOT WinNT
if Win32Platform <> VER_PLATFORM_WIN32_NT then
begin
try
Case DataType of
DataType_Byte :
asm
mov edx,Addr
xor eax,eax
in al,dx
mov Data,eax
end;
DataType_Word :
asm
mov edx,Addr
xor eax,eax
in ax,dx
mov Data,eax
end;
DataType_DWord:
asm
mov edx,Addr
xor eax,eax
in eax,dx
mov Data,eax
end;
end;
except
result := false;
exit;
end;
end
else
// read status value on COM port if system IS WinNT
begin
try
if ZLIOStarted then
Data := ZLIOPortRead(Addr, DataType)
else
begin
Data := 0;
result := false;
end;
except
result := false;
exit;
end;
end;
// extract bits value for individual status line
I_DCD := ((Data and 128) = 128);
I_RI := ((Data and 64) = 64);
I_DSR := ((Data and 32) = 32);
I_CTS := ((Data and 16) = 16);
result := true;
end;