erco77 / parallel-dos

MS-DOS interactive parallel port monitoring/control tool (Turbo C)
GNU General Public License v3.0
8 stars 0 forks source link

Gibberish output when running on pure MS-DOS 6.22 #1

Closed mdanh2002 closed 1 year ago

mdanh2002 commented 1 year ago

When running the compiled executable on MS-DOS 6.22, all I get is gibberish output filled with ANSI console control characters (e.g. [7;4H) on the screen. You have made full use of these control codes to draw the UI, which work in a terminal window on Windows 10, but not with MS-DOS 6.22 (not even Windows 7 or Windows 8 command prompt). A tool that tests the parallel port should run properly in real-DOS mode. Just sharing my findings.

erco77 commented 1 year ago

You'll need ANSI.SYS installed for that to work.

DEVICE=\DOS\ANSI.SYS

..in your C:\CONFIG.SYS file. Adjust the path to ANSI.SYS based on where your DOS directory is installed.

I'll add that requirement to the docs. Back in ye olde DOS days, we always had ANSI.SYS installed so apps could show colors and stuff without having to resort to direct poking around in screen memory. (B800:0000 + B000:0000)

I don't think this app will work as written on anything after Win98 (e.g. Win NT and up) due to permissions to access the port. I seem to recall a small bit of code is needed to escalate the process to have access to the hardware for WinNT+, But for sure the code doesn't have that currently; it's a pure DOS (pre-NT) program as written.

erco77 commented 1 year ago

If that solves the problem, feel free to close.

mdanh2002 commented 1 year ago

Thanks for the fast reply. I almost forgot about ANSI.SYS. I had assumed you developed it directly on your 32-bit PC from Windows. And yes, Turbo C works fine on Windows 10 32-bit if NTVDM is installed.

I did remember being able to access ports from Windows 10 32-bit DOS prompt if a certain patch was installed. Forgot how I did it previously.

Btw, you can find here two parallel port tester tools (PANDERS and SPP20) http://wearcam.org/seatsale/programs/www.beyondlogic.org/pardebug/pdebug.htm

SPP20 was also written in Turbo C and works well without using ANSI.SYS. PANDERS was designed using Borlandl's BGI graphics and works just as well.

When I have the time, I will try to improve the code and remove the need for ANSI.SYS. Maybe just using gotoxy() in conio.h is sufficient.

erco77 commented 1 year ago

Ya, this tool was written back in the late 80's using Microsoft C compiler version 1.0, which had very limited libraries for doing much beyond what DOS and BIOS provided.

I recently ported the code to Turbo C because of my own needs, and that opens up a lot of possibilities I suppose for high level text/color functions.

My reasoning for keeping the ANSI.SYS stuff was so that printf() and friends could be used easily without having to make a varargs function that pokes colors and such into memory.. but perhaps Turbo C provides a way to do that.

mdanh2002 commented 1 year ago

Turbo C's conio.h has many functions to set cursor position, text color, clear screen, etc. It's not very fast, but for our purposes (updating parallel port status), I think it's more than sufficient.