這個DOS軟件中斷需要一個輸入緩衝區。
; Example using Microsoft Macro Asssembler (MASM)
.MODEL small
.STACK 100h
.DATA
BUFF DB 20
ACTR DB ?
ASCII 20 dup DB ("$")
DB "$" ; We needd to have one "$" for print function.
.CODE
START:
MOV AX, @DATA
MOV DS, AX
MOV AH, 0Ah ; Function 0Ah Buffered input
MOV DX, OFFSET BUFF ; ds:dx points to string buffer
INT 21h
MOV AH, 9 ; Print to output device
MOV DX, OFFSET ASCII ; ds:dx points to string
INT 21h
MOV AX, 4C00h ; Return to DOS with ERRORLEVEL=0
INT 21h
END START
-
Ralf Browns x86/MSDOS Interrupt List(RBIL)
http://www.pobox.com/~ralf
http://www.pobox.com/~ralf/files.html
ftp://ftp.cs.cmu.edu/afs/cs.cmu.edu/user/ralf/pub/
inter61b.zip->INTERRUP.F
--------D-210A-------------------------------
INT 21 - DOS 1+ - BUFFERED INPUT
AH = 0Ah
DS:DX -> buffer (see #01344)
Return: buffer filled with user input
Notes: ^C/^Break are checked, and INT 23 is called if either detected
reads from standard input, which may be redirected under DOS 2+
if the maximum buffer size (see #01344) is set to 00h, this call returns
immediately without reading any input
SeeAlso: AH=0Ch,INT 2F/AX=4810h
Format of DOS input buffer:
Offset Size Description (Table 01344)
00h BYTE maximum character buffer can hold
01h BYTE (call) number of chars from last input which may be recalled
(ret) number of characters actually read, excluding CR
02h N BYTEs actual characters read, including the final carriage retur
感謝然而建議,並沒有完全回答我的問題... – user2961971 2014-10-27 21:57:38
是啊我很抱歉我不能回答你的問題,但我想只是幫助你。 @ user2961971 – JohnS 2014-10-27 22:15:59
你的代碼應該可以工作,只要你在一個可以運行DOS的環境中(可能是一個模擬器,如今是DosBox或其他)。您必須提供Dirk和Ralf顯示的緩衝區。你爲什麼認爲這不起作用? – 2014-10-28 03:04:18