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

KEGS Fun -- ProTERM & Spectrum to Windows Command Line Console

63 views
Skip to first unread message

Hugh Hood

unread,
Dec 24, 2023, 7:48:29 PM12/24/23
to
Ever since Kent added his serial client to IP server feature to KEGS in
v1.29, I've been primarily using it to print directly and swiftly from
Apple II applications to a network printer attached to the host on which
KEGS is running. It works very, very well for that, in both 8-bit and
GS/OS applications.

I've also wanted to use that feature to connect from ProTERM and/or
Spectrum to the terminal app in MacOS, and to the command line console
in Windows 10. Notwithstanding that most would not find that useful, I
must say that I've tried it on both platforms and it is indeed possible.

On MacOS, I just followed Blake Patterson's method of using 'socat'
within a daemon.
<https://bytecellar.com/2022/11/28/configure-your-mac-to-allow-vintage-computers-to-dial-in/>

His method uses the login command automatically, and other than
installing socat and adding a .plist file to /Library/launchdaemons
there really isn't much to it.

On Windows 10, I've been using a little different method, but it also
involves socat and a couple of .bat files.

One .bat file summons socat to accept a connection from the Apple II and
then forwards it to the Windows command line.

Since I wasn't happy with there not being a prompt for login (and I
wasn't satisfied with the 'runas' method, the second .bat file, which
socat 'EXEC's, provides login prompts and verification, and assuming one
passes, starts up 'cmd.exe'.

I've tested it in both ProTERM 3.1 and also in Spectrum and it does the
job well. In both, I ran with VT100 emulation and with the baud rate set
to 57,600. I'm not sure the Windows console even uses VT100, but that
setting seemed to provide the best visual results in ProTERM and
Spectrum, for whatever reason.

Script #1 is basically just one line:

************************************************************************

socat.exe TCP4-LISTEN:7778,fork
EXEC:"C\:\/Users\/yourusername\/Desktop\/userandpwprompt.bat",pty,setsid,setpgid,stderr

************************************************************************

For example purposes, I left in the path to Script #2 just to show you
how socat requires the ":" and "\" in Windows pathnames to be escaped.
And yes, the Windows slashes are reversed, but that is what works with
socat.

Script #2 (which I called 'userandpwprompt') is several lines:

************************************************************************

@Echo Off

:Top
@set INPUT=
@set /P INPUT="Username: "%=%
@if /i NOT "%INPUT%" == "your...@yourdomain.com" cls & timeout /t 0
/nobreak & goto Top
@set INPUTPW=
@set /P INPUTPW="Password: "%=%
@if /i NOT "%INPUTPW%" == "yourpassword" cls & timeout /t 0 /nobreak &
goto Top
@cls
C:\Windows\System32\cmd.exe

************************************************************************

Now, I don't claim to be an accomplished .bat scripter. I'm sure this
could be improved, but it works.

FWIW, the main reason I require a login is so I don't accidentally send
errant characters to the serial port being forwarded to the socat server.

Anyway, I'm glad that's done. It's been a semi-obsession for several
days now. I can go back to finishing my real work now. ;-)




Hugh Hood



Speccie

unread,
Dec 25, 2023, 3:40:18 AM12/25/23
to
Hugh,

> I've also wanted to use that feature to connect from ProTERM and/or
> Spectrum to the terminal app in MacOS, and to the command line console
> in Windows 10.

I find it easier to FTP into the Mac using SAFE2, as I can then configure favourite entries non SAFE2 to point to specific destination folders. On earlier Macs, they had a built-in FTP server, and on later Macs I use FTP Server from the App Store. If you can set up an FTP server on a Windows machine, you could FTP into that.

Check Page 8 of the SAFE2 manual for how to do it: https://speccie.uk/software/safe2/

Cheers - Speccie


Hugh Hood

unread,
Dec 26, 2023, 12:29:05 PM12/26/23
to
Ewen,

Thanks once again for the input.

I agree, FTP file transfer is a very convenient method of file transfer
between an emulated IIgs and the emulator's host machine.

In fact, I've used your SAFE2 in GSPort on Windows since it has an
emulated Uthernet card feature. I believe Sweet16 on MacOS Mojave and
earlier will do the same.

While I still keep GSPort on my machines, I'm now sold on KEGS as my
preferred emulator on MacOS and Windows due both to its speed and Kent's
recent feature additions, particular the serial port to IP server
capability.

Based on your comment though, I've now experimented with using Marinetti
on my KEGS emulated IIgs. Since KEGS (unlike GSPort) doesn't offer an
emulated Uthernet, I thought perhaps I could use one of the serial port
link layers (i.e. PPP or Direct Connect) combined with KEGS' serial to
IP server feature and somehow make a network connection to enable
applications like SAFE2 and Webber to work on KEGS.

So far, I've been unable to do so, but given the myriad capabilities of
socat to bridge unlike protocols and ports, I plan to keep trying.

Given your expertise with link layers and network protocols, would you
think that something like the PPP or Direct Connect link layers could be
used in this scenario, or would you say rather that I'm engaged in a
waste of time?

