Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Printer support? #114

Closed
sikthehedgehog opened this issue Sep 5, 2015 · 7 comments

Comments

@sikthehedgehog
Copy link

@sikthehedgehog sikthehedgehog commented Sep 5, 2015

Pretty much what it says, vanilla DOSBox never supported printers because games didn't need it but I could see this being useful, even if all it does is print to a PNG file instead of actually sending it to a printer. (also there's the occasional game that supports printing something)

Obvious use case: converting an ESC/P stream (by sending the file to PRN) so we can see what's in it.

@joncampbell123

This comment has been minimized.

Copy link
Owner

@joncampbell123 joncampbell123 commented Sep 5, 2015

I could make that easy. Would you be OK with the unix/CUPS model of running another program under DOSBox-X and connecting the virtual parallel port to the program's STDIN? Then the program can focus on reading printer codes from STDIN and render to wherever (including PNG) the output. It would be easier to write than integrating it into DOSBox-X itself.

@sikthehedgehog

This comment has been minimized.

Copy link
Author

@sikthehedgehog sikthehedgehog commented Sep 5, 2015

How easy would be that to use? Or do you mean it's just a separate program that would come together with DOSBox-X?

@ghost

This comment has been minimized.

@joncampbell123

This comment has been minimized.

Copy link
Owner

@joncampbell123 joncampbell123 commented Sep 6, 2015

I mean it would be a separate EXE compiled from the same source tree. DOSBox-X would run the program and direct parallel port output to the program. All the program has to do is read printer data from STDIN and render it to memory/screen/PNG/whatever. Not having to worry about DOSBox-X state would allow you to focus on developing the code to emulate a printer.

The program would basically look like:

#include <stdio.h>

int main() {
    char c;

    /* main loop. will not terminate until stdin is closed.
       stdin would normally be the read end of an anonymous pipe
       given by DOSBox-X, which would only signal EOF if DOSBox-X
       closes it i.e. at termination. You *could* also pipe to stdin a file
       if you want to test the code without DOSBox-X! */
    while (!ferror(stdin) && !feof(stdin)) {
        c = fgetc(stdin);
        /* do something with byte 'c', usually render it, emulate linefeed/pagefeed,
           parse escapes, divide pages, etc. */
    }

    /* this is where the code would display the rendered output
       to screen, save to PNG, etc. */

    /* done */
    return 0;
}

edit: I would also like to add that on Linux, this opens the possibility of writing printer emulation in other languages like Perl or Python, since it only matters that DOSBox-X runs a program piping to stdin i.e. the "shebang" at the top of the script.

@joncampbell123

This comment has been minimized.

Copy link
Owner

@joncampbell123 joncampbell123 commented Sep 6, 2015

I would also develop a STDIN/STDOUT protocol to send data and control lines, recv line status (including "out of paper" signal), DOSBox-X cycle/timing info, etc. for the program to better integrate with emulation, but that comes much later. That's less important than getting printer emulation off the ground.

@joncampbell123

This comment has been minimized.

Copy link
Owner

@joncampbell123 joncampbell123 commented Aug 31, 2018

Printer emulation code was ported into DOSBox-X within the last few months from the Daum SVN branch.

I still envision an interface though to allow DOSBox-X to spawn a subprocess that uses STDIN/STDOUT to send/receive parallel port status and emulate a printer.

@KormaX-of-DOS

This comment has been minimized.

Copy link

@KormaX-of-DOS KormaX-of-DOS commented Sep 19, 2019

Is it voluntary that the DOS versions lack the printer emulation settings?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.