标志寄存器中的小小练习(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    

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