VOGONS

Common searches


Autoexec.bat question

Topic actions

First post, by Stojke

User metadata
Rank l33t
Rank
l33t

Does Autoexec.bat have an ignore line command? For example ";" or "//" or something?

I cant be bothered to edit it fully every time i want to use a different sound card for what tracker i want to use it...

If i leave all devices to be loaded, the tracker will use the old OPL2 chip instead of the new OPL3 chip on my sound cards, so i need to edit and add/remove lines...

Reply 2 of 22, by Stojke

User metadata
Rank l33t
Rank
l33t

So for example if i want to use OPL3 card i would do this:

SET BLASTER=A220 I5 D1 H5 P330 T6 (OPL3)
rem SET BLASTER=A220 I3 D1 H5 P330 T1 (OPL2)

And than save & run?

Note | LLSID | "Big boobs are important!"

Reply 3 of 22, by megatron-uk

User metadata
Rank Oldbie
Rank
Oldbie

Yep - 'rem', it stands for 'remark', as in, 'what follows is just a comment, don't run it'

My collection database and technical wiki:
https://www.target-earth.net

Reply 4 of 22, by megatron-uk

User metadata
Rank Oldbie
Rank
Oldbie

You could of course add those seperate 'SET BLASTER' lines into individual .bat files and run whichever one you want before a specific application. So run OPL2.bat or OPL3.bat, then the game/software you want to run.

My collection database and technical wiki:
https://www.target-earth.net

Reply 5 of 22, by Norton Commander

User metadata
Rank Member
Rank
Member

If you're talking about DOS 6 or higher you don't need separate BAT files - you can use the menu commands to choose which SET lines you want to execute. So which DOS version?

Reply 6 of 22, by Stojke

User metadata
Rank l33t
Rank
l33t

Hmm, didn't think of that, i thought autoexec.bat was a master and only it could activate what i need.

Thanks Megatron, and thanks for explaining the command!

Oh, and, one last question, if i make 2 bat files, autoexec.bat should be empty?

[Edit]

@Norton

I use windows 98SE command mode. That is restart in MS DOS.

Reply 7 of 22, by megatron-uk

User metadata
Rank Oldbie
Rank
Oldbie
Norton Commander wrote:

If you're talking about DOS 6 or higher you don't need separate BAT files - you can use the menu commands to choose which SET lines you want to execute. So which DOS version?

Stojke wants to change on-the-fly, ie before running a particular programme. Choosing which one to use at boot-up via the config.sys/autoexec.bat menu is confusing the issue - all that needs to happen in this use-case is to change the environment variable based on which app/game/util Stojke wants to run next.

My collection database and technical wiki:
https://www.target-earth.net

Reply 8 of 22, by SquallStrife

User metadata
Rank l33t
Rank
l33t
megatron-uk wrote:

Yep - 'rem', it stands for 'remark', as in, 'what follows is just a comment, don't run it'

Here's an interesting, useless bit of trivia:

Instead of using the REM statement, prefix your comments with two colons.

:: Like This

Using REM, the command interpreter reads the whole line before reading the next line. Using the double-colon method, the command interpreter hits the second colon, determines that this is an invalid label, and immediately jumps to the next line.

Probably 0.000001% speed difference on a system with more than a dozen MHz of horsepower, but could theoretically speed things up a bit on an old 8088 or something, if you have long blocks of comments, and you're running off a floppy disk.

<-- nerd.

VogonsDrivers.com | Link | News Thread

Reply 9 of 22, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

Nerd!!!
😉

But didn't know that back when it was useful to me...

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for macOS (10.4-11.x ppc/intel 32/64bit) notarized for gatekeeper

Reply 11 of 22, by Malik

User metadata
Rank l33t
Rank
l33t

Assuming entering the SET environment for a card at the command line just before loading the tracker program doesn't help, :

The tracker program might be accessing the port 388 directly instead of looking for the SET parameters. If that's the case, both OPLs on the cards will be called. Unless, a program accesses the 388 port via the I/O port, for example, the common 220 or 240 I/O ports, which you can specify in programs that have proper setup or install program, it goes back to square one.

I once selected the Adlib sounds in Colonel's Bequest (Sierra Game) when I had 2 sound cards installed - a CT1350B and a CT2760 (SB1.5 & AWE32), and both FM chips started making music.

If the program does not have a utlity or setup to select the proper I/O address of a sound card, :

If it's a PnP card, the PnP utility might help - I'm using the Creative Labs' PnP utility to "shut off" the FM synthesis in my AWE64 Gold card, to route the FM requests to my SB16 CT1740's true Yamaha OPL3 chip.

To "shut off" the said chip, you have to select another "Configuration number" which does NOT have the FM address selection. When this is done, and when the card is initialized with the CTCM program, the PnP card will be given only the parameters of the selected configuration number. Purportedly, this disables the FM synth on the PnP card. You can double check the output when this is done.

Of course, the above is easier to follow if using a PnP card with the Creative's PnP utilities in DOS. In Windows, the same configuration tinkering will help.

5476332566_7480a12517_t.jpgSB Dos Drivers

Reply 12 of 22, by peterferrie

User metadata
Rank Oldbie
Rank
Oldbie

[quote="SquallStrife"]Here's an interesting, useless bit of trivia:

Instead of using the REM statement, prefix your comments with two colons.

:: Like This

Using REM, the command interpreter reads the whole line before reading the next line. Using the double-colon method, the command interpreter hits the second colon, determines that this is an invalid label, and immediately jumps to the next line.[/quote]

No, that's not true.
When DOS sees a colon in the second position, it assumes that the first character is a drive letter. A colon is not a valid drive letter, so the rest of the line, which is treated as filename and parameters, will fail to execute.
However, for DOS prior to v7, it still attempts to *execute* that line (result: "Invalid drive specification" and "Bad command or filename"). Later versions of DOS know that it can't run, so they skip the line silently.

edit: fix my spelling mistakes so that it makes sense. :-)

Reply 13 of 22, by SquallStrife

User metadata
Rank l33t
Rank
l33t
peterferrie wrote:

No, that's not true.

Sure it is.

peterferrie wrote:

When DOS sees a colon in the second position, it assumes that the first character is a drive letter.

Why would it consider the second colon, when it knows the first one denotes a label?

That's not only counter-intuitive, it's counter to the bare mechanics of how batch file execution happens.

peterferrie wrote:

A colon is not a valid drive letter, so the rest of the line, which is treated as filename and parameters, will fail to execute.
However, for DOS prior to v7, it still attempts to *execute* that line (result: "Invalid drive specification" and "Bad command or filename"). Later versions of DOS know that it can't run, so they skip the line silently.

WSwjD.png

VogonsDrivers.com | Link | News Thread

Reply 14 of 22, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

It's understandable that REM would be slower when echo is on, but with echo off I'm skeptical that there is a performance benefit because the command processor has to locate end-of-line to find the beginning of the next line in either case. Also, I have to wonder if using :: for comment lines could slow down GOTO commands, because they will be compared, even if briefly, to the label being searched for.

Reply 15 of 22, by SquallStrife

User metadata
Rank l33t
Rank
l33t
ripsaw8080 wrote:

It's understandable that REM would be slower when echo is on, but with echo off I'm skeptical that there is a performance benefit because the command processor has to locate end-of-line to find the beginning of the next line in either case. Also, I have to wonder if using :: for comment lines could slow down GOTO commands, because they will be compared, even if briefly, to the label being searched for.

That first bit is entirely possible.

Although it shouldn't affect GOTO commands, because they are invalid labels, they should be rejected by the interpreter all together.

Edit: To elaborate, I don't think that the entire file is re-scanned every time GOTO is called. The way I believe it happens is that valid labels are stored in memory alongside a disk location, as kind of a rudimentary pointer. Then when GOTO is called, it check for a matching pointer, jumps to that disk location, and continues executing.

It would be interesting to watch the whole process in a proper debug session.

VogonsDrivers.com | Link | News Thread

Reply 16 of 22, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Well, labels can be before or after a GOTO that searches for them, and I doubt that an initial full pass is made through a batch file to pre-process labels into a table with file pointers... the DOS command interpreter isn't very sophisticated.

Reply 17 of 22, by SquallStrife

User metadata
Rank l33t
Rank
l33t

Appears you might be right!

ndiKN.png

Based on this, yeah, you probably would see a performance hit if you used lots of GOTOs and :: comments.

Interesting!

I dare say, though, the interpreter will move on from a :: comment faster than it would move on from a valid but incorrect label.

Also, I wonder if it goes top-down every time GOTO is used, or if it scans down then loops back to the top?

Now I'm curious.

Did I mention nerd? 😜

Edit: Just did a test, and yeah, it always goes top down.

OR... that could just mean that the interpreter ignores identically named labels after the first... Hmm...

VogonsDrivers.com | Link | News Thread

Reply 18 of 22, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Maybe something like this to test with:

@echo off
echo first line > outfile
::a
::bunch
::of
::comments
::to
::test
::the
::performance
::of
::goto
:again
echo another line >> outfile
goto again

Stopwatch it for 10 seconds before pressing Ctrl-C and see how many lines it writes to the output, then try again with REMs. This gives the interpreter every chance to somehow memorize the position of the one valid label. I purposely omit a space after :: because it's possible that label comparison breaks at the first separator, so perhaps another test with an added space will be different.

Reply 19 of 22, by Stojke

User metadata
Rank l33t
Rank
l33t
Malik wrote:
Assuming entering the SET environment for a card at the command line just before loading the tracker program doesn't help, : […]
Show full quote

Assuming entering the SET environment for a card at the command line just before loading the tracker program doesn't help, :

The tracker program might be accessing the port 388 directly instead of looking for the SET parameters. If that's the case, both OPLs on the cards will be called. Unless, a program accesses the 388 port via the I/O port, for example, the common 220 or 240 I/O ports, which you can specify in programs that have proper setup or install program, it goes back to square one.

I once selected the Adlib sounds in Colonel's Bequest (Sierra Game) when I had 2 sound cards installed - a CT1350B and a CT2760 (SB1.5 & AWE32), and both FM chips started making music.

If the program does not have a utlity or setup to select the proper I/O address of a sound card, :

If it's a PnP card, the PnP utility might help - I'm using the Creative Labs' PnP utility to "shut off" the FM synthesis in my AWE64 Gold card, to route the FM requests to my SB16 CT1740's true Yamaha OPL3 chip.

To "shut off" the said chip, you have to select another "Configuration number" which does NOT have the FM address selection. When this is done, and when the card is initialized with the CTCM program, the PnP card will be given only the parameters of the selected configuration number. Purportedly, this disables the FM synth on the PnP card. You can double check the output when this is done.

Of course, the above is easier to follow if using a PnP card with the Creative's PnP utilities in DOS. In Windows, the same configuration tinkering will help.

i see, yes it searches for 388, but, before Adlibtracker 2 starts, with those 2 sound cards in the PC (CT1350 and CT2230) it can not find OPL3, so it asks me to manually tell it where OPL3 is. I do that by typing -> adtrack2 /a388

By doing that both chips make music. I will try the PnP tool.