Advertisement
Nahid8195

Lab test question 2

Oct 30th, 2021
3,070
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; reverse 5 input
  2. INCLUDE "EMU8086.INC"    ; this function is used to take new line
  3. .MODEL SMALL   ; IN THIS COURSE ALL MODEL ARE SMALL
  4. .STACK 100H    ; WE ALWAYS USE STACK 100H
  5.  
  6.  
  7. .DATA     ; DATA SEGMENT
  8.  
  9.  SN_NUM1 DB ?  ; assign a variable where store first input
  10.  SN_NUM2 DB ?  ; same second input
  11.  SN_NUM3 DB ?  ; same third
  12.  SN_NUM4 DB ?  ; fourth input
  13.  SN_NUM5 DB ?  ; fifth input
  14.  
  15.  
  16. .CODE
  17.  
  18. MAIN PROC       ; MAIN CODE START HERE
  19.    
  20.  
  21.                      
  22.     MOV AH,1           ; this function is used to take single bit input
  23.     MOV SN_NUM1,AL     ; we move the input input num1
  24.     INT 21H            ; this will take input
  25.     MOV SN_NUM2,AL
  26.     INT 21H
  27.     MOV SN_NUM3,AL
  28.     INT 21H
  29.     MOV SN_NUM4,AL
  30.     INT 21H
  31.     MOV SN_NUM5,AL      ; by the same process we take our 5 input
  32.     INT 21H
  33.    
  34.     PRINTN ""         ; this function is used to give a new line
  35.    
  36.     MOV AH,2          ; this ah,2 is used to print signle input
  37.     MOV DL,SN_NUM5    ; as we want reverse we first print num5
  38.     INT 21H           ; this will print number 5
  39.     MOV DL,SN_NUM4
  40.     INT 21H
  41.     MOV DL,SN_NUM3
  42.     INT 21H
  43.     MOV DL,SN_NUM2
  44.     INT 21H
  45.     MOV DL,SN_NUM1   ; same process we print all input by reverse num5,num4,num3,num2,num1
  46.     INT 21H
  47.    
  48.    
  49.      
  50.    
  51.     MOV AX,4CH ; TERMINATED THE CODE AND EXIT
  52.     INT 21H
  53.     MAIN ENDP
  54. END MAIN
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement