[Patch] Epson LX-810 Dot-matrix printer WIP code

Post Reply
EluanCM
Posts: 112
Joined: Tue 27 Oct, 2015 2:07 pm
Location: Brazil
Contact:

[Patch] Epson LX-810 Dot-matrix printer WIP code

Post by EluanCM »

So, COVID has taken away some of the joy of working on hobby projects at home. Until (hopefully) some of that comes back, I decided to rebase the code I already had to v17 and dump it here if someone wants to have fun. :-)

See here for more information: https://pcem-emulator.co.uk/phpBB3/view ... f=3&t=3386

This was only tested on Linux (the windows direct-to-printer code wasn't tested), has a new dependency (Freetype), is somewhat awkward to set-up, is very invasive to PCem (did some quick hacks to to parallel port interface and the UI menus), the menus have no feedback (because we don't have the printer's lights and beeps), and, finally: it works nicely!

Instructions extracted from the patch:
Most of this code was taken from an old (as of 2020) unfinished DOSBox patch.
I've fixed numerous issues with the interface, drawing and printer logic and
this should print most things correctly and with the right positioning.

Tested under DOS (Print Screen key, Edit.exe, Word Perfect 5.1), Win 3.1
(Write, Paintbrush) and Win 95 (Word 6, Paint). I've adapted it (ESC/P
commands resolution, mainly) to emulate the Epson LX-810, which is the
printer that I have.

Dependencies: Freetype (until I have a dump of the character ROM - or maybe
I keep it for an inaccurate "high-res" output?)
Output: Postscript, BMP, PNG, TIFF, JPG.
(Haven't tested the Windows printer forwarding yet.)

These are the print modes for the Epson LX-810:
-Bitmap printing emulates the pins but can optionally keep the old behaviour
from the DOSBox patch and output continuously. Pin emulation is naive for
now.
-Draft printing uses freely redistributable fonts that imitate the Epson FX
Printers, they look almost the same as the LX-810. Not all extended
characters are available and sometimes a combination of styles and effects
isn't available, so it will fallback to a similar one (in this case the dots
can potentially have slightly different dimensions.) High-speed draft
characters are not available. Should be OK for english ASCII printing.
-Provide your own monospaced Roman and Sans Serif truetype or opentype fonts.
Most fonts are pretty complete unicode-wise, so these will look nice.
There is also code to handle non-monospaced fonts automatically that should
work OK.

INSTRUCTIONS:
Currently, a "printer" directory on the pcem main path is used. On Linux this
would be "~/.pcem/printer" by default. There, the fonts roman.ttf,
roman_italics.ttf, sansserif.ttf and sansserif_italics.ttf should be present.
Also a subdirectory "fonts" with all the Epson FX-80 opentype fonts from
http://const-iterator.de/fxmatrix/ should exist. This same directory will be
used for all the output files.

There is also a menu for pressing some of the printer's control panel
buttons. On Linux, access with a right-click while the mouse is ungrabbed.

TODO/Notes:
-Dump/Recreate the character ROM. This should make it possible to use the
bitgraph functions to print the characters too.
-Better TTF font handling. Use STB TTF?
-Bind the printer panel buttons to key combinations in addition to the menu?
-Menu commands should only work when the printer is not accepting data. (Use
DC1 / DC3 for this? Or the select bit in the parallel port?)
-Make the Windows print redirection better (currently is a hack that shows
the printing dialog too soon).
-Dump to PDF with GhostScript.
-Printer redirection on linux (GhostScript, CUPS)
-Update the Mingw Makefiles with FreeType.
-Search for TODO in this file. :-)
Attachments
lx810_diff_rebased_to_v17.patch
(167.12 KiB) Downloaded 1918 times
tk421
Posts: 156
Joined: Sat 18 Jun, 2016 6:57 am

Re: [Patch] Epson LX-810 Dot-matrix printer WIP code

Post by tk421 »

This is an interesting project. It has great promise. I look forward to seeing the end result.
Davi Pietro
Posts: 1
Joined: Thu 18 Mar, 2021 9:03 pm

Re: [Patch] Epson LX-810 Dot-matrix printer WIP code

Post by Davi Pietro »

How can I install this patch?
User avatar
MichaelJManley
Posts: 54
Joined: Fri 17 Dec, 2021 9:42 pm

Re: [Patch] Epson LX-810 Dot-matrix printer WIP code

Post by MichaelJManley »

I so far rebased this into the dev branch. It is not built by default, you do need -DUSE_EXPERIMENTAL=ON -DUSE_EXPERIMENTAL_PRINTER=ON on your build parameters to see it. Least till further testing is done with the rebase.
denman00000
Posts: 7
Joined: Sun 05 Jun, 2022 2:42 am

