几个I/O端口操作函数

I

import

Unregistered / Unconfirmed
GUEST, unregistred user!
function PortIn(IOport:word):byte; assembler; asm
mov dx,ax
in al,dx
end;
function PortInW(IOport:word):word; assembler;
asm
mov dx,ax
in ax,dx
end;
procedure PortOut(IOport:word; Value:byte); assembler;
asm
xchg ax,dx
out dx,al
end;
procedure PortOutW(IOport:word; Value:word); assembler;
asm
xchg ax,dx
out dx,ax
end
{ Example use }
PROCEDURE TMainWin.Command(val:BYTE);
VAR Delay,num:INTEGER;
BEGIN
PortOut(Port,Val);
FOR Delay:= 1 TO 500 DO;
PortOut(Port+2,7);
FOR Delay:= 1 TO 500 DO;
num:= PortIn(Port+1) AND $32;
ShowMessage('Value read = '+IntToStr(num))
END;
 

Similar threads

I
回复
0
查看
650
import
I
I
回复
0
查看
585
import
I
I
回复
0
查看
590
import
I
I
回复
0
查看
665
import
I
I
回复
0
查看
564
import
I
顶部