DOS程序退出方法

1.psp

 

代码
DATAS SEGMENT
msg db
'HELLO WORLD',13,10,'$'
DATAS ENDS
STACKS SEGMENT
dw
10 dup(0)
STACKS ENDS

CODES SEGMENT
ASSUME
CS:CODES,SS:STACKS
MAIN PROC FAR
START:
PUSH ES
XOR AX,AX
PUSH AX
MOV AX,DATAS
MOV DS,AX
MOV DX,OFFSET msg
MOV AH,9
INT 21H
RET
MAIN ENDP
CODES ENDS
END START

2.ret/retf

 

代码
DATAS SEGMENT
msg db
'HELLO WORLD',13,10,'$'
DATAS ENDS
STACKS SEGMENT
dw
16 dup(0)
STACKS ENDS

CODES SEGMENT
ASSUME
CS:CODES,SS:STACKS
MOV AX,4C00H
INT 21H
START:
MOV AX,STACKS
MOV SS,AX
SUB SP,10
PUSH CS
XOR AX,AX
PUSH AX
MOV AX,DATAS
MOV DS,AX
MOV DX,OFFSET msg
MOV AH,9
INT 21H
RETF;RET
CODES ENDS
END START

 

posted @ 2010-12-16 21:33  Jekhn  阅读(566)  评论(0编辑  收藏  举报