Category : Batch File Utilities - mostly for DOS
Archive   : BATQUES.ZIP
Filename : BATQUES.ASM

 
Output of file : BATQUES.ASM contained in archive : BATQUES.ZIP
page 64,132
title bat-ques -- Batch file Question Asker, sets errorlevel
.RADIX 10
;
;
;
;*****************************************************************
; INFO-IBMPC libarary contribution by H. Fischer - HFischer@eclb 12/83
; If you like it, do not send me $10 (but I will accept amounts
; with many more zeros if your generosity is excessive).
; Questions/problems to HFischer@eclb (213/902-5139).
;
; This program allows a batch file to ask the user a question
; and return a one-character response which is testable
; by the IF subcommand of bat files, via the errorlevel.
;
; You use the question asker per following example:
;
; .
; . (your batch file to ask if guy wants to edit with
; . mince/emacs or ibm's editor)
; .
; echo off
; bat-ques WHICH EDITOR, m OR e FOR MINCE (EMACS), i FOR IBM's? $
; if errorlevel 110 goto badresp
; if errorlevel 109 goto minceed
; if errorlevel 106 goto badresp
; if errorlevel 105 goto ibmed
; if errorlevel 102 goto badresp
; if errorlevel 101 goto minceed
; :badresp
; echo Your response was invalid. Sorry
; goto endit
; :minceed
; if not exist mincomm.sum copy \bin\mince.swp mince.swp
; mince %1
; if not exist mincomm.sum del mince.swp
; goto endit
; :ibmed
; profed %1
; :endit
; echo on
;
; Note that the question prompt follows the bat-ques command and
; must end with a dollar sign. The ascii value of the response is
; returned as the error level. Since error level tests are always
; greater than or equal tests, you must check for highest value first
; and lowest value last. Example above shows what you doto check for
; missing values. Note example assumes lower case answer only for
; simplicity sake.
;
; Ascii values (e.g., A is 65, B is 66, a is 97) are found in back
; of your BASIC manual. Only one character responses are accepted,
; and they are not followed by a carriage return.
;
; Extended ascii codes (function and alt keys) should work as per
; page G-6 of your BASIC manual; the first call to bat-ques will
; return a zero and the next call (presumably "bat-ques $" without
; another prompt) will return the number shown on page G-7.
;
; To build this program:
; 1) asm bat-ques
; 2) link bat-ques
; 3) exe2bin bat-ques.exe \bin\bat-ques.com (name your path dir!)
; 4) del bat-ques.exe
;
; have fun
;********************************************************************
code segment para
assume cs:code
org 82h
PROMPT label byte ; here DOS places the prompt string
org 100h
KEY proc far
START:
mov ax,cs ; make this mess addressable via ds
mov ds,ax
assume ds:code
mov dx,offset PROMPT
mov ah,9
int 21h ; display the prompt
mov ah,1
int 21h ; get the input into AL
mov saveit,al
mov dx,offset newlin ; move display to new line
mov ah,9
int 21h
mov al,saveit
mov ah,4ch ; return the errorlevel already in AL
int 21h
newlin: db 10,13,'$' ; give user a new line before quitting
saveit db 0
KEY endp
code ends
end start


  3 Responses to “Category : Batch File Utilities - mostly for DOS
Archive   : BATQUES.ZIP
Filename : BATQUES.ASM

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/