VOGONS


First post, by verelse

User metadata
Rank Newbie
Rank
Newbie

Int 21h function 01h does not echo input characters to the console. I built the attached TASM code using Turbo Assembler 5.0 under DOSBox 0.72 on these machines:

Dell D630, Windows XP 64 bit, sp3, 4GB RAM, Quadro NVS 135 128MB.
Dell Precision 490, Dual Xeon Dual-Core 3.2, 24GB RAM, Vista 64-bit
Dell GX270 P4 HT, 2GB DDR2 RAM, Intel GMA cruddy video card

Got same results, no echo from function 1 int 21h. Compiled under MS-DOS 6.22 running on Compaq Deskpro XL Pentium Pro 200 MHz with 64MB RAM, under MS-DOS 6.22 on VMWare Workstation 6 and Virtual PC 7 got correct results, echo'd characters from function 1.

I am aware I can workaround this, but this function is fairly integral to DOS and was even inherited from CP/M if I remember rightly.
Can't seem to get attachment to work so including code below.


;--------------------------------------------------------------------
; program: echoout
; function: reads until nothing left or eof char
; owner: *****
; date: changes
; 1998/04/15 original version
;--------------------------------------------------------------------
ideal ;use turbo ideal mode
model small ;64k code and 64k data
p8086 ;only allow 8086 instructions
stack 256 ;reserve 256 bytes for the stack
;---------------------------------------
dataseg ;start the data segment
;---------------------------------------
eof_char db 1ah ;byte variable dos eof char
;---------------------------------------
codeseg ;start the code segment
;---------------------------------------
start: ;
mov ax,@data ;establish addressability to the
mov ds,ax ;data segment for this program
;---------------------------------------
; do the dew before the dew does you
;---------------------------------------
dowhile: mov ah,0bh ;set int 21h function check buffer
int 21h ;check for character in stream
cmp al,00h ;check for lack of data
je exit ;term on no data
mov ah,01h ;set int 21h function read w echo
int 21h ;ask dos for character from stream
cmp al,[eof_char] ;is character eof?
je exit ;term on eof character
jmp dowhile ;
;---------------------------------------
; terminate program execution
;---------------------------------------
exit: ;
mov ax,4c00h ;set dos code to terminate
int 21h ;return to dos
end start ;mark the end of the source code
;....specify start execution
;---------------------------------------


Reply 2 of 6, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

The way this program is written seems to imply redirected input (e.g. echoout < somefile) because it will immediately exit if there is no input pending (INT 21/0B). I tried it, and INT 21/01 is not echoing under redirected input, however it does echo without redirected input (typing on the keyboard).

Reply 4 of 6, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

I think no game relies on that echo thing through redirection. So I can live with it.

Water flows down the stream
How to ask questions the smart way!

Reply 5 of 6, by verelse

User metadata
Rank Newbie
Rank
Newbie

You are right, the code is designed to work with redirected input, con works fine, I should have been more clear.
Int 21h 01h is not a console function, it is an input function and it should work with redirected input. I imagine you are right, no games need this functionality at least from redirect. I just noticed it building some assembler libraries in DOSBox that long used code did not work. DOSBox is not just for games, though, or is it?
I can modify my lib by reading without echo then writing the character, in other words just manually echoing input. I am sure I am out of the ordinary in wanting to do something besides play games with DOSBox. I use it to run legacy code on x64 Windows systems, but I can go back to VMWare. DOSBox is just so fast and friendly and sharing the same file system is sweet.

Thanks for your time, guys.