📄 int21.asm
字号:
; This sample gets a string
; from a user, and prints
; it out.
; It uses INT 21h, so it should
; not be compiled as BIN file!
#make_COM#
; COM file is loaded at 100h
; prefix:
ORG 100H
; set data segment:
MOV AX, CS
MOV DS, AX
MOV ES, AX
; input a string:
MOV DX, OFFSET s1
MOV AH, 0AH
INT 21h
; get one line down,
; by printing new
; line characters:
MOV DX, offset nl
MOV AH, 9
INT 21h
; set '$' to the end of
; inputed string:
MOV DI, offset s1
XOR BX, BX
; second byte of buffer holds
; the number of inputed
; characters:
MOV BL, [DI+1]
MOV BYTE PTR [DI+BX+2], '$'
; print the entered string:
MOV DX, offset s1
; first byte is buffer size,
; second actual characters
; entered, we skip
; these 2 bytes:
ADD DX, 2
MOV AH, 9
INT 21h
; exit to operating
; system:
MOV AH, 4Ch
INT 21h
; data:
s1 DB 30, 30 dup(' ')
nl DB 13, 10, '$'
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -