function ParallelPort_ReadDataValues(
BaseAddr: word;
var I_D0, I_D1, I_D2, I_D3, I_D4, I_D5, I_D6, I_D7: boolean): boolean;
var
Data: DWord;
Addr: DWord;
begin
// work at Data register address
Addr := BaseAddr + 0;
// init data (only used if error occurs during read)
I_D0 := false;
I_D1 := false;
I_D2 := false;
I_D3 := false;
I_D4 := false;
I_D5 := false;
I_D6 := false;
I_D7 := false;
// read data value on LPT 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 data value on LPT port if system IS WinNT
begin
try
if ZLIOStarted then
Data := ZLIOPortRead(Addr, DataType_Byte)
else
begin
Data := 0;
result := false;
end;
except
result := false;
exit;
end;
end;
// extract bits value for individual data line
I_D7 := (((Data and 128) div 128) = 1);
I_D6 := (((Data and 64) div 64) = 1);
I_D5 := (((Data and 32) div 32) = 1);
I_D4 := (((Data and 16) div 16) = 1);
I_D3 := (((Data and 8) div 8) = 1);
I_D2 := (((Data and 4) div 4) = 1);
I_D1 := (((Data and 2) div 2) = 1);
I_D0 := (((Data and 1) div 1) = 1);
result := true;
end;