Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Read/Write Parallel Port In Assembly Language

28 Oct 2019   #1
joeyc100

windows 7 ultimatex64
 
 
Read/Write Parallel Port In Assembly Language

Hi all,
I would like to read and write the parallel port (0378h) in assembly language.
I am aware of an Inpout32.dll and have installed it in SYSTEM32\DRIVERS, but I do not know the calling sequence. Can anyone help.
Joe.


My System SpecsSystem Spec
.
28 Oct 2019   #2
samuria

win 8 32 bit
 
 

Why do you need a dll for assembly language?
My System SpecsSystem Spec
28 Oct 2019   #3
joeyc100

windows 7 ultimatex64
 
 

Because Win 7 does not allow access to the parallel port. Just doing an "OUT 0378h,reg" from an assembly language subroutine called by a high level program results in a NOP. The system level driver INPOUT32.sys was developed for this reason, but is used by C programs.
My System SpecsSystem Spec
.

28 Oct 2019   #4
LMiller7

Windows 7 Pro 64 bit
 
 

My System SpecsSystem Spec
28 Oct 2019   #5
joeyc100

windows 7 ultimatex64
 
 

Thanks, but this is the item that I mentioned: Inpout32. It can be installed in the system32\drivers file, or included in the user's program file, or as a .lib file for C programs. But I do not know how to access it from an assembly language subroutine: the calling sequence with the passing of arguments. It appears obvious that a C program once compiled into machine language does this.
My System SpecsSystem Spec
29 Oct 2019   #6
iko22

Windows 7 x64, Vista x64, 8.1 smartphone
 
 

Quote   Quote: Originally Posted by joeyc100 View Post
Hi all,
I would like to read and write the parallel port (0378h) in assembly language.
Quote   Quote: Originally Posted by joeyc100 View Post
Because Win 7 does not allow access to the parallel port. Just doing an "OUT 0378h,reg" from an assembly language subroutine called by a high level program results in a NOP.
You could try installing DOSbox, and running your assembly language program from within DOSbox. That way you wont need InpOut32 and you will safely bypass the Protect Mode features of the Windows Operating System.

Source: MASM using DOSBOX in Windows 10/8/7
My System SpecsSystem Spec
29 Oct 2019   #7
joeyc100

windows 7 ultimatex64
 
 

Dosbox does not handle the parallel port except with an add-on and then only as a passthru for a printer. I have tried it. I need bidirectional.
My System SpecsSystem Spec
.
29 Oct 2019   #8
Alejandro85

Windows 7 Ultimate x64
 
 

So your concrete problem is how to call a C function exported from an external dll from assembly code?
My System SpecsSystem Spec
29 Oct 2019   #9
joeyc100

windows 7 ultimatex64
 
 

Yes. And, further, how to do it in assembly language.
My System SpecsSystem Spec
31 Oct 2019   #10
Alejandro85

Windows 7 Ultimate x64
 
 

You'll need to know the calling convention (ABI) that the library uses to communicate, most likely it's cdecl for C-written programs, or stdcall for WinApi style. Then have a look at the relevant documentation for the exact instructions to call the API. A source I like on the topic is Wikipedia which explains the differences between them.
It's pretty much similar to how you call the Windows API standard functions from assembly.
My System SpecsSystem Spec
Reply

 Read/Write Parallel Port In Assembly Language




Thread Tools




Similar help and support threads
Thread Forum
Byte read and write from parallel port with powershell
I'm sitting in front of a Dell Precision T5500 running Windows 7 Professional, 64bit. It has a parallel port, (device manager describes it as "ECP Printer port LPT1"), with a driver provided by Microsoft, (c:\windows\system32\DRIVERS\parport.sys). If I were to connect some dip switches and...
Hardware & Devices
Do I need a parallel port connection rather than a usb?
I'm able to print standard images but when I print Separations in advanced mode.It gives me a print error.
Hardware & Devices
Parallel port card need help
Hello I am new here and stuff that I do and I need help from you but in the beginning. I am sorry for the language because I don't know very well. I have a problem with the parallel port card , I have install this parallel port card Vergrößern BL-CP1 PCI TO 1 PORT PARALLEL KARTE NEU - Google...
Hardware & Devices
Parallel Port Solution Needed
I just build a new PC and need to connect my printer, which is a very good but older HP Laserjet 4000N with no USB connector. Which is the best approach--- use a parallel to usb cable - has anyone used these with success? install a PCI parallel port card in the PC get a print server...
Hardware & Devices
Parallel port (LPT) not working in 7
I've been using Windows 7 RC1 as a clean install. The computer has multiple drives and I have on each something else installed (XP, 7 and Ubuntu). I first noticed I couldn't print to my LPT printer in 7 (it works in XP and ubuntu). Then I plugged in some other stuff. Everything works in the...
Hardware & Devices


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd

All times are GMT -5. The time now is 15:02.
Twitter Facebook