VOGONS

Common searches


First post, by brazil

User metadata
Rank Newbie
Rank
Newbie

Hello, I am using DOSBOX 0.72 to run an small application within XP SP2, that require access to some pins of Serial Interface COM2: (02F8h) and some pins of the Parallel Interface LPT1: (0378h). Up to this point everything is nice, clean and smooth, but it requires the USERPORT.EXE and .SYS so XP would release the I/Os for the DOSBOX, it works.

The problem:

Within this application, an executable code compiled from QBasic to IBM PC DOS Assembly via MASM.EXE, at some point I need to read into an array all specific files from the working directory at the HDD.

When running this application on Microsoft VPC (DOS 6.22), what I was doing was to issuing a "SHELL DIR /B *.XYZ > FILES.TXT" , so the DOS "DIR" command would do the trick, the /B switch tells it to create FILES.TXT with the "bare" names of all files with extension "TXT".

By "bare" names I mean in each line of text appears only the file name in the format nnnnn.eee without anything else, without headers or footers, without file size, attributes, dates, etc.

After issuing the SHELL DIR command, the application opens the FILES.TXT and read all lines (records) one by one, and get the filenames ready to use.

For my surprise, when migrating it to DOSBOX, there is no DIR /B switch. There is the usual switch /p (paging), the /s (should be for sub directories listing, but DOSBOX does nothing with, no error though), and the /w switch for wide format.

But not the /B switch, even so I think this switch is a very clean and easy to do within the DOSBOX, since it is only a piece of code from the normal DIR.

Without the /B, my life is miserable, really. For my dismay the DIR > command only includes 10h (New Line) character at the end of each line, and the old IBM PC Text Screen system understand it as "New Line" AND " Carriage Return" (hex 0Dh), so the file doesn't have CR at the end of each line. So, I needed to write a long code to go over this simple missing (/B) option at the DIR command.

I think this option would make my life less miserable, and will help to solve the average stress level of the World. Considering that this /B option is relatively used in applications that deal with files using strategies like mine.

Question is, what is the possibility for this /B switch been accepted as to make part of the next version of DOSBOX?

Of course, asking a finger really means two of them.

The /a switch would be the best companion, so /ah could be fantastic to find hidden files.

I also see the ATTRIB DOS command is only for compatibility, it really does nothing, but it could really set attributes for hidden, system, read-only, etc.

Thanks for any hopes and for this great program.

WagnerLip

Reply 1 of 14, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

DOSBox is intended to run games. So features that benefit only an application programmer have little priority

attributes can't be set cross platform. So hence attrib does and will do nothing. (linux doesn't have a system or hidden attribute for example)
there is no game that uses either /s or /b
Can't you for /b not simply parse the output of dir yourself ? There isn't that much extra information. or using something like most programmers use.. Findfirst + find next (Which is the "official" way of searching for files)

To be honest this the first time I ever heard of somebody using dir /b. I didn't even know it existed.
Maybe if you can present some convincing arguments on why /b should be included, it might be possible to convince me. Codewise adding /B is pretty easy. /s is a bit harder though

Last edited by Qbix on 2009-07-28, 14:41. Edited 1 time in total.

Water flows down the stream
How to ask questions the smart way!

Reply 3 of 14, by brazil

User metadata
Rank Newbie
Rank
Newbie

Thank you for the answer, Qbix. Even that DOSBOX was developed with games in mind, actually DOSBOX is the best solution against the evil lack of real DOS on newer windows platform, not only for gamers. I am a small hardware and software producer, mostly related to microprocessors and microcontrollers. Like me, hundreds of thousands of other small entrepreneurs around the world grow professionally, grow their sole companies, creating jobs and supply the market with intelligent solutions, mostly to the industrial area. Lots and lots of us use DOSBOX not for games, you would be very proud to see how many use DOSBOX in a daily development, debugging and even running applications.

Before DOSBOX, the solution was to load the heavy Microsoft VPC, install a DOS 6.22 as a virtual machine and go from that. That's heavy, non practical and bad. We always look for a better solution, DOSBOX is it.

Lots of us expend many years developing solutions under DOS (assembly or compiled), under Win98, and suddenly REAL DOS was kidnapping for a greater platform, Win2000, WinXP and such. Unfortunately for those hundreds of thousands of developers that was a low punch.

Customers don't care, they want to run the application in their daily use platform, so our applications (millions of them) simply crash requiring a nasty dance with the devil trying to not blaspheme Mr. Gate's name in vain all the time.

You should be proud. DOSBOX "is" the number one hallo over our applications, and believe me, it IS helping in keeping bread over our tables.

Why /B would turn DOSBOX better? Because it will make our working hours after midnight a little short, will allow us to sleep a little bit longer, and smile for our kids. I work with electronics all my life, and I teach electronics for free at some online forums and distribution lists, even before Internet were available, the old time of BBS and 2400bps dial-up. Whenever I use my time to teach or help someone else in the electronic area, I feel proud for my participation, and feel much prouder if I realize more people would benefit from it.

Your kind of involvement with DOSBOX is not that much different. Of course we can parse the DIR redirected file and strip only the filenames, by the same way we could force customers (and ourselves) to install Win98 to be able to use our applications the way they were designed. Humans learn to develop TOOLS just to avoid it, make life easier a more productive.

