正文

汇编2006-11-23 17:29:00

【评论】 【打印】 【字体: 】 本文链接:http://blog.pfan.cn/hammers/20676.html

分享到:

从键盘读入一个字符串(<80),统计字母,数字及其他字符的个数     datasegment   segment array     db  80          db  ?          db  80 dup(?)datacount      db  0wordcount      db  0othercount     db  0out1      db  'datacount:','$'out2      db  'wordcount:','$'out3      db  'othercount:','$'datasegment   ends codesegment   segment         assume   ds:datasegment,cs:codesegment start:       mov  ax,datasegment       mov  ds,ax       lea  dx,array       mov  ah,0ah       int  21h       mov  si,2       mov  cl,array[1]       mov  ch,0 next: mov  bl,array[si]       cmp  bl,30h         jae  next1       jmp  other next1:       cmp  bl,39h       jbe  data       cmp  bl,60h       jbe  other       cmp  bl,5Ah       jbe  words       cmp  bl,60h       jbe  other       cmp  bl,7Ah       jbe  words       jmp  other data:       add  datacount[0],1       jmp   done other:       add  othercount[0],1       jmp   done words:       add  wordcount[0],1       jmp  done  done:        inc si        loop  next                lea  dx,out1        mov  ah,9        int  21h        mov  bl,datacount        mov  bh,0        call progdec        mov  dl,';'        mov  ah,2        int  21h         lea  dx,out2        mov  ah,9        int  21h        mov  bl,wordcount        mov  bh,0        call progdec        mov  dl,';'        mov  ah,2        int  21h           lea  dx,out3        mov  ah,9        int  21h        mov  bl,othercount        mov  bh,0        call progdec        mov  dl,';'        mov  ah,2        int  21h                   mov ah,4ch      int 21h    progdec  proc    push ax push dx push bx  mov dl,100 mov ax,bx div dl cmp al,0 jne  hundred    mov ax,bx    mov dl,10    div dl    cmp al,0    jne  ten    mov dl,bl    add dl,30h    mov ah,2    int 21h    jmp exit    ten:   mov dl,al   add dl,30h   mov bx,ax   mov ah,2   int 21h   mov dl,bh   add dl,30h   mov ah,2   int 21h   jmp exit          hundred:     mov dl,al     mov bx,ax     add dl,30h     mov ah,2     int 21h     mov ah,bh     mov al,ah     mov ah,0     mov dl,10     div dl     mov dl,al     add dl,30h     mov bx,ax     mov ah,2     int 21h     mov dl,bh     add dl,30h     mov ah,2     int 21h     jmp exitexit:    mov dl,' '    mov ah,2    int 21h     pop bx     pop dx     pop ax     ret progdec endp codesegment  ends      end start      

阅读(2130) | 评论(1)


版权声明:编程爱好者网站为此博客服务提供商,如本文牵涉到版权问题,编程爱好者网站不承担相关责任,如有版权问题请直接与本文作者联系解决。谢谢!

评论

loading...
您需要登录后才能评论,请 登录 或者 注册