Access to device names LPT1, LPT2, LPT3, LPT4 in DosBox

Here you can discuss the development of patches.

Access to device names LPT1, LPT2, LPT3, LPT4 in DosBox

Postby qv90 » 2006-8-30 @ 12:21

If you ever used DosBox 0.65 and tried a program like "Framework IV" you'll have noticed, there is no printer support available.

For all DOS programs which want to access printer by device name, I've written this patch. All output to LPT1-4 is captured into files named "devLPTx.prn" (x-device 1-4) in the DosBox directory. If print is terminated (DOS program closes the device) a system command (as defined in dosbox.conf) is executed to deliver output to host printing system. All output from the issued command is echoed to the dosbox console. At termination of DosBox, the temporary "device" files were automatically deleted.

To get it to work, please

1. Apply patch by switching to DosBox source directory and enter "patch -p0 < PrtDev.diff".
2. Compile the new version ("./configure && make")
3. Call dosbox.exe
4. Enter "config -writeconf dosbox.conf"
5. Load dosbox.conf into editor
6. Search for "[printer]" section
7. Print output is discarded by default:
...
LPT1=disable
...
8. Change "disable" to a command which sends output file to your host printing system. If you're working on a Windows system, you may use "copy devLPT1.prn LPT1 >Nul".

Remarks:

- The ">Nul" parameter is used to minimize output to DosBox console (error message will still be shown on DosBox console window). Check out as required. For debugging purposes you may discard that parameter.
- You may use more complex commands. If the DOS program generated PostScript output and you've only a PCL printer, then you can convert the print output by sending print file to GhostScript (which is able to convert output from PostScript to PCL) and then send it to your printer.
- You can easily redirect output from one printer device to a diffrent host system printer device by modifying the output command (e.g. "copy devLPT2.prn LPT1 >Nul").

ToDo:
- I noticed that some DOS programs open and closes the device after only a couple of bytes. The output command is then executed each time the device is closed, resulting in a heavy slow down during printing. I'm currently working on a solution which does some sort of "spooling". There will be an additional parameter "timeout=" where you can specify a delay before the collected output is delivered to host printer. Stay tuned :-)
- Printer interupt were not captured.
Last edited by qv90 on 2012-11-11 @ 09:15, edited 3 times in total.
User avatar
qv90
Newbie
 
Posts: 65
Joined: 2006-7-01 @ 10:22

Re: Access to device names LPT1, LPT2, LPT3, LPT4 in DosBox 0.65

Postby qv90 » 2006-8-31 @ 12:11

Hi,
version 0.2 is out :-)

Now print output is "spooled". You have to specify in dosbox.conf a new parameter "printer_timeout". Either after printer_timeout ticks or if you terminates dosbox.exe, output is delivered to host printing system. (Alternatively you may use "config -writeconf" to create a new fresh configuration file with all default values included).

Why?
I recognized a DOS program which opens LPT1, writes only a couple of bytes, closes LPT1, opens LPT1, write some bytes (and so forth)... I found no way to figger out when DOS program really terminates printing. So I designed a solution which caches print output for a "while" before executing print output command.

Have fun!
Last edited by qv90 on 2012-11-11 @ 09:16, edited 1 time in total.
User avatar
qv90
Newbie
 
Posts: 65
Joined: 2006-7-01 @ 10:22

Re: Access to device names LPT1, LPT2, LPT3, LPT4 in DosBox 0.65

Postby wd » 2006-8-31 @ 12:22

I was forwarding lpt data when a program was closed (int21/4c)
which worked nicely as well.
wd
DOSBox Author
 
Posts: 10818
Joined: 2003-12-03 @ 21:23

Re: Access to device names LPT1, LPT2, LPT3, LPT4 in DosBox 0.65

Postby qv90 » 2006-9-15 @ 09:58

Hi,
due to some customer claims I sligthly modified the code. In the new version it is garanteed the "device file" DevLPTx.prn is located in DoxBox.exe directory.

Additionally error message for unsuccessfull print-command is expanded.
Last edited by qv90 on 2012-11-11 @ 09:16, edited 1 time in total.
User avatar
qv90
Newbie
 
Posts: 65
Joined: 2006-7-01 @ 10:22

Re: Access to device names LPT1, LPT2, LPT3, LPT4 in DosBox 0.65

Postby qv90 » 2006-9-22 @ 13:09

Hi,

I redesigned the patch. LPT1-4 were now implemented as "real" DOS devices.
User avatar
qv90
Newbie
 
Posts: 65
Joined: 2006-7-01 @ 10:22

Re: Access to device names LPT1, LPT2, LPT3, LPT4 in DosBox 0.65

Postby XoKoS » 2006-10-09 @ 12:46

Can´t compile 0.65 with de patch

Without compile ok
XoKoS
Newbie
 
Posts: 3
Joined: 2006-10-09 @ 12:33

Re: Access to device names LPT1, LPT2, LPT3, LPT4 in DosBox 0.65

Postby wd » 2006-10-10 @ 08:08

no error message?
wd
DOSBox Author
 
Posts: 10818
Joined: 2003-12-03 @ 21:23

Re: Access to device names LPT1, LPT2, LPT3, LPT4 in DosBox 0.65

Postby XoKoS » 2006-10-10 @ 19:00

MSYS

in /sdl-1.2.11 source dir
$ ./configure && make && make install
ok

in /sdl_net-1.2.6 source dir
$ ./configure && make && make install
ok

copyed the SDL_net.dll, SDL.dll and Patch#02.diff to the dosbox source dir

in dosbox-0.65 source dir
$ Patch -p0 <patch#02.diff
ok

$ ./configure
ok

$ make

get the following error

f:/dosbox/dosbox-0.65/src/hardware/printer.cpp:61: undefined reference to `_errno()'

make[3]: *** [dosbox.exe] Error 1
make[3]: Leaving directory `/f/dosbox/dosbox-0.65/src'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/f/dosbox/dosbox-0.65/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/f/dosbox/dosbox-0.65'
make: *** [all] Error 2
XoKoS
Newbie
 
Posts: 3
Joined: 2006-10-09 @ 12:33

Re: Access to device names LPT1, LPT2, LPT3, LPT4 in DosBox 0.65

Postby wd » 2006-10-10 @ 19:22

Well then kick those errno lines.
wd
DOSBox Author
 
Posts: 10818
Joined: 2003-12-03 @ 21:23

Re: Access to device names LPT1, LPT2, LPT3, LPT4 in DosBox 0.65

Postby kees3328n » 2007-2-28 @ 01:02

try

#include <errno.h>

kees
kees3328n
Newbie
 
Posts: 4
Joined: 2007-2-28 @ 00:59

Re: Access to device names LPT1, LPT2, LPT3, LPT4 in DosBox 0.65

Postby kees3328n » 2007-2-28 @ 01:04

Hi, I realy would have liked a version where the LPT# reads/writes to
/dev/parport#.
My guess is that dongles could work this way.

tnx

Kees
kees3328n
Newbie
 
Posts: 4
Joined: 2007-2-28 @ 00:59

Re: Access to device names LPT1, LPT2, LPT3, LPT4 in DosBox 0.65

Postby h-a-l-9000 » 2007-2-28 @ 14:22

Dongles usually require full access to the parallel port registers.
1+1=10
h-a-l-9000
DOSBox Author
 
Posts: 4512
Joined: 2005-2-23 @ 00:14

Re: Access to device names LPT1, LPT2, LPT3, LPT4 in DosBox 0.65

Postby `Moe` » 2007-2-28 @ 21:37

Can't this be integrated with the other printer patch? It's pretty difficult to have two separate printer patches in one build.
User avatar
`Moe`
Oldbie
 
Posts: 1169
Joined: 2004-4-29 @ 01:06
Location: Oldenburg, Germany

Re: Access to device names LPT1, LPT2, LPT3, LPT4 in DosBox 0.65

Postby kees3328n » 2007-3-02 @ 14:40

You are probabely right is some cases. But using Qemu with Freedos _and_ -parallel /dev/parport0 makes my dongle work with the application.

Dosbox: nice environment, easy access to host filesystem, no easy access for LPT dongles

Qemu+Freedos: nice environment, no so easy access to host filesystem, good access for LPT dongles.

If Dosbox had better LPT access or Qemu+Freedos had the mounting access of Dosbox.... I have a wish......

Kees
kees3328n
Newbie
 
Posts: 4
Joined: 2007-2-28 @ 00:59

Re: Access to device names LPT1, LPT2, LPT3, LPT4 in DosBox 0.65

Postby wd » 2007-3-02 @ 14:44

Yeah but the point is that dosbox is mainly a dos GAMES emulator,
so you can thank the guys around here that they're bothering with
lpt stuff at all.
wd
DOSBox Author
 
Posts: 10818
Joined: 2003-12-03 @ 21:23

Re: Access to device names LPT1, LPT2, LPT3, LPT4 in DosBox 0.65

Postby DosFreak » 2007-3-02 @ 14:59

I thought Qemu did have host file access? I think I remember seeing that somewhere. Never used it so I have no idea how it works.
User avatar
DosFreak
l33t++
 
Posts: 9719
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: Access to device names LPT1, LPT2, LPT3, LPT4 in DosBox 0.65

Postby kees3328n » 2007-3-02 @ 15:32

O yes, I definitively do. But better LPT access would make the area of application bigger and increase interest in the project.

regards

Kees
kees3328n
Newbie
 
Posts: 4
Joined: 2007-2-28 @ 00:59

Re: Access to device names LPT1, LPT2, LPT3, LPT4 in DosBox 0.65

Postby DosFreak » 2007-3-02 @ 15:36

Interest which at this point in time the DosBox devs do not want because the main DosBox goal is GAME compatibility.
User avatar
DosFreak
l33t++
 
Posts: 9719
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: Access to device names LPT1, LPT2, LPT3, LPT4 in DosBox 0.65

Postby h-a-l-9000 » 2007-3-02 @ 20:01

Linux seems to provide full parallel port access, thats why it probably works under Qemu.
1+1=10
h-a-l-9000
DOSBox Author
 
Posts: 4512
Joined: 2005-2-23 @ 00:14

Re: Access to device names LPT1, LPT2, LPT3, LPT4 in DosBox 0.65

Postby andre.afonso » 2007-4-20 @ 22:34

qv90 wrote:(...)

To get it to work, please

1. Apply patch by switching to DosBox source directory and enter "patch -p0 < PrtDev.diff".

(...)


i'm new using DOSBox and i'm getting a problem that i suppose it'll be resolved when i achieve a sucessfully instalation of this patch. but i can't do these first step. sorry about my ignorance on this subject.

where do i enter the command? in a command prompt?

Thanks
andre.afonso
Newbie
 
Posts: 3
Joined: 2007-4-20 @ 22:22
Location: Portugal

Next

Return to DOSBox Patches

Who is online

Users browsing this forum: No registered users and 4 guests