Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

GSPort and hardware serial ports

419 views
Skip to first unread message

Hugh Hood

unread,
Mar 31, 2020, 1:34:59 PM3/31/20
to
David (and anyone else who works with GSPort under Windows 10),

I could use some help.

The current upheaval in my work due to COVID-19 has caused me to
re-double my efforts to duplicate at home, on a functional level, my
main work computer, which is an Apple IIGS printing through a serial
port to a workhorse multi-binned HP LaserJet printer.

I hauled a spare LaserJet home and am happy to report that it works
wonderfully well with Windows 10 and Mac OS X through the ethernet
network and router.

But since I no longer keep a IIGS at home, I'm wanting to speak to the
LaserJet's built-in serial port from GSPort.

I've installed a Keyspan USA-19 (TI chip) USB-Serial adapter that Sean
Fahey had given me a few years ago, and it presents itself as a good
old-fashioned serial port named 'COM4'.

OK. Now for the question.

The GSPort docs state: "Emulated serial ports are individually
configurable as either IP or passthrough to real hardware ports".

For the life of me, I can't get GSPort to speak to COM4, and really
don't see anything in the F4 configuration screen that would allow me to
specify COM4 as the 'passthrough' real hardware port. The Keyspan allows
the COM4 port to be changed to other ports, but I haven't tried that yet.

Am I missing something obvious? I've read and re-read the docs, Googled
for an answer, engaged in trial-and-error, and am coming up dry.

Thanks.




Hugh Hood

PS - FWIW, yes, I do also use 'modern' computers at work, so I am not a
(total) crackpot. But the software systems I custom-developed for my
AppleWorks workflow years ago are quite slick and work exceptionally
well and quickly and are easily modified. So, I have no desire to adapt
them to a modern platform.

David Schmidt

unread,
Mar 31, 2020, 3:49:00 PM3/31/20
to
On 3/31/20 1:34 PM, Hugh Hood wrote:
> For the life of me, I can't get GSPort to speak to COM4, and really
> don't see anything in the F4 configuration screen that would allow me to
> specify COM4 as the 'passthrough' real hardware port. The Keyspan allows
> the COM4 port to be changed to other ports, but I haven't tried that yet.

You're going to need to change the COM port to be either 1 or 2; it's
kind of brain-dead in its port mapping in Windows:

sprintf(&str_buf[0], "COM%d", port+1);

Which means :
port0/Slot 1 => COM1
port1/Slot 2 => COM2

Hugh Hood

unread,
Mar 31, 2020, 9:27:06 PM3/31/20
to
David,

Thanks a MEG for the rapid answer. I appreciate it!



Hugh Hood

Hugh Hood

unread,
Apr 1, 2020, 10:50:15 PM4/1/20
to
David,

OK. As you suggested I changed the configuration on the Keyspan
USB-Serial adapter so that GSPort Slot 1 talks to PC COM1, and GSPort is
indeed sending data to the printer, which the printer in fact prints.

That's a good thing.

Here's where things go awry, and I could again use your help.

For some reason, characters (non-consecutive) are being resent, usually
on the same line.

For example:

"1. Add files to the Desktop" becomes

"1. Add files to the Desktop o the Desktop"


When I examine the serial logger for that transmission it shows:

00101 114 (304.728.195):Stat:CDSr x
00102 115 (304.728.195):TX:
00103 116 (304.728.195):Stat:CDSr x
00104 117 (304.728.195):GetStatus 2a 400
00105 118 (304.728.195):Stat:CDSr x
00106 119 (304.728.195):TX: 1. Add files
00107 120 (304.750.363):Stat:CDSr x
00108 121 (304.750.363):TX: t
00109 122 (304.766.043):Stat:CDSr x
00110 123 (304.766.043):GetStatus 2a 0
00111 124 (304.766.043):TX:o the Desktop
00112 125 (304.766.043):GetStatus 2a 400
00113 126 (304.766.043):Stat:CDSr x
00114 127 (304.766.043):Stat:CDSr x
00115 128 (304.797.287):TX:o the Desktop
00116 129 (304.797.287):Stat:CDSr x
00117 130 (304.797.287):Stat:CDSr x
00118 131 (304.797.287):TX:
00119 132 (304.812.914):Stat:CDSr x
00120 133 (304.812.914):GetStatus 2a 0

... and so on.

You'll notice that line 00115 is a re-transmission of line 00111.


This is at 19,200 bps 8/N/1 with hardware handshaking. I also tried it
all at 9,600 bps and also at the 'stock' 2.8 MHz machine speed setting,
but I get more of the same, although the repeated text varies each time.

I've got a HW handshaking cable from the adapter to the printer, and I
can paste quite a bit of text content into a RealTerm terminal window
(at the same settings) transmitting to the printer and not get a single
error, so I think the adapter, printer and cable are all good.

Any ideas? I don't mind studying the code myself, but before I did, I
thought I'd ask you.

I am right that the serial port code of interest is in your file
'scc_windriver.c', or is there something else at play that I should be
looking at.

Thanks.



Hugh Hood


On 3/31/2020 2:48 PM, David Schmidt wrote:

David Schmidt

unread,
Apr 2, 2020, 12:31:32 PM4/2/20
to
Yep, that's where to start. I see strange behavior like only having
1-way communications when trying to use a real serial port with GSport;
there's definitely something screwy going on. Feel free to dig in -
last I looked (I needed to wake up the serial port with a PR#2) it
wasn't super complex.

- David

Nick Westgate

unread,
Apr 2, 2020, 10:18:02 PM4/2/20
to
On Friday, 3 April 2020 02:31:32 UTC+10, schmidtd wrote:
> Yep, that's where to start.

You could also try a different emulator. If you find something that works better you'd have some known good code to compare GSport to.

I'd suggest AppleWin.

Cheers,
Nick.

Hugh Hood

unread,
Apr 3, 2020, 12:38:54 AM4/3/20
to
On 4/2/2020 9:18 PM, Nick Westgate wrote:

>
> If you find something that works better you'd have some known good
> code to compare GSport to.
>
> I'd suggest AppleWin.
>

That's an excellent suggestion. Thanks.

Hugh Hood

unread,
Apr 5, 2020, 4:24:20 PM4/5/20
to
Whether or not they are helpful, I've made 2 more observations on my
COM1 serial port printing issues with GSPort under Windows 10:


1. The points of interruption/restart/resend on a printing job are
different each time, which suggests a hardware, rather than a software
issue. But, the hardware has been verified as solid when receiving jobs
from other applications through the COM1 serial port;

and,

2. When 'printing' is switched from 'COM1' to the simple socket Port
6501 in the GSPort configuration settings, and I open a Telnet window
into port 6501, the entire print job comes through into the window just
fine with no problems whatsoever. (e.g. telnet localhost 6501)


I thought I'd be a clever boy and just set up a pipe from the telnet
output to COM1, but I haven't yet found a way to do that easily from the
Windows command line. But, I'll confess Windows is pretty new to me. I'm
still learning. It seems that 'tee' isn't available at the command
prompt, but I'm not sure whether one can 'tee' to COM1 anyway.

I saw nothing obvious in scc_windriver.c, and AppleWin is C++, which is
not something I've got a good handle on, yet.

Onward through the fog. I'm sure this has a solution.




Hugh Hood

Nick Westgate

unread,
Apr 6, 2020, 8:07:18 AM4/6/20
to
On Monday, 6 April 2020 06:24:20 UTC+10, Hugh Hood wrote:
> I thought I'd be a clever boy and just set up a pipe from the telnet
> output to COM1, but I haven't yet found a way to do that easily from the
> Windows command line. But, I'll confess Windows is pretty new to me. I'm
> still learning. It seems that 'tee' isn't available at the command
> prompt, but I'm not sure whether one can 'tee' to COM1 anyway.

It's been a long time since I've played with this stuff ... like back when I added TCP serial to AppleWin for the original Apple II Game Server.

Anyway, a few people have raised AppleWin serial issues over the years, and they might make for a good read:
https://github.com/AppleWin/AppleWin/issues?q=is%3Aissue+serial

These are the serial TCP ones:
https://github.com/AppleWin/AppleWin/issues?q=is%3Aissue+serial+tcp

In particular, this one might be of interest:
https://github.com/AppleWin/AppleWin/issues/386

Gene made his own fork of tcpser, which is a util you might want to know about:
https://www.geneb.org/tcpser/

I notice there's another fork which includes Gene's changes:
https://github.com/FozzTexx/tcpser

Another set of utilities which people often use is:
http://com0com.sourceforge.net/

Sorry to be "helping" with a bunch of tangential links. ; - )

