Message-ID: <3B28647A.CF02A268@borland.newsgroups> Date: Thu, 14 Jun 2001 17:15:06 +1000 From: Charles Hacker X-Mailer: Mozilla 4.76 [en] (Win95; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: borland.public.delphi.basm Subject: Re: Pararel Port References: <3b280e38_1@dnews> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 132.234.46.2 X-Trace: dnews 992502933 132.234.46.2 (14 Jun 2001 00:15:33 -0700) Lines: 55 Path: dnews Xref: dnews borland.public.delphi.basm:5365 Yoel wrote: > > I want to know how to write and read from parallel port with D5 in BASM that > support Win32. Would anyone like to help me? If you want to send data to the ports then following functions work for Delphi 3-5 with Win95/98. (But not for NT or W2K. For NT/W2K you need a driver.) 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; I have an example D3 program and code, that uses the above, on my home page at: http://132.234.46.5/Programs/Simple/portdev.zip -- Charles Hacker Lecturer in Electronics and Computing School of Engineering Griffith University - Gold Coast Australia