Utilities and solutions such DOSBOX are gifts of wonder, and you will want to see it shine more and more. /B will be a gift inside a gift for many friends.

As you confirmed, in terms, DIR /B is much simpler to code than the plain DIR, and its implementation will be a token of DOSBOX importance for thousands of other people you never heard, benefiting from your job.

Why /B is much important than doing something else, like parsing the filenames, etc?

Because the thousands of already made applications that were done considering the /B switch.

You can be sure, the /B will not only help me, will help many thousands other friends using DOSBOX for lots of other uses and applications. All those friends will silently thank you much.

I personally thank all the people involved in making DOSBOX to exist and improve, putting smiles on faces of many users.

Do You Believe in Magic?

Sincerely, Wagner

Reply 4 of 14, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

It's of course nice that dosbox isn't only "useful" for games. But the decision
of a focus on games is simple: emulation correctness is not always priority
and is in several aspects balanced with speed considerations. This essentially
means that if you're using dosbox for games, you can enjoy the games that
work (with/without major/minor glitches), but for applications you're on your
own: if one of the correctness considerations introduces a (possibly not
obvious) flaw into the calculations or behaviour of your application, we don't
care and do not feel responsible.

If you feel like a feature is missing, the fastest way is to implement it yourself
into dosbox. Or convice somebody else to do that, which may be hard depending
on the feature.

Reply 7 of 14, by brazil

User metadata
Rank Newbie
Rank
Newbie

Checking JP Software website for the 4DOS, during the installation it says not (strongly) recommended to run under WinXP. It recommends to use the 4NT paid version instead.

Going back to step #1 while trying to find a simple solution.

I also found out that the DOSBOX MegaBuid4.1 from H-a-l-9000 (DOSBOX v0.72) is the only one (AFAIK) that supports parallel port, and that is the one I am using. As I could not find any available (parallel) patch at the net for other versions of DOSBOX, then probably my quest to have /B available should go for H-a-l-9000 to implement on his Megabuild4.1

I also appreciate the configuration screen from H-a-l, when pressing Alt+Break. That's neat.

Tks
Wagner.

Reply 8 of 14, by HunterZ

User metadata
Rank l33t++
Rank
l33t++

If you're running 4DOS in DOSBox then you're running it under DOSBox not under WinXP. It works fine, I do it all the time.

I also use the FreeDOS utilities under DOSBox without even booting FreeDOS itself. It has a command.com replacement (called freecom or something but named command.com) that I'm sure supports dir /B.

Reply 11 of 14, by brazil

User metadata
Rank Newbie
Rank
Newbie

I was able to install and run 4DOS within DOSBOX.

Now I will try the application within 4DOS, and see if the parallel port still reachable by the application.

For some strange reason, PORTALK doesn't work in freeing ports 0378-037F from Windows XP. I needed to use USERPORT for that, and strangeer that it may seems, it doesn't work every time. Trying to figure it out yet.

---

Other alternative, instead of 4DOS (that could be difficult to install in all applications already on the field), would be to produce a .EXE file (outside de application) with the name DIR.EXE, accepting the /B switch, to provide the redirected file with only file names.

If you copy any nnnn.exe as dir.exe and try to run it, the DIR (native DOS command) will take over and your new executable dir.exe will never run. But there is a way: /DIR or \DIR or "DIR bypass the native DOS commands search, and instead, your copied application as DIR.EXE will run. But it doesn't solve the issue, since the applications are already calling DIR without trailing / \ or ".

The way to make it works, it needs to create the new executable to replace the original DIR command as IR.EXE, having the /B switch, and a simple (patcher) find and replace in the binary executable files, when the "SHELL" is called, replacing the "D" letter (from DIR) with "\" character, so the call now would be "SHELL \IR /B *.xxx > FILES.TXT". This will not change the executable size.

It may works.

tks
Wagner

Reply 12 of 14, by MiniMax

User metadata
Rank Moderator
Rank
Moderator

You mentioned using VPC and MS-DOS.... You can do the same with DOSBox. Boot a real MS-DOS inside DOSBox.

DOSBox 60 seconds guide | How to ask questions
_________________
Lenovo M58p | Core 2 Quad Q8400 @ 2.66 GHz | Radeon R7 240 | LG HL-DT-ST DVDRAM GH40N | Fedora 32

Reply 13 of 14, by brazil

User metadata
Rank Newbie
Rank
Newbie

[You mentioned using VPC and MS-DOS.... You can do the same with DOSBox. Boot a real MS-DOS inside DOSBox.]

Ok, created an image of a DOS622 as DOS622.IMG, mounted a drive where the image file is and booted such image file.

Worked like a charm.

Now I need to run the applications under this DOS6.22, under DOSBOX, to see if it works nicely, mostly related to the use of Parallel and Serial ports.

I wonder where I can find the patch for parallel port passthrough to use in the version 0.73 and newer to be released in the future. Up to now, the only version that "contains" such patch (parallel passthrough) is the Mega4.1. Will it have versions update in the future?

Thanks.
Wagner.