Cheers,
Nick.

Hugh Hood

unread,
Apr 6, 2020, 2:14:21 PM4/6/20
to
Nick,

Thanks very much for your response with the detailed links.

I've been plowing through them and educating myself. It's kind of
amazing what your brain can soak in when you actually have an interest
in the subject you're learning. I'm sure we both know the opposite
situation.




Hugh Hood

Christopher G. Mason

unread,
Apr 19, 2020, 12:26:11 AM4/19/20
to
On 4/5/2020 4:24 PM, Hugh Hood wrote:
> I thought I'd be a clever boy and just set up a pipe from the telnet
> output to COM1, but I haven't yet found a way to do that easily from the
> Windows command line. But, I'll confess Windows is pretty new to me. I'm
> still learning. It seems that 'tee' isn't available at the command
> prompt, but I'm not sure whether one can 'tee' to COM1 anyway.
>
Knowing your use case would help, but here are a few options for getting
output to a page that doesn't involve direct serial printing.

In the GSport config, setup The printer port to the emulated printer and
set that to "Text Only", it will pipe everything sent to the serial port
to a text file just like AppleWin can do.

Another option is to just use the built-in printer emulation. Text only
output renders at whatever output resolution you have set in the
options, so you always get nice sharp text. Graphics are limited by the
emulated printer and whatever driver you are using on the Apple II side
of things.

Yet another option if you primarily use GS/OS is to setup your HP
LaserJet driver with TreeHugger+Marinetti and print that way.

The AppleTalk network emulation will work with this plus the built-in
LaserWriter driver if your LaserJet has Postscript support and a
JetDirect card that does AppleTalk.

Hugh Hood

unread,
Apr 19, 2020, 1:36:52 AM4/19/20
to
Chris,

Thanks for offering up those comments and suggestions regarding direct
(and indirect) printing to 'real' printers from our emulators.

In fact, I have been toying with AppleWin the past couple of days and
have found that direct printing from the emulated Super Serial Card in
'Slot 2' does the job well (in most cases) when hooked to the RS-232
port on the LaserJet from the COM1 port on the PC.

I think the few instances where it hasn't gone well may have to due with
some hard-coded <CTRL-I>80N commands and since the emulated SSC is in
communications mode (rather than printer mode), it's expecting <CTRL-A>
as the command character and the 'N' suffix is not recognized in
communications mode.

Strangely, I tried the "-use-real-printer" switch in AppleWin to use
Slot 1 printing to my COM1 serial port, but printing failed every time
with a serial comm error. I haven't yet determined why it would behave
differently than Slot 2 printing, considering that it is just dumping
output using the default settings on the COM1 port.


Back to GSPort -- for the time being, instead of trying to forward the
Port 6501 socket to COM1, I thought I'd just forward or redirect it over
the network to the proper raw port on the LaserJet, since it is also my
network printer.

I've tried numerous things here, including redirection using the network
router and several Windows command line utilities, but so far I have
nothing to show but frustration, probably due to my extreme ignorance of
the subject.

Next, I'm going to see if the Windows version of netcat (ncat) can do it.

BTW - yes the LaserJet speaks PostScript and has AppleTalk, but 90% of
my printing is from 8-bit stuff, so that won't get me where I need to go
most of the time.

Twenty years ago I'd print from Bernie ][ the Rescue through its
emulated serial ports to my serial LaserJets. So, I imagine whatever I
need to do is within grasp with all this modern hardware and speed.

Or, at least I hope so. ;-)




Hugh Hood

Hugh Hood

unread,
Apr 22, 2020, 12:48:50 PM4/22/20
to
in article dYWdnWiEnp7zfgbD...@earthlink.com, Hugh Hood at
hugh...@earthlink.net wrote on 4/19/20 12:36 AM:


>
> Back to GSPort -- for the time being, instead of trying to forward the
> Port 6501 socket to COM1, I thought I'd just forward or redirect it over
> the network to the proper raw port on the LaserJet, since it is also my
> network printer.
>

OK, I've begun to have some success in finding a reliable method of
funneling printer output from GSPort's emulated Slot 1 serial port to a
network printer. It dispenses with using any COM ports, USB-serial adapters
or any serial communications at all.

Assuming that I can work out a few things, this should provide a great way
to obtain *directly* printed output from both 8-bit and 16-bit applications
to a modern network printer.

I'll define 'modern network printer' as one that has an ethernet connection,
allows 'raw' connections (e.g. Port 9100 on HP products), and speaks
PCL5/PCL6 and PostScript.

PCL5/PCL6 printers accept normal text input, just like our age-old dot
matrix printers, and also allow text and grqphic enhancements. For example,
both 8-bit AppleWorks and the GS/OS Harmony drivers have a PCL print driver.

PostScript printers obviously accept PostScript input, such as is generated
from GS/OS applications. The trick will be to direct that PostScript output
to come from Port 1 (direct-connect) rather than going out over AppleTalk.

{I seem to recall, from years ago, a way to connect a serial Apple
Laserwriter to a IIGS, but I just can't remember at the moment. Maybe one of
you can refresh my memory}.

Anyway, I've used 'ncat' to establish a client-to-client relay between
GSPort serving on Port/Socket 6501 and an HP LaserJet serving on Port 9100.
Using that, I've been able to print very, very well so far.


Here's the command I've been using at the Windows command line.


$ ncat 127.0.0.1 6501 -c "ncat - 192.168.1.170 9100"


The first part of that establishes the connection to GSPort socket/port
6501. The second part establishes the connection to the LaserJet port 9100,
which is also on the local network, but has an assigned static IP suffix of
170.


Here are the issues I must overcome.

1. GSPort does not start its Port 6501 'server' until *after* the serial
port is accessed. So, the ncat command cannot be issued until after that
happens. I think this can be worked around by having a 'startup' item in
GS/OS that will send a null character to the serial port, coupled with a
script that starts GSPort and then 'waits' a certain period of time before
issuing the ncat command.


2. The LaserJet port 9100 continuously 'listens' on Port 9100, but after a
period of no activity, it will timeout and forcibly close the connection. I
think I can overcome this by setting the timeout period to indefinite, but I
don't know whether this will affect print jobs coming from other sources
over the network. I'll just have to test it.


If anyone has any comments or suggestions, I'm all ears. This 'network'
stuff is all new for me. I've always been one of those one computer, one
printer, one user type of guys. What a dinosaur!





Hugh Hood

Antoine Vignau

unread,
Apr 22, 2020, 5:52:09 PM4/22/20
to
Hugh,
You are a less dinosaur than I am. I did not understand a word pf what you wrote!

Antoine

TomCh

unread,
Apr 24, 2020, 3:12:57 PM4/24/20
to
On Wednesday, 22 April 2020 17:48:50 UTC+1, Hugh Hood wrote:
> in article dYWdnWiEnp7zfgbDnZ2dnUU7-VfNnZ2d@---.com, Hugh Hood at
> hughhood@---.net wrote on 4/19/20 12:36 AM:
Hi Hugh,

Just wondering if this ncat IP-redirection will work with AppleWin too?

EG. Configure AppleWin to use Serial port = TCP.
Then use ncat to source from (localhost) 127.0.0.1 1977 (your and ncat dest as before).

Then from the virtual Apple II, print to SSC in slot-2.

NB. from the AppleWin help chm:

. For the TCP mode it doesn't matter what baud rate, stop-bit, byte size and parity are set to.
.. It always uses an unthrottled data-rate of 8-bit bytes (no stop-bit, no parity).

Tom

Hugh Hood

unread,
Apr 24, 2020, 9:30:45 PM4/24/20
to
Tom,

I just printed to my networked LaserJet from AppleWorks 5.1 in AppleWin
with a Slot 2 serial port printer (and AppleWin set to 'TCP') and using
the ncat command:

$ ncat 127.0.0.1. 1977 -c "ncat 192.168.1.170 9100"


It worked just fine -- even the control character sequences sent to the
printer.

Just as with GSPort, though, since AppleWin doesn't start 'serving' on
port 1977 until after a serial port access, it must first be triggered
before entering the ncat command.