One more thing -- the primary reason I like to access the MacOS terminal
or the Windows command line console from the emulated IIgs is not for
file transfer, although zmodem can be used there. Rather it is to
execute commands on the host operating system doing things I won't
detail here.

Kind regards,




Hugh Hood

Speccie

unread,
Dec 27, 2023, 2:59:15 AM12/27/23
to
Hugh,

> Given your expertise with link layers and network protocols, would you
> think that something like the PPP or Direct Connect link layers could be
> used in this scenario, or would you say rather that I'm engaged in a
> waste of time?

I have not yet used KEGS, as so far Sweet16 has done all I wanted. I do now have an Apple silicon Mac, so maybe I finally need to look into it.

I use the Sweet16 Link Layer most of the time, so am not sure which other Link Layers would be most suitable for KEGS. As only parts of the Link Layer are my copyright, I can supply the source code for the Emulator Link Layer, which is similar to the Sweet16 LL, for anybody who wants to “roll their own”. It is on ORCA/M format, but is not heavily commented I’m afraid.

I will look it out and put it on my website when I get time.

Cheers - Ewen

Speccie

unread,
Dec 27, 2023, 4:56:26 AM12/27/23
to
Hugh,

> I will look it out and put it on my website when I get time.

The ORCA/M source code for the Emulator Link Layer is now on my web site:

https://speccie.uk/software/marinetti-link-layers/

I can’t really help with it very much, as adapting it to a new interface would be dependant on the requirements of that interface...

Cheers - Ewen

Hugh Hood

unread,
Dec 27, 2023, 10:16:26 PM12/27/23
to
Ewen,

Thanks for putting that up. I'll take a look.

Although I promise NOT to pepper you with questions on this, I would ask
one thing -- what is a DNR error and what in particular causes it?




Hugh Hood

Speccie

unread,
Dec 28, 2023, 3:14:54 AM12/28/23
to
Hugh,

> Although I promise NOT to pepper you with questions on this, I would ask
> one thing -- what is a DNR error and what in particular causes it?
DNR usually stands for Domain Name Resolution, so an error would normally be that you had given an incorrect URL, and the domain name server you were using could not translate it into a valid dotted address.

Cheers - Ewen

Hugh Hood

unread,
Jan 26, 2024, 4:52:16 PMJan 26
to
For completeness I'll leave this here --

Previously I had detailed a method of using ProTERM 3.1 and/or Spectrum
when running under Kent's KEGS to access the Windows 10 command prompt
from within the emulated IIgs environment.

That method continues to work.

But, as I am more of a unix bash shell guy (from years with Mac OS X), I
didn't find it very useful.

So, I installed Cygwin64 and its bash shell on my Windows machine. Using
the same setup I detailed before, with only one change to Script #2
below, I now am able to access a bash shell running on the Windows
machine from within the emulated IIgs using ProTERM 3.1 and/or Spectrum.

In Script #2 below, change

C:\Windows\System32\cmd.exe

to

C:\cygwin64\bin\bash --login


You may wish to modify your .bash_profile file in cygwin64 to change the
TERM variable to vt100 and also change your startup directory, but other
than that, it's ready to go.

I realize that most will find this a novelty. But, I use some unix
utilities that will accept standard input to do print file conversions,
usually from HP pcl generated by AppleWorks to .pdf format.

By having the emulated Apple II (either by script or macro) login to the
bash shell first, sending the appropriate unix command (ie - pcl2pdf)
and then by 'printing' to the shell (using Kent's Remote IP feature for
redirecting serial port output) this all works very well.

And, while I haven't yet tried it, I suspect GS/OS desktop applications
using the Direct Connect PostScript Driver could use the unix command
'ps2pdf' directly to generate .pdf files from documents 'printed' from
those desktop applications. (I know Sheppy's SweetPrinter does something
similar, too).

{BTW, those two utilities (pcl2pdf and ps2pdf) are part of the
GhostScript GhostPDL package}.

Enough, already.





Hugh Hood

Hugh Hood

unread,
Feb 10, 2024, 3:33:03 PMFeb 10
to
In what I think is my final post on this topic, I've simplified greatly
the method I use with KEGS when accessing the Windows 10 cygwin64 BASH
shell from either ProTERM 3.1 or Spectrum. This provides both a login
prompt and if successful, full access to the BASH shell on the host machine.

It requires both an installation of 'socat' and 'cygwin64' (plus BASH).
On KEGS, your preferred serial port is set to remote IP '127.0.0.1' and
port as being '7778'. The port number can be anything, but it is best to
keep it as something other applications will not use.


Save the following command as a .bat file: (I call it 'startbash.bat')
*******************************************************************

socat.exe TCP4-LISTEN:7778,fork
EXEC:"C\:\/cygwin64\/bin\/login.exe",pty,login,setsid,stderr


*******************************************************************

Note that is all one line.

Just run 'startbash.bat' (or just enter the line into the command prompt
window) either before or after starting KEGS, and when you're done with
it, just go to the command prompt window and hit ctrl-c to end it. I
suppose you also could do this as a startup item and just keep it hidden.

Again, this is for Windows. For KEGS from MacOS just run socat as a
daemon as Blake Patterson documented in order to access the bash shell
from ProTERM 3.1 or Spectrum.




Hugh Hood

0 new messages