Advertisement
Masum6035

For Foysal

Apr 26th, 2021
1,234
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;id - 201914044         solution_of_problem-3
  2. .model small   
  3. .stack 100h    
  4. include 'emu8086.inc'
  5.  
  6. .data
  7.  
  8. n_line db 0ah,0dh,"$"   ;for new line  
  9. msg1 db "Input: $"
  10. msg2 db 10,13,"Output: $"
  11. num db 0h
  12. var dw ?
  13. count db 0d
  14. .code
  15.  
  16. main proc
  17.     mov ax,@data   
  18.     mov ds,ax
  19.     xor bx,bx
  20.    
  21.     lea dx,msg1
  22.     mov ah,9
  23.     int 21h  
  24. @input:    
  25.     mov ah,1
  26.     int 21h
  27.     cmp al,0Dh ;cheking for enter
  28.     je @output
  29.    
  30.     mov bx,ax
  31.     push bx    ;now stack pointer will increase 2 step    
  32.     inc count
  33.     jmp @input  
  34.    
  35. @output:
  36.     lea dx,msg2
  37.     mov ah,9
  38.     int 21h      
  39.  
  40. @inside_output:
  41.      cmp count,0d
  42.      je @stop
  43.      
  44.      pop bx
  45.      mov dx,bx
  46.      mov ah,2
  47.      int 21h
  48.      
  49.      dec count
  50.      jmp @inside_output
  51.        
  52. @stop:    
  53.     mov ah,4ch
  54.     int 21h     ;terminate with return code
  55. main endp
  56. end main
Advertisement
RAW Paste Data Copied
Advertisement