I think this method has great potential. I just need to work out a
simple methodology so that the 'user' doesn't have to do anything
special or even think about it.

Just load a document and print it. Also, since this a a bi-directional
channel, I suppose other normally 'serial' comms may be possible.




Hugh Hood

Hugh Hood

unread,
Apr 24, 2020, 11:18:47 PM4/24/20
to
On 4/24/2020 8:30 PM, Hugh Hood wrote:
>
> $ ncat 127.0.0.1. 1977 -c "ncat 192.168.1.170 9100"
>

Typo. Make that:

$ ncat 127.0.0.1 1977 -c "ncat 192.168.1.170 9100"


Apparently that's termed a 'client-to-client relay'.




Hugh Hood

TomCh

unread,
Apr 26, 2020, 6:22:50 AM4/26/20
to
Hi Hugh,

I'd like to try to reproduce this using my home networked HP printer (although I don't know if it supports port 9100 / PCL)... but I don't know how to use AppleWorks.

I started AppleWin with "AppleWorks 5.1 Program.2mg" (from Asimov), but don't know what I'm doing :-/

Is this the right image to start with? If so, then perhaps you can provide some high-level steps?

I did find the "Add a Printer" part of the config. What printer did you pick?
How do you specific SSC as the interface card?

Then how do I start an application, eg. Word Processor?

re. the 2 issues you listed above - if emulators supported TCP/IP addr (+port 9100) directly as an option for SSC, then this would probably solve these 2 issues.

Thanks,
Tom

Hugh Hood

unread,
Apr 26, 2020, 1:05:58 PM4/26/20
to
On 4/26/2020 5:22 AM, TomCh wrote:

Tom,

Remember, you asked ...

>
> I'd like to try to reproduce this using my home networked HP printer
> (although I don't know if it supports port 9100 / PCL)... but I don't
> know how to use AppleWorks.
>


If you'll pass along the model # of your HP printer, I'll check the
specs for you. I suspect that it will work just fine.

In the meantime, the easiest way to check it is to 'Telnet' to it from
the Windows command line.

In Windows 10, the Telnet 'client' is one of those optional features
that you have to activate through settings/control panel.

Once you've got it installed, just type:

> Telnet 192.168.1.170 9100

Use the IP address of *your* network printer though. I suspect that the
192.168. part of that will not change, but the remainder of that will
probably be specific to your setup. The '9100' will not change.

If you're unsure of that IP address, you can find it either on your
router's admin page or in the Windows Control Panel 'Devices and
Printers' -- right click on your printer, select properties and then
port and you should see the IP address.

OK, after you've made your Telnet connection to the printer, just start
typing a sentence or two. You won't see anything, as it is not echoed
back to you.

Then, enter a <CTRL-L>, which will send a Form Feed to your printer. The
page should then print.

To leave Telnet, enter <CTRL-]>, then 'quit', and you will be back at
the Windows command prompt.


> I started AppleWin with "AppleWorks 5.1 Program.2mg" (from Asimov),
> but don't know what I'm doing :-/
>
> Is this the right image to start with? If so, then perhaps you can
> provide some high-level steps?

That image looks like a good starting point. Generally, I have one I
recommend from David Finnigan's macgui.com site, but that site is not
coming up for me at the moment, so just proceed with what you have.

>
> I did find the "Add a Printer" part of the config. What printer did
> you pick? How do you specific SSC as the interface card?
>

You'll want to select the 'DeskJet 500 portrait' driver. That uses a
very early set of PCL commands that will get you going. I generally
tweak all those settings later on, but I digress.

You'll want to select Slot 2 for your interface card. Since AppleWin
will dispense with any SSC-commands when you output to Socket 1977, I
wouldn't worry about anything else.

I might, however, delete the 'interface card' string entirely, as it
will probably want to send a <CTRL-I 80N> sequence, and you don't need that.

> Then how do I start an application, eg. Word Processor?
>

The easiest way to to use the Main Menu. Select '1' Add files to
desktop, find a text or AWP file in the directories, and load it.

Then <OA-P> to print it by following the prompts.

You'll find AppleWorks to be extraordinarily simple and intuitive to
use, I suspect. OTOH, it is capable or extraordinary things when used to
its fullest extent.

BTW, don't feel like to *have* to use AppleWorks to print. Even a BASIC
program that issues a PR#2 command will send printable output, because
the HP Port 9100 is raw, and PCL understands plain ole text. It doesn't
require any specific commands, unless you want to issue them.

> re. the 2 issues you listed above - if emulators supported TCP/IP
> addr (+port 9100) directly as an option for SSC, then this would
> probably solve these 2 issues.
>

That would be fine and dandy, Tom. If instead of starting a 'server' on
port 1977 (6501 for GSPort), an emulator would connect it's serial port
as a 'client' to XXX.XXX.X.XXX 9100, that would be grand.

That's a lot for one post. Let me know if I can help.





Hugh Hood

Nick Westgate

unread,
Apr 27, 2020, 2:03:26 AM4/27/20
to
BTW, GSport already had an outgoing ATD<hostname> command for the modem emulation.

I checked in a port option submitted by Andrew Roughan with this commit:
https://github.com/david-schmidt/gsport/commit/383f65812349379e46512f2119378c8b12e976c9

"/* Example ATDT192.168.1.21,4001 */"

Cheers,
Nick.

Hugh Hood

unread,
Apr 27, 2020, 11:11:23 AM4/27/20
to
Nick,

Thanks for the input.

Am I understanding you correctly that this modem emulation feature (and
code) of GSPort could be modified to dispense with the ATDT/modem stuff and
function instead as a client to a raw tcp Port 9100 print server?

Basically, we'd be looking for something that is 8-bit clean and doesn't
intercept/interpret any characters for special modem functions.

Thanks.





Hugh Hood


in article f7cac361-bd2b-43ac...@googlegroups.com, Nick
Westgate at nick.w...@gmail.com wrote on 4/27/20 1:03 AM:

TomCh

unread,
Apr 27, 2020, 3:50:07 PM4/27/20
to
> If you'll pass along the model # of your HP printer, I'll check the specs for you.

HP Envy 5640

It report's its IP as: 192.168.0.10

I can ping 192.168.0.10 OK.

I tried telnet (telnet 192.168.0.10 9100), but typing some text, then CTRL-L did nothing - ie. nothing prints.

Perhaps this (home) HP printer doesn't support port 9100? But would telnet connect if the port wasn't supported? No... I tried 'telnet 192.168.0.10 6502' and got:

C:\Users\Tom>telnet 192.168.0.10 6502
Connecting To 192.168.0.10...Could not open connection to the host, on port 6502
: Connect failed

And similarly "connect failed" for ports 666, 9101... implying that port 9100 is supported by this printer.

So I wonder by CTRL-L doesn't cause it to print?

Tom

Hugh Hood

unread,
Apr 27, 2020, 10:13:18 PM4/27/20
to
On 4/27/2020 2:50 PM, TomCh wrote:

>
> HP Envy 5640
>
>
> So I wonder by CTRL-L doesn't cause it to print?
>

OK, I checked. The HP Envy 5640, an all-in-one inkjet printer, uses a
language called 'PCL 3GUI', which is:

> A pixel-based printer language that primarily describes images by
> pixel. For the same objects like square, rectangles, etc, more data
> is required. Although bitmaps and other complicated picture type
> objects use object based language, they are still described in pixels
> because of their complexity.
Apparently HP supplies this on some of their inkjet models and to save
money, doesn't include the PCL5/PCL6 (nor PostScript) printer languages,
like they do on most of their laser models. There are no fonts imbedded
in the printer itself, nor are object-oriented commands accepted. These
printers also contain less memory, apparently.

The downside, of course, is that the rendering of the image has to be
done by the printer driver on the computer itself, as opposed to using
the processing power of the printer itself.

So, your printer doesn't speak 'text', only 'pixel'. I'm sorry that this
won't work for you.

Do you have access to another networked printer? It really doesn't have
to be from HP, as all the other printer manufacturers sell models that
support PCL5/PCL6, and oftentimes PostScript as well, particularly with
their laser models.

One good thing -- it sounds like it does accept input on Port 9100. But,
it doesn't know a form feed since it doesn't recognize character sets.

