Advertisement
NB52053

Ass lab#6.2

Jul 21st, 2018
314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. org 100h
  2. .stack 100h
  3. .data
  4.  
  5.    
  6. .code
  7.  
  8. onem macro x
  9.     push ax      ; cz AX mirjafor! value chng kore dey -_-
  10.    
  11.     mov dx,x     ;dl dile 8 bit er sthe 16 bit korte jabe! SO ERROR , tai amra eikhne DL na diye DX disi
  12.     mov ah,2
  13.     add dl,'0'
  14.     int 21h
  15.    
  16.     pop ax
  17.    
  18.  endm onem
  19.  
  20.  
  21.  
  22.  
  23.  
  24. main proc
  25. mov dx, @data
  26. mov ds, dx
  27.  
  28.     mov ax, 12345
  29.     call printAX
  30.  
  31.      
  32. mov ah,4ch
  33. int 21h
  34. endp main
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41. printAX proc
  42.    
  43.     mov bx,10
  44.     count db 0
  45.    
  46.    
  47.     L1:
  48.     mov bx,10
  49.    
  50.     xor dx, dx
  51.     div bx ; DX = AX % 10, AX = AX/10
  52.     push dx
  53.     inc count
  54.     cmp ax,0
  55.    
  56.     je L2
  57.     jmp L1
  58.    
  59.     L2:
  60.    
  61.       dec count
  62.       pop dx
  63.       onem dx
  64.       cmp count,0
  65.       je done
  66.       jmp L2
  67.      
  68.      done:
  69.      
  70.      
  71.      
  72.      ret
  73.  
  74.  
  75.  
  76.  
  77.  
  78.    endm printAX
  79.  
  80. end main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement