• Please review our updated Terms and Rules here

CHOICE in MS DOS 2.11?

khaz

Experienced Member
Joined
Sep 20, 2017
Messages
96
I would like to have a multiple choice menu when I start a floppy, and I would also take advantage of the fast boot offered by the TANDY 1000 and its DOS in ROM. Unfortunately, that DOS is 2.11 and so far everything I tried failed, presumably because that version is so old and basic.

CHOICE.COM, as provided in MS-DOS 6.22, refuses to work with a DOS older than 4.0
CONFIG.SYS menu options works from 5.0 onwards
SET /P needs Windows XP (!)

How would you do a (rudimentary) menu using only the built-in tools from DOS 2.11?
 
How would you do a (rudimentary) menu using only the built-in tools from DOS 2.11?

You don't, as DOS 2.x doesn't contain what you need. You need a helper program to ask the user for input and return ERRORLEVEL based on that input, which you can then branch from. In the past, I've used a program called ASK.COM from TifaWARE, with batch files that look like this:

Code:
:MENUSTART
cls
type action.txt
ask -t120 Type a number to pick a game:

if ERRORLEVEL 54 goto ALLEYCAT
if ERRORLEVEL 53 goto STARGLIDER
if ERRORLEVEL 52 goto THEXDER
if ERRORLEVEL 51 goto SILPHEED
if ERRORLEVEL 50 goto PERSIA
if ERRORLEVEL 49 goto BABIES
if ERRORLEVEL 0 goto MENUEND

:BABIES
echo Loading Bouncing Babies...
bbabies\baby
goto MENUSTART

:PERSIA
echo Loading Prince of Persia...
cd persia
prince
cd ..
goto MENUSTART

:SILPHEED
echo Loading Silpheed...
cd silpheed
sierra
cd ..
goto MENUSTART

:THEXDER
echo Loading Thexder...
cd thexder
thexder
cd ..
goto MENUSTART

:STARGLIDER
echo Loading Star Glider...
cd starglid
sglider
cd ..
goto MENUSTART

:ALLEYCAT
echo Loading Alley Cat...
alleycat\cat
goto MENUSTART

:NOTHING
echo Loading Nothing...
cd nothing
nothing
cd ..
goto MENUSTART


:MENUEND
REM go back to main games menu
games.bat

Your other option is to just create batch files called 1.bat, 2.bat, 3.bat, etc. that launch the game you want, and you can present a "menu" by TYPEing out a text file that says "1. Archon 2. Chess" etc.
 
Thanks, ASK.COM is a perfect replacement for CHOICE.COM!

I've been wondering, why do "if errorlevel" need to be sorted from high to low? it's also a thing with CHOICE where if doesn't work from low to high, but I don't get why.
 
I've been wondering, why do "if errorlevel" need to be sorted from high to low? it's also a thing with CHOICE where if doesn't work from low to high, but I don't get why.

Because the "IF ERRORLEVEL x" test in DOS isn't an equality test: the condition is true if the program's return code is x *or greater*. So if ASK.COM returned 50, and you started your tests from "IF ERRORLEVEL 0" (or anything else less than 50), the first test would succeed and it'd branch immediately. If you arrange your tests in descending order, that doesn't happen.

A bit unintuitive perhaps, but I guess that's why they called it an "errorlevel" and not an "errorcode"...
 
Because the "IF ERRORLEVEL x" test in DOS isn't an equality test: the condition is true if the program's return code is x *or greater*. So if ASK.COM returned 50, and you started your tests from "IF ERRORLEVEL 0" (or anything else less than 50), the first test would succeed and it'd branch immediately. If you arrange your tests in descending order, that doesn't happen.

A bit unintuitive perhaps, but I guess that's why they called it an "errorlevel" and not an "errorcode"...

Somehow this reminds me of the One Instruction Set Computer (OISC), or how to build a Turing-complete computer with just a single instruction:
https://en.wikipedia.org/wiki/One_instruction_set_computer

The 'greater or equal' (or related, 'less or equal', 'greater' or 'less') test is more powerful than just a test for equality.
 
Back
Top