Let me know if you can find another printer to test. I'd like to see
this work for you, because you're the guy who can improve it for AppleWin.





Hugh Hood

Nick Westgate

unread,
Apr 27, 2020, 11:39:59 PM4/27/20
to
On Tuesday, 28 April 2020 01:11:23 UTC+10, Hugh Hood wrote:
> Am I understanding you correctly that this modem emulation feature (and
> code) of GSPort could be modified to dispense with the ATDT/modem stuff and
> function instead as a client to a raw tcp Port 9100 print server?
>
> Basically, we'd be looking for something that is 8-bit clean and doesn't
> intercept/interpret any characters for special modem functions.

Well, the thoughts in the back of my mind were that either you:
1. Add IP+port config to the emulator and implement that, or
2. Config IP+port inside the emulator by using ATD.

But yes, (2) might need some tweaks to add a raw mode.

Cheers,
Nick.

Hugh Hood

unread,
Apr 28, 2020, 11:25:50 AM4/28/20
to
in article 3768378e-c222-499d...@googlegroups.com, Nick
Westgate at nick.w...@gmail.com wrote on 4/27/20 10:39 PM:

>
> 2. Config IP+port inside the emulator by using ATD.
>

Nick,

I spent a few minutes last night with GSPort and its emulated modem feature
for the serial port.

Using the example and linked GSPort code you referenced, I set up a dial
entry in ProTERM 3.1 with the following:

ATDT192.168.1.170,9100

After 'dialing', I can force ProTERM to go 'online', but I haven't (yet)
been successful in establishing communication to the printer (port 9100).
Ostensibly, I am 'sending' characters, but the printer is not receiving
them.

Is that because GSPort is expecting some type of 'connect' message from the
other end to proceed, or is it perhaps something else I'm missing?

OTOH, I can open a Telnet connection to the printer from the Windows command
line without a problem.

Thanks again for any ideas, and especially for pointing out that the 'port'
option had been added to the modem emulation of GSPort, as the main page
docs I had didn't really mention that.





Hugh Hood

Hugh Hood

unread,
Apr 28, 2020, 10:03:58 PM4/28/20
to
I keep forgetting that GSPort has that nice console window to
troubleshoot when you need it.

Here's what I get when I attempt to 'dial' my print server
(192.168.1.170 Port 9100):

---------------------------------------------------------------
SCC port 1 is at unix port 6502
Got modem string :atdt192.168.1.170,9100:=61 74 64
Some AT command received, sockfd=1684
scc socket close being called from scc_socket_open_outgoing
In scc_socket_close, 1, 0, 35201010.012000
socket_close: sockfd=1684, closing
sockfd ret: 1688
Warning:Lookup host 192.168.1.170,9100 failed
Lookup host 192.168.1.170,9100 failed
In scc_socket_close, 1, 1, 35201010.012000
Sending modem code 3 = NO CARRIER
in accept_socket, call socket_open
scc socket close being called from scc_socket_maybe_open_incoming
In scc_socket_close, 1, 0, 35201018.000000
sockfd ret: 1828
SCC port 1 is at unix port 6502

-------------------------------------------------------------------

Lookup host failed. Any ideas why? Could it be the 'comma' should be
something else?




Hugh Hood

Nick Westgate

unread,
Apr 28, 2020, 11:40:17 PM4/28/20
to
On Wednesday, 29 April 2020 12:03:58 UTC+10, Hugh Hood wrote:
> Warning:Lookup host 192.168.1.170,9100 failed

That's not right. Are you building from source?
It seems you're running a version that doesn't have the port feature.

Line 229 strips off the ",port" from the hostname:
*comma_ptr = '\0'; /* null terminate the hostname string at the position of the comma */

Then...
hostentptr = gethostbyname((const char*)&scc_ptr->modem_cmd_str[0]);
And ...
fatal_printf("Lookup host %s failed\n", scc_ptr->modem_cmd_str[0]);

When you run the right version this should "just work".

Cheers,
Nick.

Hugh Hood

unread,
Apr 29, 2020, 12:32:52 AM4/29/20
to
Nick,

Thank you, sir. You've saved me from some aggravation.

I've been using v0.31 ("david-schmidt released this on Oct 5, 2017") and
assumed it was a 2017 release. Duh. It appears to be from 2014.

I'll confess I've never built anything in Windows before (everything
else I've done has been Mac OS X / Unix stuff).

Will I need any special tools / libraries / etc...?

Thanks.




Hugh Hood

TomCh

unread,
Apr 29, 2020, 12:48:33 PM4/29/20
to
Thanks for checking out my printer, and determining it doesn't support PCL5/PCL6.

WFH prevents me from trying other networked printers at the moment, so I'll try later...

btw, I got AppleWorks working following you instructions (pretty simple!).

Tom

Hugh Hood

unread,
Apr 30, 2020, 1:36:01 AM4/30/20
to
Thanks to some help I received from Nick Westgate, I'm happy to report
that by using the new 'port specifier' feature of the ATDT modem
emulation on the GSPort serial ports, I've been able directly to connect
(as a client) to my network print server on Port 9100.

Once connected, I'm able to send my Apple II print jobs directly to the
network printer as though I had sent them serially, but without the
hassle of any serial comm, nor the necessity that the printer have a
serial port at all. Very neat!

With a few tweaks (to strip the modem emulation), this could eliminate
the need to use 'ncat' to set up a client-to-client relay in order to do
raw Port 9100 printing from GSPort.

I'm still working through keeping the print server connection open
indefinitely while GSPort is running. After a certain period of time,
the Server forcibly disconnects (after it times out), and while GSPort
may 'think' it is connected, it is not.

As I proceed, I'll pass it along here for comment and for help. And,
assuming I can offer some positive additions to GSPort itself (and can
figure out the source well enough to be competent), I'll run it by.

Thanks again for all the input on this. Printing from Apple II emulators
has always seemed to me to be a compromise, in that it is indirect.

This method of printing directly I think should be a welcome addition,
particularly if printing from GS/OS applications can be added as well.





Hugh Hood

Nick Westgate

unread,
Apr 30, 2020, 3:32:47 AM4/30/20
to
On Thursday, 30 April 2020 15:36:01 UTC+10, Hugh Hood wrote:
> I'm still working through keeping the print server connection open
> indefinitely while GSPort is running. After a certain period of time,
> the Server forcibly disconnects (after it times out), and while GSPort
> may 'think' it is connected, it is not.

Glad to hear it worked!

The disconnection problem might be tricky. The problem with TCP is that you don't know if your connection is live until a send or recv fails. You could try "pinging" the printer with a few bytes, but what a safe test string is will vary from printer to printer.

Typically you can capture spool files generated by your driver and look for likely strings. For PCL and PostScript, especially on HP printers, a Universal Exit Language command might do.
http://hacking-printers.net/wiki/index.php/UEL

Cheers,
Nick.

Christopher G. Mason

unread,
May 2, 2020, 2:09:26 PM5/2/20
to
On 4/30/2020 1:35 AM, Hugh Hood wrote:
> Thanks again for all the input on this. Printing from Apple II emulators
> has always seemed to me to be a compromise, in that it is indirect.

That "compromise" is why I worked on getting ImageWriter emulation up
and running. The latest source fixed a lot of problems and formatting
issues (mostly margin spacing) with the emulated ImageWriter output. If
you want I can send some guidelines on printing with it. That and since
1993, I was always impressed with the sorcery that was the LC IIe card's
ImageWriter emulation.

> This method of printing directly I think should be a welcome addition,
> particularly if printing from GS/OS applications can be added as well.

GS/OS has a native method of printing to port 9100 network printers.
Marinetti, the TreeHugger port driver, plus a native GS/OS printer
driver for PCL3 LaserJets is all you need and I have tested and
confirmed it working with GSport. Its limited to 300x300dpi in black and
white though, one reason why I wanted to get ImageWriter II/LQ printing
working.

Ultimately I would like to rewrite the printer emulation using something
like Cairo (platform independent vector graphics). It would allow for
much nicer output than giant graphics files. I would also love to create
a "native" GS/OS printer driver to "print" to Cairo (basically convert
QuickDraw II calls to Cairo and then output to PDF, host printer, etc.),
but I lack the 65816 ASM chops or even a suitable example of a GS/OS
printer driver to do this. The only emulator that came close to doing
this was Bernie ][ The Rescue's InkMeister Pro feature.

Hugh Hood

unread,
May 2, 2020, 3:40:31 PM5/2/20
to
Chris,

Know that I am grateful for your continuing efforts (many years now, it
seems) to improve the printing 'experience' for Apple IIGS emulator users.

>
> GS/OS has a native method of printing to port 9100 network printers.
> Marinetti, the TreeHugger port driver, plus a native GS/OS printer
> driver for PCL3 LaserJets is all you need and I have tested and
> confirmed it working with GSport. Its limited to 300x300dpi in black and
> white though, one reason why I wanted to get ImageWriter II/LQ printing
> working.
>

About TreeHugger -- I really like how this works, but AFAIK, the printer
selections are either PCL or ImageWriter.

What I'd like to see (and I *know* I've seen this somewhere before in
the deep, dark, past) it to be able to use the LaserWriter driver in
DirectConnect (as opposed to AppleTalk), allowing it to speak PostScript
(not IWEM) to a PostScript-capable printer.

