Guest User

Untitled

a guest
Feb 17th, 2016
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .8086
  2.  
  3. cseg segment
  4.     assume cs:cseg
  5.     org 100h
  6. start:
  7.     mov ax, 12345
  8.     mov cx, 10
  9.     mov di, offset digit
  10.     call WToAscii
  11.     mov [di], byte ptr 0Dh
  12.     inc di
  13.     mov [di], byte ptr 0Ah
  14.     inc di
  15.     mov [di], byte ptr '$'
  16.     mov dx, offset digit
  17.     mov ah, 9h
  18.     int 21h
  19.     mov ah, 4ch
  20.     int 21h
  21. WToAscii proc near
  22.     xor dx, dx
  23.     div cx
  24.     or ax, ax
  25.     jz done
  26.     push dx
  27.     call WToAscii
  28.     pop dx
  29. done:
  30.     mov al, dl
  31.     or al, '0'
  32.     mov [di], al
  33.     inc di
  34.     ret
  35. WToAscii endp
  36.  
  37. digit BYTE 10 dup(?)
  38. cseg ends
  39. end start
Advertisement
Add Comment
Please, Sign In to add comment