Posted: Fri Jul 06, 2007 9:09 pm Post subject: Accesing ports with Delphi
How to access ports
In the old days of DOS and 16bit Windows, writing to ports (serial, printer, game, video and other ports) in your computer was easy; all you had to do was use the "port[]" command.
Delphi no longer supports the "port[]" command, so you may have to use assembly functions as follows:
Code:
function ReadPortB
( wPort : Word ) : Byte;
begin
asm
mov dx, wPort
in al, dx
mov result, al
end;
end;
procedure WritePortB
( wPort : Word; bValue : Byte );
begin
asm
mov dx, wPort
mov al, bValue
out dx, al
end;
end;
Would've been slightly more useful if you understood what you were C/P'ing, in which case you would have explained that a virtual device driver is needed to do the IO to ports, or at least calling the system APIs that manipulate the IO permission bitmap...
ZenXChaos wrote:
HAHAH!
Im a godly copy-and-paster
_________________
Wow.... still working at 827... what's INCA thinking?
zomg l33t hax at this place (IE only). Over 150 people have used it, what are YOU waiting for?
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum