Read/Write Parallel Port In Assembly Language

joeyc100

New member
Member
VIP
Local time
6:02 AM
Messages
102
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 Computer

Computer type
Laptop
Computer Manufacturer/Model Number
asus x541sa
OS
windows 7 ultimatex64
Why do you need a dll for assembly language?
 

My Computer

Computer type
PC/Desktop
OS
win 8 32 bit
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 Computer

Computer type
Laptop
Computer Manufacturer/Model Number
asus x541sa
OS
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 Computer

Computer type
Laptop
Computer Manufacturer/Model Number
asus x541sa
OS
windows 7 ultimatex64
Hi all,
I would like to read and write the parallel port (0378h) in assembly language.

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 Computer

Computer type
PC/Desktop
OS
Windows 7 x64, Vista x64, 8.1 smartphone
CPU
Intel E8400 65W 64-bit
Motherboard
Gigabyte EP45-UD3LR
Memory
DDR2 2 x 2GB, 1GB x 2
Graphics Card(s)
XFX Radeon HD5750
Sound Card
AMD High Definition Audio; Realtek High Definition Audio
Monitor(s) Displays
iiyama prolite X2377HDS
Screen Resolution
1920 x 1080
Hard Drives
500GB 7200 rpm Seagate ST3500413AS 16MB, 500GB 5400 rpm Toshiba MQ02ABF050H 32MB, 200GB 7200 rpm Seagate ST3200820AS 8MB, 2TB 7200 rpm Western Digital WD20EZRX 64MB
PSU
Enermax Liberty Modular
Case
Antec P193 Midi Tower
Keyboard
Mionix ZIBAL 60
Mouse
Razer USB 2.0 Diamondback Mouse or Huion Graphics Tablet
Browser
Internet Explorer, Lunascape, Firefox, Opera, Avast Safezone
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 Computer

Computer type
Laptop
Computer Manufacturer/Model Number
asus x541sa
OS
windows 7 ultimatex64
So your concrete problem is how to call a C function exported from an external dll from assembly code?
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Toshiba Sattelite A665-S6092
OS
Windows 7 Ultimate x64
CPU
Intel Core i7-740QM
Memory
8 GB DDR3
Graphics Card(s)
NVIDIA GeForce 330GT
Screen Resolution
1366x768
Hard Drives
Samsung 840 SSD 500GB
1TB USB3 external HD
Cooling
Coolermaster Notepal U3 notebook cooling pad
Internet Speed
3mbps ASDL
Antivirus
ClamWin 0.98.7
Browser
Opera 12.17 x86 (main), Firefox 38 (sec), IE11 (last resort)
Yes. And, further, how to do it in assembly language.
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
asus x541sa
OS
windows 7 ultimatex64
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 Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Toshiba Sattelite A665-S6092
OS
Windows 7 Ultimate x64
CPU
Intel Core i7-740QM
Memory
8 GB DDR3
Graphics Card(s)
NVIDIA GeForce 330GT
Screen Resolution
1366x768
Hard Drives
Samsung 840 SSD 500GB
1TB USB3 external HD
Cooling
Coolermaster Notepal U3 notebook cooling pad
Internet Speed
3mbps ASDL
Antivirus
ClamWin 0.98.7
Browser
Opera 12.17 x86 (main), Firefox 38 (sec), IE11 (last resort)
Thank you. I will look into them.
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
asus x541sa
OS
windows 7 ultimatex64
Back
Top