Re: [Patch] Epson LX-810 Dot-matrix printer WIP code

Post by denman00000 »

Hi

This looks awesome .. I would be happy to help further testing with different printers and windows editions etc.

Please could someone assist me with how to get this working and running in Windows 10. I am very new to PCem and would love to experiment more.

I am still battling with compiling and am excitedly following these steps :-)
viewtopic.php?p=15836#p15836

The last post on in THIS thread mentions
I so far rebased this into the dev branch. It is not built by default, you do need -DUSE_EXPERIMENTAL=ON -DUSE_EXPERIMENTAL_PRINTER=ON on your build parameters to see it. Least till further testing is done with the rebase.
What does this mean and how do I progress in order to get the patch mentioned here working or ready or compiled etc in order to test it for dos and windows apps ?
What is REBASE ?
I am using Windows 10 pro 64 21h1

I would really appreciate any detailed help from some kind souls.

Thank you in advance

Denman
User avatar
Arjen42
Posts: 137
Joined: Fri 11 Jun, 2021 3:15 pm

Re: [Patch] Epson LX-810 Dot-matrix printer WIP code

Post by Arjen42 »

To rebase is a Git term for a specific way of merging changes from one branch to another.

In the context of the previous post, it means that Michael has added the changes to the dev branch, so if you want to try this out you will have to build PCem from the dev branch. If the changes are good enough, they might be merged from the dev branch to the master or main branch. The next official public release will be build from the master or main branch.
denman00000
Posts: 7
Joined: Sun 05 Jun, 2022 2:42 am

Re: [Patch] Epson LX-810 Dot-matrix printer WIP code

Post by denman00000 »

@ Arjen

Thanks so much for the rebase explanation and for your reply.

