Journal clone53421's Journal: 80x86 command-line utility... similar to MORE/PAUSE
This utility echoes all its piped input, then it displays "Press any key to continue. .
Why did I write it? Well, I wanted it. Plus, it was a good chance to figure out some stuff that had been bugging me about piped input in DOS. First of all, I detect whether the input was redirected (and jump directly to the exit if it wasn't). Next, I discovered that I needed to enter an idle loop to wait for the input to be ready. Finally, I was unable to find any method of properly detecting an EOF on the input stream, but on a hunch I assumed that the input stream would be full and as soon as the read failed I was done. I don't know if it's "right", but it appears to work. (Note: empty input streams will cause it to hang, e.g. del *.*
Copy, paste into Notepad, save as "wait_asm.bat", and execute. It will create an executable, wait.com, which can be used like this:
dir | wait
...which will display the directory listing followed by "Press any key to continue. .
If you want to be able to use the wait utility like any other DOS command (from any directory), move it into the C:\Windows\system32\ folder (where the rest of the DOS command-line utilities are located).
@echo off
goto batch
a
MOV AX,4400
XOR BX,BX;device 0 = input
INT 21;get device info
AND DX,1;check for standard input
JNZ 011f;_exit
MOV AH,06
MOV DL,FF
;_begin
INT 21;get next character from buffer
JZ 0111;_begin
;_getch
MOV DL,AL
INT 21;print the character
MOV DL,FF
INT 21;get next character from buffer
JNZ 0115;_getch
;_exit
MOV AH,09
MOV DX,0134;_msg
INT 21
;_wait
MOV AH,01
INT 16;see if a key was pressed
JZ 0126;_wait
XOR AH,AH
INT 16;remove the keystroke from the buffer
MOV AH,4C
INT 21;DOS %errorlevel% = ASCII code of key
;_msg
DB "Press any key to continue. ..$"
;ASCIIZ
db "wait.com",0
;compile
MOV AX,CS
MOV DS,AX
MOV AH,3C
XOR CX,CX
MOV DX,0153;ASCIIZ
INT 21
MOV BX,AX
MOV CX,0153;ASCIIZ
MOV DX,0100;where the program starts
SUB CX,DX
MOV AH,40
INT 21
MOV AH,3E
INT 21
MOV AX,4c01
INT 21
r ip
15c
g
q
:batch
if exist %0 goto extension
debug<%0.bat>nul
goto done
:extension
debug<%0>nul
:done
echo Done.|wait.com
80x86 command-line utility... similar to MORE/PAUSE More Login
80x86 command-line utility... similar to MORE/PAUSE
Slashdot Top Deals