Page 1 of 2

Printer support?

Posted: Tue Mar 09, 2021 11:36 am
by Wertzui

Just out of curiosity. Will there be any kind of printer support built in? IEC port printers? Or something more modern and available? Or none?

Is the interface for it will be like accessing device number 4 or 5?


Printer support?

Posted: Tue Mar 09, 2021 12:35 pm
by Lorin Millsap
There will be support for printers on IEC as well as the user port.


Sent from my iPhone using Tapatalk

Printer support?

Posted: Wed Mar 10, 2021 1:37 am
by BruceMcF


14 hours ago, Wertzui said:




Just out of curiosity. Will there be any kind of printer support built in? IEC port printers? Or something more modern and available? Or none?



Is the interface for it will be like accessing device number 4 or 5?



Note that the "support" for IEC printers is just having a printer that runs as an IEC device ... IEC assumes a smart device on the other end, so once you support IEC (as the CX16 is supposed to do, according to the FAQ), you automatically support any IEC device. Any special driver software might have to be ported, but anything that is done by passing a control string on a command channel then reading and/or writing data on a data channel should just work.

The User Port will be compatible with a Centronics parallel port interface, but given the variety of parallel port printers, the drivers might have to be written in the community. Since the I/O routine vectors in RAM from the CBM 8bit systems are retained, that includes allowing a non-IEC device to have a numbered device driver installed.


Printer support?

Posted: Wed Mar 10, 2021 3:50 am
by kelli217


2 minutes ago, BruceMcF said:




Note that the "support" for IEC printers is just having a printer that runs as an IEC device ... IEC assumes a smart device on the other end, so once you support IEC, you automatically support any IEC device. The User Port will be compatible with a Centronics parallel port interface, but given the variety of parallel port printers, the drivers might have to be written in the community.



There are still printers on the market that have Epson FX and LQ emulation, as well as for IBM Proprinter.

And on GEOS, we had a printer driver for an HP LaserJet... so PCL is doable. Likewise, geoLaser and geoPubLaser imply that a BR-Script driver might be possible, though it might be a bit of a challenge.


Printer support?

Posted: Thu Mar 11, 2021 6:27 am
by BruceMcF


On 3/10/2021 at 11:50 AM, kelli217 said:




There are still printers on the market that have Epson FX and LQ emulation, as well as for IBM Proprinter.



And on GEOS, we had a printer driver for an HP LaserJet... so PCL is doable. Likewise, geoLaser and geoPubLaser imply that a BR-Script driver might be possible, though it might be a bit of a challenge.



Quite, when I said drivers might have to be written by the community, the comment already took for granted that they are write-able. Just pointing out that providing a Centronics compatible parallel port option via the User Port does not imply that the system will ship with some specific printer driver.


Printer support?

Posted: Thu Aug 05, 2021 5:27 pm
by Stefan

This thread is a bit old, but I've too been thinking about printer support.

Being a complete novice on the matter, I would also believe that it's doable to write a driver that outputs PCL (or Postscript). Outputting plain text without a lot of formatting and other options might not even be hard.

I don't know if it's true, but I would think that the biggest problem is how to transfer data to the non-vintage printers typically found in our homes today. The small HP LaserJet I have got at home only has an USB port as an example.

As far as I can tell, you would need an "active adapter" between the X16 and the printer to solve this.

Building this around a microcontroller such as the Arduino is probably very hard. You can find discussions online where people are trying to make Arduino based printer servers. I don't know if any of these attempts has been successful.

The next level is something like a Raspberry Pi. You would then probably end up with a complete Linux OS on the Pi. The X16 could send PCL or Postscript data to the Pi (for instance over I2C), and the Pi could send it to the printer. The actual printing could be done by calling the Linux lp command.

It might, however,  be disturbing for some that this "adapter" is a lot more capable than the X16. We would need to hide the Pi in a nice box not to keep thinking about that ?

Or are there any better ideas?


Printer support?

Posted: Thu Aug 05, 2021 6:30 pm
by Lorin Millsap
Reality has simple text printing shouldn’t be that hard, but yes you need some type of microcontroller based bridge adapter to translate between say an Epson protocol to a modern printer. Probably pretty steep got Arduino, but a Pi could absolutely do it provided you are running some widely supported Linux host do that it can use standard print drivers. The it could take the source machines text or simple graphics output, convert it to some type of image, probably PDF or ODF and then print that image to a modern USB or network printer.


Sent from my iPhone using Tapatalk

Printer support?

Posted: Sat Aug 07, 2021 5:35 am
by Stefan

The ESC/P (Epson) printer protocol is interesting for historical reasons, and supporting it might also make it easier to port programs made for other 8 bit platforms. It is, however, quite closely tied to functioning of dot matrix printers. Not everything makes sense on a laser printer, and you are also loosing some possibilities supported by a laser printer. I guess that's why Postscript was invented in the first place.

If I was to design a printer solution, I would like to keep the options open, supporting more than one printing protocol/format, and making it expandable.

To print an ESC/P byte stream, you would need to find or create a program that runs on the RPi and that converts the ESC/P input to Postscript or PDF. Making this from scratch is not an easy task. There are some open source alternatives available that I haven't yet tried. An example is found here: https://github.com/RWAP/PrinterToPDF/. If there is a ready-made conversion tool, implementing support for ESC/P would be very doable.

Postscript input is easy to print from the RPi. But making your X16 program output raw Postscript might be too big of a challenge for most programmers.

Having your X16 program outputting TeX or LaTeX is a lot easier than Postscript, and that has the benefit over ESC/P that you could use all features supported by a modern laser printer.

And there are of coarse a multitude of other markup languages that could be used as the basis of a printing system.


Printer support?

Posted: Sun Aug 08, 2021 7:11 am
by Stefan

I've never looked closely on PostScript before, and I find it demanding but quite interesting.

I think a PostScript based printing solution would work very well. As you may know, PostScript is just plain ASCII text which a X16 program could generate easily, send it to an RPi based printer adapter over I2C, which would send it to the actual printer.

My initial attempt to write a PostScript "program" that handles line and page wrapping by itself is enclosed.

I printed it with Ghostscript on MacOS to a PDF file with the following command:

gs -sDEVICE=pdfwrite -o test.pdf test.ps


test.ps

Printer support?

Posted: Mon Aug 09, 2021 9:16 am
by Stefan

I continued on making a PostScript template that could be used as the basis for a printing solution.

After some initial hurdles, I come to like PostScript a lot. 

The template is attached. Some remarks:


  • There are some variables you may set in the header


    • pagh = page height


    • pagw = page width


    • lmarg = left margin


    • bmarg = bottom margin


    • tmarg = top margin


    • rmarg = right margin


    • leading = line spacing


    • All of those in points, 1 inch = 72 points




  • Custom procedures defined in the header


    • normal = select default font, in the template that's Courier 10 pt


    • NP = Create new page


    • NL = New line


    • PR = Print text string (one or many lines)




  • The template supports printing with Latin1 encoding


I have written this template mostly with the needs of X16 Edit in mind. I could make X16 Edit output the PostScript header quite easily.

The header could be condensed by removing comments and white space. It should then be less than 1 kB.

You then need to continue to output the actual content to be printed.


  • Enclose each line of text to be printed in parenthesis. That's the way PostScript marks strings, not using quotes as most programming languages


  • Thereafter call PR to print and NL to insert a line break


  • After all text has been outputted you lastly need to call the showpage function


The actual printing part would not contain a lot of overhead. It would look something like this.

(Hello world) PR NL

(Another hello) PR

showpage

My next step is to fire up my old RPi and see what I can do with that. Can I configure it as a I2C slave and make it print a PostScript file transferred to it? I cannot say I have a lot of experience, but learning to do something new is half the fun.


template.ps