From: Friar Broccoli on
Hello;

At this location on the microsoft site:

http://support.microsoft.com/kb/77457

There is this program which allows you to take one letter
keyboard input from a user in a batch file:

DEBUG Executes MS-DOS DEBUG utility
-A 100 Begin assembling instructions at memory
location
100
xxxx:0100 MOV AH,08 Get character input without echo
xxxx:0102 INT 21 Perform MS-DOS service
xxxx:0104 CMP AL,0 Compare AL with zero
xxxx:0106 JNZ 010A If lead zero, get second code of character
xxxx:0108 INT 21 Perform MS-DOS service
xxxx:010A MOV AH,4C Terminate process with return code
xxxx:010C INT 21 Perform MS-DOS service
xxxx:010E <ENTER>
-rcx
CX 0000
:e
-n REPLY.COM
-w
Writing 000E bytes
-q


According to the documenting text the first command

MOV AH,08

Gets character (keyboard?) input WITHOUT echo.


My question is:
Can anybody tell me what I would need to change to get
keyboard input WITH echo?




Dumb useless Note:
As I recall I needed to change "CX 0000" to "CX 000E"
to get this to work, but my memory is pretty bad.


Thanks for any help;

Friar Broccoli
Robert Keith Elias, Quebec, Canada Email: EliasRK (of) gmail * com
Best programmer's & all purpose text editor: http://www.semware.com

--------- I consider ALL arguments in support of my views ---------
From: Friar Broccoli on
My apologies for asking this question:
I just needed to change 08 to 01 and what's worse
I was already getting an echo and removing it with a CLS


On Jan 30, 8:01 am, Friar Broccoli <Elia...(a)gmail.com> wrote:
> Hello;
>
> At this location on the microsoft site:
>
> http://support.microsoft.com/kb/77457
>
> There is this program which allows you to take one letter
> keyboard input from a user in a batch file:
>
>             DEBUG       Executes MS-DOS DEBUG utility
> -A 100                  Begin assembling instructions at memory
> location
> 100
> xxxx:0100   MOV AH,08   Get character input without echo
> xxxx:0102   INT 21      Perform MS-DOS service
> xxxx:0104   CMP AL,0    Compare AL with zero
> xxxx:0106   JNZ 010A    If lead zero, get second code of character
> xxxx:0108   INT 21      Perform MS-DOS service
> xxxx:010A   MOV AH,4C   Terminate process with return code
> xxxx:010C   INT 21      Perform MS-DOS service
> xxxx:010E   <ENTER>
> -rcx
> CX 0000
> :e
> -n REPLY.COM
> -w
> Writing 000E bytes
> -q
>
> According to the documenting text the first command
>
> MOV AH,08
>
> Gets character (keyboard?) input WITHOUT echo.
>
> My question is:
> Can anybody tell me what I would need to change to get
> keyboard input WITH echo?
>
> Dumb useless Note:
>       As I recall I needed to change "CX 0000" to "CX 000E"
>       to get this to work, but my memory is pretty bad.
>
> Thanks for any help;
>
>  Friar Broccoli
>  Robert Keith Elias, Quebec, Canada  Email: EliasRK (of) gmail * com
>  Best programmer's & all purpose text editor:http://www.semware.com
>
>  --------- I consider ALL arguments in support of my views ---------

From: Herbert Kleebauer on
Frank Kotler wrote:

> This 'un doesn't have any asm in it at all, but if you're messing with
> batch files, you might be amused by it...
>
> @echo off
> echo Please enter your name.
> set input=
> fc con nul /lb1 /n|date|find "1:">magic.bat
> echo set input=%%5 %%6 %%7 %%8 %%9>enter.bat
> call magic
> echo Hello %input%!
>
> :cleanup
> del magic.bat
> del enter.bat
> set input=

Better do it the "assembly way", than it also works in XP
(can't find CON ?!?) and is language independent ("enter"):


@echo off
echo BATCH_INPUT___hgQX-PPP_XPPP E#HH0E50EG0Ef0Ehs>myinput.com
echo myinput.bat hoAX5@@PZYh(a)xX5@D3!r/P[WX,b,-PZh>>myinput.com
echo X3!X2ErP,{,{PYX4=0ErWX,j,-PZh@@X3!=set input>>myinput.com

echo Enter your name:
myinput.com
call myinput.bat
echo.
echo Hello %input%
echo.
From: Frank Kotler on
Herbert Kleebauer wrote:

....
> Better do it the "assembly way",

True. Sorry...

> than it also works in XP
> (can't find CON ?!?)

"With both hands?" :)

> and is language independent ("enter"):

The U.N. tried to take a survey, to find out how people felt about food
shortages in other countries. It was a complete failure. Aficands didn't
know what "food" was, Europeans didn't know what "shortages" were, and
Americans didn't know what "other countries" were...

But if you're going to start down *that* road, gotta think about unicode
support!

> @echo off
> echo BATCH_INPUT___hgQX-PPP_XPPP E#HH0E50EG0Ef0Ehs>myinput.com
> echo myinput.bat hoAX5@@PZYh(a)xX5@D3!r/P[WX,b,-PZh>>myinput.com
> echo X3!X2ErP,{,{PYX4=0ErWX,j,-PZh@@X3!=set input>>myinput.com
>
> echo Enter your name:
> myinput.com
> call myinput.bat
> echo.
> echo Hello %input%
> echo.

Not really "assembly language", but composed of entirely printable
machine language. A gem, Herbert!

If we eliminate the requirement for printable characters, and resort to
assembly language (Intel syntax, even), we can come up with a less
cryptic (?) "myinput.com". This is *not* quite the same thing, but seems
to work the same... Nicer puzzle the way you did it! :)

Best,
Frank

org 100h

mov ah, 3Fh
xor bx, bx
mov cx, 127
mov dx, buf
int 21h
mov si, ax

mov ah, 3Ch
mov dx, outfn
xor cx, cx
int 21h
jc exit

mov bx, ax
mov cx, setmsg_len
add cx, si
mov dx, setmsg
mov ah, 40h
int 21h

exit:
ret
outfn db "myinput.bat", 0
setmsg db "set input="
setmsg_len equ $ - setmsg
buf:
; BUFSIZ equ until we run into stack...