robhagemans / pcbasic

PC-BASIC - A free, cross-platform emulator for the GW-BASIC family of interpreters
http://www.pc-basic.org
Other
396 stars 48 forks source link

fixed com ports parity issue #153

Closed Danitegue closed 2 years ago

Danitegue commented 2 years ago

Hello Rob, I have been doing some tests with two vitural enviroments. a) python 3.8.10 x32 (In theory the latest one compatible with both, win10 and win7) b) python 2.7.18 x32

As you suggested, I have adjusted all the port.py parameters relative to the com port configuration, from bytes to str. It was also needed to adjust the parity options in machine.py, inp() and _out() functions.

To keep the python 2 retro-compatibility I implemented a python_version switcher:

if python_version[0]>'2': #For python3: convert byte string into str
    param=param.decode('latin1')

So that, the "param" variable of ports.py, _parse_params() function:

I tested it with my brewer instrument simulator software, and now it is communicating properly in both cases.

Two other minor changes included in this pull request, that I hope you could accept: -In dos.py, launch() function, I have modified a debug logging line to know which SHELL is using pcbasic. (is pcbasic really using my custom shell?. Now I can check it.) -In dos.py, _show_output(), I have added a debug logging line to print the stdout of the SHELL into the debug log file. (Is my custom shell doing what is supposed to do? Now I can check it, and register it through the log file).

Best regards

Danitegue commented 2 years ago

Hello Rob, Ok, I have applied the changes as you suggested.

The SDL crash on startup bug is pretty annoying. One should be quick and move the mouse quickly out of the print area, otherwise pcbasic crash. If I'm not wrong, @rbergen proposed a functional PR to solve it on https://github.com/robhagemans/pcbasic/pull/148. Would it be possible to merge it and tag a new intermediate version/release? (I would say it is the unique left to start trying this new iteration of pcbasic in a few instruments).

Best regards.

rbergen commented 2 years ago

@Danitegue Stating explicitly that I don't intend to create a permanent fork in the project sense of the word, I have just pushed a branch to my fork (rbergen/pcbasic:release-2.0.3-fixes) that is a 2.0.3 version of PC-BASIC with the fixes in #146, #147, #148, #149, #150 and this PR applied (I do hope you don't mind me including your work.) Feel free to try it out, and do let me know if the SDL2 fix works for you as well if you do.

I'll drop the branch as soon as @robhagemans creates an official intermediate version that includes the same, but it provides anyone who wants it (like myself) with a version that includes the fixes on 2.0.3 I am now aware of.

robhagemans commented 2 years ago

Hi, I'll try to merge some of this and do a release - unfortunately my build environment is broken so this may take a bit longer. Also, if you depend on some of the more recent (meaning anything from the past year) fixes, please do check out the develop branch as some fixes are merged in there that are not on master or in the last release.

robhagemans commented 2 years ago

Turns out I had previously merged a solution to this closing issue #125, using .encode('ascii') and .decode('ascii') on self._serial.parity in COMDevice.set_params() and COMDevice.get_params(). This works because the parity letter is always ASCII; in Python2 the field holds bytes but Py2 accepts b'S'.encode('ascii') as a no-op, while in Python3 this field holds str.

robhagemans commented 2 years ago

Added logging around SHELL separately