Maybe I'm mistaken, and drivers such as Harmonie are certainly very
good, but I think PostScript would provide the best possible output we
could hope to achieve from GS/OS applications. And, to do that over Port
9100 from an Apple II emulator to a network printer would be grand.

I'm going to keep looking in my old GEnie BB archives on using the
LaserWriter driver with a DirectConnect printer. I'm fuzzy on it, but I
think it was as simple as changing the name of the driver.

If you have any recollection of such a thing, please pass it on.

In the meantime, I'm still struggling with opening Port 9100 from
GSPort, using it, then having the Print Server close it due to lack of
activity, and then having to re-open it from GSPort.

I'm optimistic that something can be done. I can disable the idle
timeout on the Print Server's Port 9100 (so that it doen't close the
connection to GSPort), but then other applications and users can't use
the printer once GSPort connects, so that's a very poor 'solution'.

We'll see.





Hugh Hood

Hugh Hood

unread,
May 3, 2020, 11:52:55 PM5/3/20
to
While I certainly apologize for the numerous # of posts in this thread,
particularly if you have no interest in 'direct' printing from GSPort, I
made a little more progress this weekend with implementing a reliable,
works-every-time, method of printing from GSPort's serial port/simple
socket (6501) emulation mode to a networked PCL/Postscript printer over
TCP raw port 9100.

It still involves using the command line utility 'ncat' to set up a
client-to-client relay between GSPort and the printer, but I am now
running that command in a loop.

I had been having issues with:

(i) ncat was not able to 'connect' to GSPort until GSPort had started
and a serial port access occurred; and,

(ii) the Port 9100 print server was disconnecting the ncat client after
an idle timeout period (so that it could accept other network print jobs).

I'll share the .bat script for comment and advice here when I'm able to
do a little more testing and tweaking (conditions and timing
parameters), but even in its current state I've been able to print at
will from both GSPort and other Windows applications (e.g. Acrobat
Reader), even while both were running and sending print jobs.

I'm expecting a somewhat punishing work week, so I probably won't have
anything else until next weekend, if then, which may be a relief to
many! ;-)

Thanks for all the input I've received so far from my friends here.




Hugh Hood



On 4/22/2020 11:48 AM, Hugh Hood wrote:
>
> Anyway, I've used 'ncat' to establish a client-to-client relay between
> GSPort serving on Port/Socket 6501 and an HP LaserJet serving on Port 9100.
> Using that, I've been able to print very, very well so far.
>
>
> Here's the command I've been using at the Windows command line.
>
>
> $ ncat 127.0.0.1 6501 -c "ncat 192.168.1.170 9100"

Hugh Hood

unread,
May 10, 2020, 4:04:45 PM5/10/20
to
Quick update on printing directly from GSPort (both 8-bit and 16-bit
applications) to a networked printer (PCL 5 or combined PCL 5/PostScript
capable) over raw Port 9100 using the ncat utility running in a loop
from the Windows 10 command line --

1. Printing from 8-bit applications, such as AppleWorks 5.1 works
extremely well and quickly using AppleWorks' own PCL printer driver;
(as established previously);

and,

2. Printing from 16-bit GS/OS 'Desktop' applications, such as 'Teach',
works well using the Vitesse 'Harmony' printer driver for PCL. While I
am using the 'stock' driver provided in the last update provided by
Vitesse, I've also discovered that Margaret Taylor (old GEnie hand)
enhanced this driver by increasing the number of built in fonts it can
access. I will be incorporating her improvements and testing those soon.
(this is new).


