`
yunchow
  • 浏览: 319793 次
  • 性别: Icon_minigender_1
  • 来自: 南京
社区版块
存档分类
最新评论

江编最后一个程序

DOS 
阅读更多
DATAS SEGMENT
    msg db "Please input text : ",'$'  
    buf db 15
    	db ?
    b2	db 15 dup(?)
        db 13,10,'$'
    result db 13,10,"the result is:",'$'
DATAS ENDS
CODES SEGMENT
    ASSUME CS:CODES,DS:DATAS
START:
    MOV AX,DATAS
    MOV DS,AX
    
    ;;;;;;;;;;; BEGIN ;;;;;;;;;;;;;;;;;
    
    mov ah, 9
    mov dx,offset msg  
    int 21h				;display the msg:Please input:
    
    mov ah, 0ah
    mov dx,offset buf   ;wait for input and save the text to the buf
    int 21h
        
    mov si,offset buf
    inc si
    xor cx,cx
    mov cl,[si]
    
    mov dl,cl
    mov ah,2
    ;int 21h
    
    mov dl,30h
compare:				;loop to compare to 0 and 9
	inc si
	mov al,[si]  
	cmp al,39h			;big than 9
	ja plus
	cmp al,30h			;low than 0
	jb plus 
	jmp again
plus:
    inc dl				;count ++
again:
	loop compare		;loop again
	mov cl,dl
	mov ah,9
	mov dx,offset result
	int 21h				;output information: the result is
	
	mov ah,2
	mov dl,cl
	int 21h				;output the count
	
    ;;;;;;;;;;;;;; END ;;;;;;;;;;;;;;
    
    MOV AH,4CH
    INT 21H				;program exit to dos
CODES ENDS
    END START
0
0
分享到:
评论
1 楼 longleg 2009-06-21  
"江编"?我猜测你是用五笔打字

相关推荐

Global site tag (gtag.js) - Google Analytics