How do I get/find the dev branch and build that patch file in(or is it already in the dev branch you mention ? (Sorry totally new at this :-( )

Denman
denman00000
Posts: 7
Joined: Sun 05 Jun, 2022 2:42 am

Re: [Patch] Epson LX-810 Dot-matrix printer WIP code

Post by denman00000 »

Hi all

I seem to be getting somewhere at last ..at least it looks like some sort of building is going on. here's my command and output :

Code: Select all

 MINGW64 /pcem
$ cmake -G Ninja -S /pcem -DMSYS=TRUE -DUSE_NETWORKING=ON -DUSE_EXPERIMENTAL=ON -DUSE_EXPERIMENTAL_PRINTER=ON -DUSE_EXPERIMENTAL_PGC=ON -DCMAKE_BUILD_TYPE=Release ..
-- The C compiler identification is GNU 12.1.0
-- The CXX compiler identification is GNU 12.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/msys64/mingw64/bin/cc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/msys64/mingw64/bin/c++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
PCem vNext - Build Type: Release
***************************************************************
OS Building For: Windows
System Processor: x86_64
***************************************************************
Plugin Support: OFF
Networking Support: ON
       PCAP Networking Support: ON
Experimental Modules: ON
       PGC Support: ON
       Printer Support: ON
***************************************************************
PCem Program Directories:
       PCem Prefix Directory: C:/Program Files (x86)/PCem
       PCem Share Directory: bin
       PCem Binary Directory: bin
       PCem Library Directory: sdk/lib
       PCem Plugin Directory: bin/plugins
       PCem Include File Directory: sdk/include
***************************************************************
-- Found OpenAL: C:/msys64/mingw64/lib/libopenal.dll.a
-- Found wxWidgets: -LC:/msys64/mingw64/lib;;;-pipe;-Wl,--subsystem,windows;-mwindows;-lwx_mswu_core-3.0;-lwx_baseu-3.0;-lwx_mswu_xrc-3.0 (found version "3.0.5")
-- Found PCAP: C:/msys64/mingw64/lib/libpcap.dll.a
-- Performing Test PCAP_LINKS_SOLO
-- Performing Test PCAP_LINKS_SOLO - Success
-- Looking for pcap_get_pfring_id
-- Looking for pcap_get_pfring_id - not found
-- Looking for pcap_set_immediate_mode
-- Looking for pcap_set_immediate_mode - found
-- Looking for pcap_set_tstamp_precision
-- Looking for pcap_set_tstamp_precision - found
-- Found OpenGL: opengl32
CMake Error at C:/msys64/mingw64/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Freetype (missing: FREETYPE_LIBRARY FREETYPE_INCLUDE_DIRS)
Call Stack (most recent call first):
  C:/msys64/mingw64/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  C:/msys64/mingw64/share/cmake/Modules/FindFreetype.cmake:162 (find_package_handle_standard_args)
  experimental/printer_epsonlx810/CMakeLists.txt:1 (find_package)


-- Configuring incomplete, errors occurred!
See also "C:/msys64/CMakeFiles/CMakeOutput.log".
See also "C:/msys64/CMakeFiles/CMakeError.log".

The question :
How do I proceed to fix the errors regarding FREETYPE ? and the other errors mentioned ?
(I'm running win10pro 64bit and msys64 > mingw64 )

My end goal is to be able to get to test printing.

Please someone help me.

Denman
User avatar
Arjen42
Posts: 137
Joined: Fri 11 Jun, 2021 3:15 pm

Re: [Patch] Epson LX-810 Dot-matrix printer WIP code

Post by Arjen42 »

denman00000 wrote: Sun 05 Jun, 2022 11:17 am @ Arjen

Thanks so much for the rebase explanation and for your reply.

How do I get/find the dev branch and build that patch file in(or is it already in the dev branch you mention ? (Sorry totally new at this :-( )

Denman
Ok, assuming you got all the dev tools (MYSYS on Windows) including Git installed:

1. Open MSYS. There are different shortcuts for different sets of developments environment. Refer to the other instructions for the correct environment.

2. MSYS is a Unix like operating environment running inside Windows. So when opening MSYS you'll get a Unix like shell and your current directory would be your MSYS home directory. Here create a subdirectory called and change to that directory:

Code: Select all

$ mkdir source
$ cd source
3. Clone the PCem source repository from Github. This will create a subdirectory called pcem.

Code: Select all

$ git clone https://github.com/sarah-walker-pcem/pcem.git
Cloning into 'pcem'...
remote: Enumerating objects: 16609, done.
remote: Counting objects: 100% (3118/3118), done.
remote: Compressing objects: 100% (273/273), done.
remote: Total 16609 (delta 2913), reused 2856 (delta 2845), pack-reused 13491
Receiving objects: 100% (16609/16609), 7.23 MiB | 17.96 MiB/s, done.
Resolving deltas: 100% (12934/12934), done.
4. Enter this directory and see what's the current branch:

Code: Select all

$ cd pcem
$ git branch
* dev
5. In this example the current branch is dev and this is only local branch. You can also view all the remote branches:

Code: Select all

$ git branch -a
* dev
  remotes/origin/HEAD -> origin/dev
  remotes/origin/dev
  remotes/origin/main
  remotes/origin/master
  remotes/origin/new_config
  remotes/origin/sarah-walker/matrox-millennium
  remotes/origin/sarah-walker/mingw-fixes
  remotes/origin/sarah-walker/misc-fixes
  remotes/origin/sarah-walker/scamp-ems
6. If you switch to a branch that is only present remotely a local branch will be created:

Code: Select all

$ git checkout main
Switched to a new branch 'main'
branch 'main' set up to track 'origin/main'.
$ git branch
  dev
* main
7. When others make changes to a remote branch, you can pull those changes from Github:

Code: Select all

$ git pull
Already up to date.
In this example no changes have been made yet.

To build PCem please refer to the instructions others have made.
denman00000
Posts: 7
Joined: Sun 05 Jun, 2022 2:42 am

Re: [Patch] Epson LX-810 Dot-matrix printer WIP code

Post by denman00000 »

Hi Arjen

Thanks a million for the reply and precise steps .. awesome!

I have followed the steps but now stuck at finding a proper build procedure to follow that works .. Could you perhaps point me in the right direction so I can end up with the printer selection option as mentioned earlier in this thread ?
As in the picture in this link:
viewtopic.php?p=13227&sid=43989994db158 ... f67#p13227

I can't seem to figure out which font to get ,and where to place them (directory etc when building )

Thanking you in advance and hope you can help me.

Kind regards

Den
User avatar
Arjen42
Posts: 137
Joined: Fri 11 Jun, 2021 3:15 pm

Re: [Patch] Epson LX-810 Dot-matrix printer WIP code

Post by Arjen42 »

Nice that I could help you with that.

But sorry, I have no idea how to get printing to work.
denman00000
Posts: 7
Joined: Sun 05 Jun, 2022 2:42 am

Re: [Patch] Epson LX-810 Dot-matrix printer WIP code

Post by denman00000 »

@ Arjen

Thanks a million for the reply.

That's all good re printing , will poke around in the dark.. stumbling is good practice.
Could you possibly suggest an actual working build procedure somewhere in these forums or elsewhere ? (As you know I'm using windows 10. (happy to try in another type of OS or vm too , just want to get to build it so I can start trying the printing too)

stay safe

Kind regards
Den
Post Reply