<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 匯編程序:統(tǒng)計(jì)一個(gè)字符串里數(shù)字的個(gè)數(shù)(初級版)

          匯編程序:統(tǒng)計(jì)一個(gè)字符串里數(shù)字的個(gè)數(shù)(初級版)

          作者: 時(shí)間:2016-12-01 來源:網(wǎng)絡(luò) 收藏
          DATAS SEGMENT
          sum db 2 dup(?);此處輸入數(shù)據(jù)段代碼
          string db 25 dup(?);存放字符
          tital db Thisprogramis made by wq. ,0dh,0ah
          db PLease input the string: ,$
          overs db Amout of the nember is : ,$
          DATAS ENDS
          STACKS SEGMENT
          ;此處輸入堆棧段代碼
          STACKS ENDS
          CODES SEGMENT
          ASSUME CS:CODES,DS:DATAS,SS:STACKS
          START:
          MOV AX,DATAS
          MOV DS,AX
          mov ax,offset tital
          mov dx,ax
          mov ah,09h
          int 21h
          mov cl,25
          mov si,0
          mov ax,offset string
          mov dx,ax
          again: ;輸入字符
          mov ah,01h
          int 21h
          cmp al,0dh
          jz then
          mov string[si],al
          inc si
          dec cl
          jnz again
          then:
          mov ax,offset string
          mov dx,ax
          mov si,0
          mov bl,0
          mov cx,6
          exchang:
          cmp cx,0
          jz over
          cmp string[si],30h
          jnb next
          inc si
          dec cx
          jmp exchang
          next:
          cmp string[si],39h
          jle calculator
          inc si
          dec cx
          jmp exchang
          calculator:
          inc si
          incbl
          dec cx
          jmp exchang
          over:
          lea ax,overs
          mov dx,ax
          mov ah,09h
          int 21h

          mov ax,offset sum
          mov dx,ax
          mov sum[0],bl
          add sum[0],30h
          mov sum[1],$
          mov ax,offset sum
          mov dx,ax
          mov ah,09h
          int 21h
          MOV AH,4CH
          INT 21H
          CODES ENDS
          END START

          這里是本程序的完善版:http://www.51hei.com/mcu/2466.html

          本文引用地址:http://www.ex-cimer.com/article/201612/324152.htm


          關(guān)鍵詞: 匯編程序字符串初級

          評論


          技術(shù)專區(qū)

          關(guān)閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();