The one thing (as IF there's only one - ha!) that still eludes me is
using Apple's own LaserWriter driver in this setup.

As everyone knows, this driver was written to rely (and insist) on
printing only over an AppleTalk network. I've spent several hours this
weekend with Ewen Wannop's 'BrkDown' disassember and 'ChewBagger' hex
editor and have learned quite a bit about the internals of the
LaserWriter driver. I've also had access to some of the source and of
course the tech notes.

As a result, I patched around a good bit of the 'must use AppleTalk'
code, and have actually had some meager results communicating with the
printer directly. But, I am not there yet, so I will tackle it again
next weekend.

I haven't spent any time tweaking the Windows .bat file yet for ncat.
That can wait. It is working right now and is usable, if a bit inelegant.

My main goal at the moment is to take my ham-handed approach to
modifying the LaserWriter driver and make it work in a 'Direct' setting.
As good as the 'Harmony' PCL driver is, it's tough to beat PostScript
output coming from the IIGS QuickDraw routines.




Hugh Hood

Hugh Hood

unread,
May 10, 2020, 4:07:14 PM5/10/20
to
On 5/10/2020 3:04 PM, Hugh Hood wrote:
> Vitesse 'Harmony' printer driver

Make that 'Harmonie'. Details, details ...

Jeff Blakeney

unread,
May 11, 2020, 9:04:44 AM5/11/20
to
On 2020-05-10 4:04 p.m., Hugh Hood wrote:
> As everyone knows, this driver was written to rely (and insist) on
> printing only over an AppleTalk network. I've spent several hours this
> weekend with Ewen Wannop's 'BrkDown' disassember and 'ChewBagger' hex
> editor and have learned quite a bit about the internals of the
> LaserWriter driver. I've also had access to some of the source and of
> course the tech notes.
>
> As a result, I patched around a good bit of the 'must use AppleTalk'
> code, and have actually had some meager results communicating with the
> printer directly. But, I am not there yet, so I will tackle it again
> next weekend.

I seem to recall that the LaserWriter printer driver had an option that
you could hold down Option or something and it would save the postscript
file to disk instead of sending it to the printer. You could then
manually send that file to the printer. If you wanted to create a
LaserWriter Direct printer driver, you could look for the code that does
that save to disk in the driver and change it to send the data to the
printer instead.

Hugh Hood

unread,
May 11, 2020, 11:27:51 AM5/11/20
to
Jeff,

You are correct. In the LaserWriter Print Dialog you press <OA-F> and then
click 'OK', and a PostScript file is generated (rather than sent to the
AppleTalk LaserWriter) in the System/Drivers folder with a name in the form
of "PostScript.GSxx", where xx is 00-99 numbered sequentially in the order
created. That file then has to be sent to a PostScript printer via another
method. The 'LaserBeam' program does that, BTW.

I'm very much trying to dispense with that inconvenient method, and instead
just want to send the job directly to the printer from the Print Dialog.
And, as you suggested, I've closely examined that code that generates the
PostScript file.

As an aside -- Eric Shepherd, in his Sweet16 Apple IIGS emulator, has
created a modified LaserWriter driver (SweetPrinter) that forgoes the <OA-F>
requirement and just creates the file when you click 'OK'. BTW, it does this
more reliably than the 'normal' method, because when running emulators at
high speeds (20MHz+ equivalents), the standard driver has trouble
interpreting the <OA-F> and 'OK' at the same time. Also, Eric has added a
clever way of sending that "PostScript.GSxx" file directly to the Mac so
that it is converted to a pdf automatically for printing. He's a clever guy.

But, I'm taking a different tack on all this. I want to print high-quality
output directly from my Apple IIGS emulator just as though I've got an
old-school IIGS hooked up to a local (albeit very, very modern networked)
printer. So far, using the 'ncat' utility running in a loop, I've done it
from 8-bit applications and from 16-bit GS/OS applications (using Harmonie).

If I can do it from the 16-bit stuff using PostScript, I'll be happy.

We shall see.





Hugh Hood


in article r9bihb$2ov$1...@dont-email.me, Jeff Blakeney at
CUTjeffre...@yahoo.ca wrote on 5/11/20 8:04 AM:

awanderin

unread,
May 11, 2020, 1:03:13 PM5/11/20
to

Hugh, you might want to take a look at the "Apple IIgs Printer Drivers"
article in this issue of develop magazine from 1990:

https://vintageapple.org/develop/pdf/develop-04_9010_October_1990.pdf

It goes into some detail about writing printer drivers.

--
Jerry awanderin at gmail dot com

Hugh Hood

unread,
May 11, 2020, 10:05:19 PM5/11/20
to
Jerry,

That's a fantastic article you referenced, and is very much on point.

I printed that and will digest it, as it has some information I hadn't
seen before.

I'm impressed that you could pull out of your 'memory bank' a reference
to a 30-year-old article that was very pertinent to the problem at hand.

Thanks.




Hugh Hood

Andrew Roughan

unread,
May 12, 2020, 9:36:17 AM5/12/20
to
Wow, great article. Thanks for pointing out this resource. I need to find
out what else has been written about in the Apple II domain.

awanderin

unread,
May 14, 2020, 1:59:13 AM5/14/20
to
Hugh Hood <hugh...@earthlink.net> writes:

> Jerry,
>
> That's a fantastic article you referenced, and is very much on point.
>
> I printed that and will digest it, as it has some information I hadn't
> seen before.
>
> I'm impressed that you could pull out of your 'memory bank' a
> reference to a 30-year-old article that was very pertinent to the
> problem at hand.
>
> Hugh Hood

Well, back in the 80s and 90s I tried to write a IIgs printer driver,
and I never finished it, but the interest remains somewhere in my head.
So when I saw this article a while ago, I saved a copy, and all I had to
do is find out where I had found it.

I hope you have more success than I did at getting to DONE!

Christopher G. Mason

unread,
May 16, 2020, 11:01:09 AM5/16/20
to
On 5/10/2020 4:04 PM, Hugh Hood wrote:

> The one thing (as IF there's only one - ha!) that still eludes me is
> using Apple's own LaserWriter driver in this setup.
>
> As everyone knows, this driver was written to rely (and insist) on
> printing only over an AppleTalk network. I've spent several hours this
> weekend with Ewen Wannop's 'BrkDown' disassember and 'ChewBagger' hex
> editor and have learned quite a bit about the internals of the
> LaserWriter driver. I've also had access to some of the source and of
> course the tech notes.
>
System 6.0.4 appears to come with the patched LaserWriter driver as it
appears in the DC Printer control panel.

Christopher G. Mason

unread,
May 16, 2020, 11:06:14 AM5/16/20
to
On 5/11/2020 10:05 PM, Hugh Hood wrote:
> Jerry,
>
> That's a fantastic article you referenced, and is very much on point.
>
> I printed that and will digest it, as it has some information I hadn't
> seen before.
>
> I'm impressed that you could pull out of your 'memory bank' a reference
> to a 30-year-old article that was very pertinent to the problem at hand.
>

The whole reason why the article exists is because Apple completely
failed to document HOW to write a GS/OS printer driver in any of their
developer documents (Apples developer documents have a long history of
suckage and still do to an extent). A stark contrast to Microsoft who
always seems to provide a full DDK with real working sample drivers for
every class of hardware the OS supports. In an ideal world, Apple should
have released a sample printer driver with one of the GS/OS internals books.

Speaking of Harmonie, has anyone reached out to Burger Becky about
releasing any of the source code?

Hugh Hood

unread,
May 16, 2020, 10:14:16 PM5/16/20
to
On 5/16/2020 10:01 AM, Christopher G. Mason wrote:

>
> System 6.0.4 appears to come with the patched LaserWriter driver as
> it appears in the DC Printer control panel.
>

Chris,

Thanks once more for the input.

Concerning the 6.0.4. LaserWriter Driver -- although the file date is
different, my hex comparison shows it is byte-for-byte identical to the
driver in 6.0.1.

And, the 6.0.1 LaserWriter driver is also able to be selected in the DC
Printer control panel. I suspect that is so that non-AppleTalk network
users can generate PostScript print files using the <OA-F> 'trick' in
the Print Dialog.

Currently, the LaserWriter driver is hard-coded to use calls that
require response from AppleTalk PAP stuff. If you try to use it as-is to
print to paper (rather than to file) with either the Printer or Modem
Port Driver in DC Control Panel, you'll "get no place fast", as Moe
Howard used to say.

I've been working on this challenge again this weekend and am optimistic
(perhaps naively) that I can cut, patch, and hack a way to overcome that.




Hugh Hood

Hugh Hood

unread,
Jun 8, 2020, 12:39:13 AM6/8/20
to
OK, we finally have a working *direct connect* LaserWriter (PostScript
Printer) printer driver for GS/OS.

I'm so glad to be freed from being required to use AppleTalk just to
print to a PostScript printer {directly} from GS/OS desktop applications.

I'll do some more testing this week, but about a dozen or so patches to
the standard LaserWriter driver {from 6.0.1} has allowed me to print
from several GS/OS desktop applications in GSPort (running on a Windows
10 machine with socket 6501 output from the printer port) to my
networked PostScript printer (in conjunction with an ncat
client-to-client relay).

I am still troubleshooting a PostScript error I'm receiving on my HP
LaserJet when the LaserWriter driver calls for some 'screening', but
that occurred only in the 'Teach' app in a particular document. I think
that error may be printer-specific, since I captured the same socket
6501 output to a file and it converted into a .pdf just fine.

This week I test this direct LaserWriter driver on a real IIGS that is
connected serially to another HP LaserJet (with PostScript) and see how
that goes. I've wanted this capability for years, so I hope it goes well.

These patches dispense with the back-and-forth communication between the
driver and the printer. Basically, the print job is dumped to the
printer and the printer just prints it.

In any case, I'll report back with the good, the bad, and the ugly.





Hugh Hood

Hugh Hood

unread,
Jun 9, 2020, 1:32:48 AM6/9/20
to
On 6/7/2020 11:39 PM, Hugh Hood wrote:
>
> This week I will test this direct LaserWriter driver on a real IIGS that is
> connected serially to another HP LaserJet (with PostScript) and see how
> that goes. I've wanted this capability for years, so I hope it goes well.
>

I tested the direct LaserWriter driver today on a real IIGS with an HP
LaserJet PostScript printer connected serially to the modem port.

It worked just fine printing from Ewen's 'ChewBagger' and 'Brkdown'
desktop applications. I'm very happy about that.

Teach documents with screening are, however, giving me PostScript errors
so this still needs some more work. I'm hoping to tweak the dictionary
in the LaserWriter driver to fix this, but who knows if I'll have success.

BTW, I also tested the direct LaserWriter driver with the same LaserJet
connected by a parallel card in Slot 2, but the test was inconclusive.

Apparently the Parallel Card driver searches for the proper slot of the
card on its own. Since I have (2) parallel cards in this GS, it got
confused, I suppose. This needs more work as well.



Hugh Hood

Hugh Hood

unread,
Jun 15, 2020, 12:37:15 AM6/15/20
to
The DirectConnect PostScript printer driver for GS/OS is now working
with all the applications I've tried it with -- Teach, ShadowWrite,
SuperConvert, BrkDown and ChewBagger.

I was having a problem with Teach documents that used
foreground/background text and traced that to a PostScript routine in
the LaserWriter driver called 'pat'.

Documents calling 'pat' would throw a PostScript error on an HP LaserJet
PostScript printer and thus would not print at all. They would generate
output, however, on PostScript distiller programs like GhostScript,
which apparently ignore offending commands if they can still generate a
page.

To overcome this, I re-coded the 'pat' command to make it much more
simple (at the expense of accuracy) and patched that into the
LaserWriter driver for the DirectConnect PostScript printer driver.

So, I'm now printing at will directly from GS/OS applications running in
the GSPort emulator to my networked laser printer. Finally!

I do need to ask for some testers for this driver before it gets released.

Basically, you would need either:

(1) A Windows machine running GSPort and having a networked
PostScript-capable printer attached to it;

or,

(2) A 'real' GS hooked up serially (not AppleTalk) to a
PostScript-capable laser printer.

Many of the network printers will have support for both PCL and
PostScript, and are intelligent enough to switch their emulation based
on the contents of the print job. For example, my 20-year-old LaserJet
4050N's do that.

If you have either of these setups and are able to test this new driver
for me, please let me know. I haven't printed from things like
AppleWorks GS or other GS/OS desktop applications, so I could use some
input there. I'm curious also about how complex graphic images will
print with this driver.

Finally, if you plan to use either the original LaserWriter (AppleTalk)
driver, or the DirectConnect PostScript driver, prepare to be patient.
Even on a fast emulator, I was surprised by how long it takes to prepare
a page for printing. It's certainly tolerable on an emulator, but on a
real GS I would get impatient, I'm afraid.

Thanks.




Hugh Hood

Hugh Hood

unread,
Jun 15, 2020, 2:34:52 PM6/15/20
to
in article Q_mdnU9Rv4trZ3vD...@earthlink.com, Hugh Hood at
hugh...@earthlink.net wrote on 6/14/20 11:37 PM:

> The DirectConnect PostScript printer driver for GS/OS is now working
> with all the applications I've tried it with -- Teach, ShadowWrite,
> SuperConvert, BrkDown and ChewBagger.
>

Ewen's 'Spectrum' telecom program is now also confirmed to print with the
DirectConnect PostScript printer driver.

I'll next try to download and print some color SuperRes pictures and see how
it goes. I won't get color output on a B/W laser [now THAT would be a
trick!], but I'll see if I messed up the shading by modifying the 'pat'
routine in the driver.





Hugh Hood

Antoine Vignau

unread,
Jun 19, 2020, 5:11:47 PM6/19/20
to
Hugh,
That's cool! What about changes and source code. Will you share them for another release of the system software?

Antoine

Hugh Hood

unread,
Jun 20, 2020, 1:19:52 AM6/20/20
to
Antoine,

Of course. I'm more than happy to share that.

Fair warning alert -- my methodology throughout this has been unorthodox
at best, using a combination of a printout of the lw.asm source for
understanding, and Ewen's BrkDown disassembler to disassemble the driver
file itself (giving me byte addresses), followed by using Ewen's
Chewbagger to make the actual patches to the driver file.

I didn't produce the DirectConnect PostScript driver by modifying the
source and re-assembling, as a true programmer would. I can, however,
highlight those portions in the source listing that I changed so that
someone who has all the APW/ORCA tools can build it the 'right way'.

As I mentioned in an another post, I've been unfamiliar with
multi-segment files and relocation dictionaries so to avoid problems my
patches were in those areas I considered 'safe', and consisted primarily
of modifying branch opcodes/operands, along with some literal text in
the internal PostScript routines.




Hugh Hood

Hugh Hood

unread,
Jun 20, 2020, 1:50:10 AM6/20/20
to
Thanks to Alex Lee's making it easy to download and use a single hard
drive disk image file containing multiple GS/OS Applications, I've been
able swiftly to test the DirectConnect PostScript printer driver with
some other GS/OS programs. All of the following produced nice-looking
PostScript printouts without incident:

1. GraphicWriter III
2. PaintWorks Gold
3. Draw Plus
4. Animasia 3D
5. Platinum Paint (SHR images)
6. AppleWorks GS
7. Quick Click Calc
8. Medley
9. BeagleWrite GS
10. List Plus
11. Calendar Crafter

Since I last posted, I've made another change or two to the driver. One
thing I added was that at the end of the job the driver will send a
<CTRL-D> to the printer to signify the EOF and prevent the printer from
waiting for more input before it times out the PostScript job.

Also, I previously mentioned modifying the 'pat' routine. I've since
noticed that Geoff Weiss modified the LaserWriter driver (for his 2018
KansasFest presentation) to prevent the 'pat' problem by substituting
some code that is also found in Adobe Illustrator PostScript files to
prevent problems with spot function generator across PostScript levels
(1 vs. 2 vs. 3) as well as across genuine PostScript vs. 'CloneScript',
as is found in the HP LaserJet series.

I've decided to implement Geoff's approach instead of mine. Then, I'll
need to re-test.

I had mentioned in a prior post that the GS/OS page generation speed was
certainly not instantaneous, and could take a few seconds per page even
on a fast emulator. Well, by substituting the 'PRINTER57.6' port driver
from Harmonie in place of the standard 'PRINTER' port driver, the page
generation time (using GSPort here) was cut in HALF!. That's a very good
thing, and I'm grateful that David Schmidt pointed that out in his
GSPort docs.

Finally, I contacted Daniel Krue asking whether he could test the
DirectConnect PostScript driver with his TreeHugger port driver and an
Uthernet card and PostScript printer. I'm still waiting to hear back
from him.

Anyway, more work to do ...




Hugh Hood

Hugh Hood

unread,
Jun 21, 2020, 12:56:01 PM6/21/20
to
On 6/20/2020 12:50 AM, Hugh Hood wrote:

>
> Also, I previously mentioned modifying the 'pat' routine. I've since
> noticed that Geoff Weiss modified the LaserWriter driver (for his 2018
> KansasFest presentation) to prevent the 'pat' problem by substituting
> some code that is also found in Adobe Illustrator PostScript files to
> prevent problems with spot function generator across PostScript levels
> (1 vs. 2 vs. 3) as well as across genuine PostScript vs. 'CloneScript',
> as is found in the HP LaserJet series.
>
> I've decided to implement Geoff's approach instead of mine. Then, I'll
> need to re-test.
>

OK. I've implemented Geoff's solution to the /spf and /pat routine issue
in the LaserWriter driver and retested. Everything works fine. Thanks Geoff!

>
> I had mentioned in a prior post that the GS/OS page generation speed
> was certainly not instantaneous, and could take a few seconds per
> page even on a fast emulator. Well, by substituting the 'PRINTER57.6'
> port driver from Harmonie in place of the standard 'PRINTER' port
> driver, the page generation time (using GSPort here) was cut in
> HALF! That's a very good thing, and I'm grateful that David Schmidt
> pointed that out in his GSPort docs. >

There's one small issue with using the Vitesse/Harmonie PRINTER57.6 port
driver in GSPort. It throws a Code RED error every time I use it, and
even though I detect no problems in the operation of the emulator after
that, it makes me a little nervous. And, I've confirmed it does the same
thing with the Harmonie LaserJetIII driver so it's a problem unrelated
to the DirectConnect PostScript driver I've been testing.

What to do -- keep using the PRINTER57.6 port driver and enjoy a 2X
printing speed boost, or stay 'safe' using the standard Apple PRINTER
port driver and print at half the rate? In any case, I've noticed the
PostScript printer driver generates pages much more swiftly than does
the Harmonie driver, with much less code, so that 1/2 speed penalty is
really not all that detrimental.

I'm hopeful that I'll hear from Daniel Krue about his TreeHugger TCP/IP
port driver soon. If not, I'll install Marinetti on GSPort and test
TreeHugger with the DirectConnect PostScript driver myself.





Hugh Hood

Hugh Hood

unread,
Jun 21, 2020, 1:29:34 PM6/21/20
to
On 6/21/2020 11:55 AM, Hugh Hood wrote:
> On 6/20/2020 12:50 AM, Hugh Hood wrote:
>
>
> There's one small issue with using the Vitesse/Harmonie PRINTER57.6 port
> driver in GSPort. It throws a Code RED error every time I use it, and
> even though I detect no problems in the operation of the emulator after
> that, it makes me a little nervous. And, I've confirmed it does the same
> thing with the Harmonie LaserJetIII driver so it's a problem unrelated
> to the DirectConnect PostScript driver I've been testing.
>

For completeness, I also tested Seven Hill's 'Independence' PRINTER57600
port driver with GSPort and it also throws the Code RED error. So, for
now, I'm staying with Apple's PRINTER port driver in GSPort.




Hugh Hood

Andrew Roughan

unread,
Jun 22, 2020, 8:55:40 AM6/22/20
to
Hugh Hood <hugh...@earthlink.net> wrote:
>> I had mentioned in a prior post that the GS/OS page generation speed
>> was certainly not instantaneous, and could take a few seconds per
>> page even on a fast emulator. Well, by substituting the 'PRINTER57.6'
>> port driver from Harmonie in place of the standard 'PRINTER' port
>> driver, the page generation time (using GSPort here) was cut in
>> HALF!

Hugh, have you considered the Express print spooler utility? Perhaps it
would give you control back faster (if that is useful).

Regards
Andrew



Christopher G. Mason

unread,
Jun 22, 2020, 9:12:07 AM6/22/20
to
On 6/21/2020 12:55 PM, Hugh Hood wrote:
> There's one small issue with using the Vitesse/Harmonie PRINTER57.6 port
> driver in GSPort. It throws a Code RED error every time I use it, and
> even though I detect no problems in the operation of the emulator after
> that, it makes me a little nervous. And, I've confirmed it does the same
> thing with the Harmonie LaserJetIII driver so it's a problem unrelated
> to the DirectConnect PostScript driver I've been testing.
>
> What to do -- keep using the PRINTER57.6 port driver and enjoy a 2X
> printing speed boost, or stay 'safe' using the standard Apple PRINTER
> port driver and print at half the rate? In any case, I've noticed the
> PostScript printer driver generates pages much more swiftly than does
> the Harmonie driver, with much less code, so that 1/2 speed penalty is
> really not all that detrimental.
>
No adverse effects from the port driver throwing a code RED. That status
is triggered whenever something writes to what the emulator considers an
"unsafe" or invalid register/memory address.

The reason for the driver differences is the Harmonie drivers rasterize
the QuickDraw II commands and convert the image to the printer's
language. The Postscript driver is an "indirect" driver and attempts to
offload as much processing to the printer itself by converting QuickDraw
II commands to Postscript drawing commands.

Hugh Hood

unread,
Jun 23, 2020, 2:31:12 AM6/23/20
to
On 6/22/2020 7:55 AM, Andrew Roughan wrote:
>
> Hugh, have you considered the Express print spooler utility? Perhaps it
> would give you control back faster (if that is useful).
>
> Regards
> Andrew
>

Yes, I believe Richard Bennett wrote that, though I hadn't thought of it
in years. I've found it on Alex Lee's site and will take a look.

FWIW, the wait isn't really very long with the PostScript driver. But,
it's hard not to want to optimize things, I suppose. Thanks.




Hugh Hood

Hugh Hood

unread,
Jun 30, 2020, 1:23:17 AM6/30/20
to
On 6/22/2020 7:55 AM, Andrew Roughan wrote:
>
> Hugh, have you considered the Express print spooler utility? Perhaps it
> would give you control back faster (if that is useful).
>

Andrew,

I did as you suggested and tried Bennett's (Seven Hills) Express 2.1
Print Spooler with the direct-connect LaserWriter Driver.

You're right. That's a very nice utility. At least in GSPort, control
was returned immediately, and the Teach document printed very shortly
thereafter.

I suppose that since the driver is sending a PostScript (as opposed to a
bit-mapped style driver) job the amount of data actually sent is much
less too, which accounts for a great deal of its speed.

Thanks again for that suggestion. I'll try Express with my 'real' IIGS +
LaserJet too.

OK. The direct-connect LaserWriter driver is about to be released so
that others can try it and comment back. I made another change in the
code so that it would NOT download bit-mapped GS fonts, but instead
specify fonts by their PostScript names so that even if those fonts are
not resident in the printer (or were not previously downloaded into the
printer), that the built-in Courier font would be substituted and
high-quality printing would be maintained. BTW, that's the method used
when doing the <OA-F> save PostScript to file trick in the normal
LaserWriter Driver.

I still haven't heard from Daniel Krue about testing this with
TreeHugger. I'll guess I'll set up uthernet emulation in GSPort, install
Marinetti, and try it myself.


A final note -- I apologize to everyone here for derailing my own topic,
which started as direct printing of any sort from the GSPort emulator,
either via the emulated serial port to a serial printer or (as I am
doing now) over the Port 6501/6502 'sockets' to a Port 9100 network printer.

I got sidetracked 'creating' (by patching, of course) a direct-connect
LaserWriter/PostScript driver and neglected the original topic.

So, I'll probably start a separate topic for the direct-connect
LaserWriter driver over in comp.sys.apple2 and leave this topic for
fine-tuning the batch-file scripts that set up the ncat client-to-client
relay that allows network printing from GSPort via Socket 6501/6501 to
Port 9100.

BTW, thanks for the encouragement I've received on these subjects, both
on the group, and also via private email. I appreciate it.




Hugh Hood

Hugh Hood

unread,
Jul 7, 2020, 2:08:34 AM7/7/20
to
On 6/9/2020 12:32 AM, Hugh Hood wrote:
>
> BTW, I also tested the direct connect LaserWriter [PostScript] driver
> with the same LaserJet connected by a parallel card in Slot 2, but
> the test was inconclusive.
>
> Apparently the Parallel Card driver searches for the proper slot of
> the card on its own. Since I have (2) parallel cards in this GS, it
> got confused, I suppose. This needs more work as well.
>

{Disclaimer - I realize this particular subtopic deals with real IIgs'
rather than emulated IIgs', but to keep the methodology all together
I'll post this in this thread}.

OK. I've confirmed that the direct connect PostScript driver works well
with parallel card connections on a real IIgs, which means that even if
you can't find a serial PostScript laser to hook up to your real IIgs,
you should be able to use it with a PostScript laser with a parallel
port, provided you have a parallel card in one of your slots.

I tested with one of the most plain parallel cards ever made - the Epson
APL rev A.

First, I used Apple's 'Parallel Card' port driver from System 6.0.1 and
had success.

Then, I used Vitesse's 'EpsonAPL' port driver from Harmonie and had
success as well.

The advantage of the Vitesse driver is that it is much, much faster. I
used Ewen's BrkDown to disassemble it and noticed that it is speaking to
the parallel card 'bare metal' by writing directly to the $C080+s0
register and checking the 'busy' byte at $CsC1.

The Apple driver uses the card's firmware and the GS/OS toolbox, which I
suppose is the 'right' way to do it, albeit with a speed penalty.

The other advantage of the Vitesse port driver is that it doesn't care
whether the card's slot is set to internal or to your card. If it
identifies a parallel card, it will use it. Apple's port driver requires
that the slot be set to your card.

One final note -- I had one 'Teach' document that contained the
copyright (c) high-ascii symbol and it would not print with either
parallel port driver. I trapped the PostScript error and realized that
my Epson APL card was not passing the high bit since I never modified it
to do so. When the high bit is stripped from the copyright symbol, you
get a ')', which is a PostScript operator (in a place where it shouldn't
be).

Normally, ASCII PostScript is supposed to be 7-bit and the high-ascii
characters should be escaped by a '\' and their octal number. Apple's
LaserWriter driver does not do this out of the box, since AppleTalk
allows passing all 8 bits and the printer recognizes the high-ascii
characters. Unless I rebuild the driver from source, that will be hard
to add, so if you plan to use a parallel port driver with the direct
connect PostScript driver, make sure your parallel card is passing all 8
bits.

At this point, I think the only thing remaining on this driver is the
testing with TreeHugger and TCP/IP, which I _will_ do in GSPort.




Hugh Hood

gid...@sasktel.net

unread,
Aug 3, 2020, 1:01:26 AM8/3/20
to
I have to say, Hugh, wow and well done.

Only if you did all this 2 years ago. I got rid of my LaserJet III printers and would have been in awe to have got them working with my Apple IIGS.

But great read and thanks for all your posts.

Hugh Hood

unread,
Aug 4, 2020, 12:24:40 AM8/4/20
to
On 8/3/2020 12:01 AM, gid...@sasktel.net wrote:
>
> Only if you did all this 2 years ago. I got rid of my LaserJet III
> printers and would have been in awe to have got them working with my
> Apple IIGS.
>

Thanks for the kind words.

Yes, I wish I had done this a little over 25 years ago, because I've had
a PostScript printer hooked up to my IIGS for that entire time, and
since it wasn't AppleTalk/LocalTalk, it was useless for PostScript
printing from the print dialog in GS/OS apps.

Although the Direct PostScript printer driver is now tested and ready to
be released, I'd like to optimize and test the Windows ncat scripts
(required for direct printing to a networked printer from both 8-bit and
16-bit apps in the GSPort emulator) before I put everything out there on
my website.

But, if someone has a PostScript printer and would like just the driver,
contact me and I'll send it.




Hugh Hood
0 new messages