利用匯編語言編程實現屏幕上輸出十進制數字00-29功能

利用匯編語言編程實現屏幕上輸出十進制數字00-29功能

stack segment stack

   db 64 dup(?)

stack ends

code segment

   assume cs:code

start: mov dl,0dh

       mov ah,2

       int 21h

       mov dl,0ah

       int 21h

       mov bl,0

next: mov al,bl

      mov cl,4

      shr al,cl    ;右移四位,將後四位消去,只處理前四位

      or al,30h   ;將其轉爲相應的ASCII碼。

      mov dl,al

      mov ah,2

      int 21h

      mov dl,bl

      and dl,0fh   ; 前四位置零,只處理後四位

      or dl,30h    ; 轉換爲ASCII碼。

      mov ah,2

      int 21h

      mov al,bl

      inc al

      daa         ; 補足進位。

      cmp al,30h   ;用來設置終止值,該程序中爲30h

      jnc finish

      mov bl,al

      mov cx,0fffh

delay:loop delay

      jmp next

finish: mov ah,4ch

        int 21h

      code ends

      end start


來源:心傾城的網易博客
歡迎分享本文,轉載請保留出處!
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章