www.pudn.com > Demo_asm_80x86.rar > Param2.asm


;****************************************************** 
;* 文件名:Param2.asm 
;* 创建日期:2001.7.16 
;* 作者:陈文尧 
;* 功能:打印命令行中的参数(包括程序名) 
;****************************************************** 
include system.inc 
 
;****************************************************** 
;* 以下代码由汇编专家产生,不要随便修改 
;****************************************************** 
.CODE 
	ifdef __COM__ 
		org	100h 
	endif 
@@Start: 
;------------------------------------------------------ 
; 初始化数据段 
;------------------------------------------------------ 
	InitDS	cs 
;------------------------------------------------------ 
; 调用主函数 
;------------------------------------------------------ 
	call	main 
;------------------------------------------------------ 
; 正常返回DOS 
;------------------------------------------------------ 
	ReturnDos 
 
;++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
;+ 主函数,加入实现程序功能的代码 
;++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
main	proc 
	LibCall		GetArgCount 
	mov			di,ax 
	sub			si,si 
	LibCall		Fill,'0' 
@Next: 
      LibCall		GetArgStr,,si 
      LibCall		Puts, 
      LibCall		PutIntegerEx,si,-02h,0ah 
      LibCall		Puts, 
      LibCall		Puts, 
      LibCall		Crlf 
      inc			si 
      cmp			si,di 
      jb			@Next 
	ret 
main	endp 
 
Msg1		db	'第',00h 
Msg2		db	'个参数是:',00h 
buffer	db	80h dup(?) 
;****************************************************** 
;* 标志程序结束并指定程序入口 
;****************************************************** 
	end	@@Start