標誌寄存器中的小小練習(2)

;尋找八個數中8的個數(缺陷:不實用,就是說事先知道數據個數,才能進行這段代碼)
assume cs:code

data segment
      dw 8,11,8,1,8,5,63,38
data ends      

code segment
  start:    
      mov ax,data
      mov ds,ax
      mov di,0
      mov ax,0
      mov bx,8
      mov dx,0
      
      mov cx,8
      call fd
            
   fd:
      mov ax,[di]
      cmp ax,bx
      je count
    
 next:inc di
      inc di
      loop fd 
      
      jmp over
      
   count:   
       inc dx
       jmp next
              
    over:
      mov ax,4c00h
      int 21h    
        
code ends
end start    

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章