VOGONS

Common searches


First post, by pmorath

User metadata
Rank Newbie
Rank
Newbie

I have a model railway which is controlled digitally - meaning that tracks and signals are switched end-to-end according to the time-table, trains start and stop as configured, etc.

The model railway is Märklin with decoders from Trix (Selectrix). The program was developed by me in QBASIC on Windows 3.1 and refined over the years. The connection between the old PC and the model railway was a serial interface (RS232 cable). Now I want to shift from the old PC to my laptop to add some features, e.g. sound.

Attached to my Windows 11 laptop is a USB- to RS232 converter cable, installed on the computer are the DOS-BOX and QBASIC.
The QBASIC program as copied from the old PC is executable inside DOS-BOX - but unfortunately, the RS232-connection doesn't come up.

To locate the area of the issue, I've tested the connectivity between laptop and the model railway control unit with hterm (run in Win11) - in this test the control unit reacted as expected. So the laptop is ok, the USB is ok, the cable as well and also the external device.

Therefore I assume that either the DOS-BOX configuration doesn't support COM-PORT via USB (which I doubt, because many games need serial interfaces as well), or something's wrong with the QBASIC interpreter.

With my old application (ported from Win3.1), the communication at earlier days was successful with statements such as
...
OPEN "com2:9600,n,8,2,cs,ds,rs,cd" FOR RANDOM AS #2
...
PRINT #2, CHR$(128);
...

This should set Bit7 via RS232 (without CR-LF or other control characters) and in effect switch on the model railway central unit.

Does anyone have an idea, if the reason is with DOS-BOX or with QBASIC?
Do I have to change in the set-up of the DOS-BOX? If so, how?
Or am I using wrong QBASIC-commands?

I'm looking forward to your suggestions!

Peter

Reply 2 of 6, by Gmlb256

User metadata
Rank l33t
Rank
l33t

Have you checked the dosbox.conf file to see if the serial interface is configured to use the physical connection? Never had issues with one of these USB to serial adapters (mine has a FTDI controller btw) when playing Hexen in a co-op session.

Nevertheless, I second DosFreak's advice of running it natively if that's possible.

VIA C3 Nehemiah 1.2A @ 1.46 GHz | ASUS P2-99 | 256 MB PC133 SDRAM | GeForce3 Ti 200 64 MB | Voodoo2 12 MB | SBLive! | AWE64 | SBPro2 | GUS

Reply 4 of 6, by pmorath

User metadata
Rank Newbie
Rank
Newbie

Hurray, great, thanks to Gmlb256! The interface is up and running now. Perfect - you saved my day & week 😀

Next thing I'll try is to get my programs compiled by qb64 running as well - because I've seen in the wiki that soundfiles can be embedded there (we'll see how more or less easily that works...). I'll keep you informed.

Reply 5 of 6, by pmorath

User metadata
Rank Newbie
Rank
Newbie

Ok, here's the status after several different approaches:
- the program runs nicely in the DOS-Box with qb11, i.e. interpreter-mode, and the USB-RS232 communication as "COM2" works
- the same program compiled with qb64 results in a "bad file mode" error, and the interface isn't working
- still the test by hterm works well under Windows11, i.e. the manual entry

Are there any properties I need to assign to qb64 or to the compiled program? Or what else could be the reason for the error?

Thanks in advance for your suggestions!

Reply 6 of 6, by DosFreak

User metadata
Rank l33t++
Rank
l33t++

Mabye print is formatted differently in qb64 or doesnt recognize what you are giving it? There should be a debug capability in qb64.

How To Ask Questions The Smart Way
Make your games work offline