audetto / AppleWin

Apple II emulator for Linux
GNU General Public License v2.0
46 stars 11 forks source link

SSC in TCP mode? #108

Open oliverschmidt opened 11 months ago

oliverschmidt commented 11 months ago

Hi,

As far as I understand there's currently basically no SSC support.

I understand very well there's no desire to implement some Linux serial port code that "emulates" the Windows serial API good enough to not require the AppleWin SSC code to be modified. The only way to go for real serial port support would be from my POV to use something like http://sigrok.org/wiki/Libserialport in the shared SSC code.

Anyhow, my feature request is rather to "only" support the SSC TCP mode. At least conceptually that should be possible with little effort. It would be great if you could comment if you see this coming soon.

Thanks in advance, Oliver

audetto commented 11 months ago

I understand the idea, but I have never used it. Do you have some example application i could run to test and develop it?

oliverschmidt commented 11 months ago

To avoid a misunderstanding: I don't know of any real "use case". However, for testing purposes you can connect to AW with a Telnet client. There are two scenarios worth testing:

  1. SSC Firmware

    • Enter IN#2 and PR#2.
    • Connect to AW.
    • Chars entered on each side are supposed to appear on the other side.
    • If chars typed on the AW side appear as garbage on the Telnet client then this is because the SSC firmware sends all chars with bit 7 turned on. To change that: Enter Ctrl-A. This brings up a prompt saying APPLE SSC:. Now enter 1D. This changes the transmission from 8 bit to 7 bit. See: https://github.com/AppleWin/AppleWin/blob/master/source/SerialComms.cpp#L745
  2. ProTERM

    • "Install" with Null Modem Driver and Apple Super Serial Card in slot 2.
    • Select Online | Parameters. Set Line Status to Online.
    • Connect to AW.
    • Chars entered on each side are supposed to appear on the other side.
    • Check out https://github.com/oliverschmidt/ProTERM
audetto commented 11 months ago

Got it.

It does not seem to hard, but I think this will require some care.

https://github.com/audetto/AppleWin/blob/ed3f07122e1fb16d036ceb5c670f7f049b278176/source/SerialComms.cpp#L258

These events seem to be sent to the app's message handler

https://github.com/audetto/AppleWin/blob/ed3f07122e1fb16d036ceb5c670f7f049b278176/source/Windows/WinFrame.cpp#L1886

I need to convert it to a non blocking setup like I did for the uthernet2, or some select. At which point, the Windows code could be changed too, but would anyone agree with this?

oliverschmidt commented 11 months ago

You are right. I wasn't aware that AppleWin still uses the 16bit-Windows WSAAsyncSelect() approach.

https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsaasyncselect states: It may be altered or unavailable in subsequent versions.

This should be enough to have everybody agree with a change getting rid of that approach ;-)

audetto commented 11 months ago

It was easier than expected (I've tested your method 1).

https://github.com/audetto/AppleWin/tree/ssc

But I have to check everything and see if I find a way to avoid ifdefs. I will have to debug why in telnet, there are only CRs but not LFs.

oliverschmidt commented 11 months ago

It was easier than expected (I've tested your method 1).

:-)

I will have to debug why in telnet, there are only CRs but not LFs.

That's to be expected: