Nahid8195

2nd lab ( take input and print the same)

Oct 24th, 2021
783
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  INCLUDE "EMU8086.INC" ; WE INCLUDE THE FUNTION TO USE NEW LINE
  2. .MODEL SMALL   ; IN THIS COURSE ALL MODEL ARE SMALL
  3. .STACK 100H    ; WE ALWAYS USE STACK 100H
  4. .DATA     ; DATA SEGMENT, IF THERE IS NO DATA WE CAN TAKE BLANK OR REMOVE IT
  5. .CODE
  6.  
  7. MAIN PROC       ; MAIN CODE START HERE
  8.    
  9.     ;AS DATA SEGMENT IS BLANK WE DO NOT NEED PROGRAMME SEGMENT PREFIX
  10.      
  11.      
  12.     MOV AH,2   ; WE USE THIS TO PRINT SINGLE CHARACTER
  13.     MOV DL,'?' ; TO PRINT WE MUST MOVE THE CHARACTER TO DL
  14.     INT 21H    ; IT WILL INTRUPT THE WORK. THAT MENAS PAUSE THE CODE AND DO WORK WHAT SAY  ( INT 21H = interrupt handler 0x21 )
  15.    
  16.    
  17.    
  18.     MOV AH,1   ; WE USE THIS TO TAKE INPUT
  19.     INT 21H    ; INTURPT THE COMMAND
  20.     MOV BL,AL  ; IF WE TAKE ANY INPUT IT GOES TO AL, SO WE MOVE AL TO BL. NOW THE INPUT DIGIT IS IN BL, ONE MORE THING L = 8 BIT AND X = 16 BIT. SO WE CAN NOT
  21.     ; MOVE AL = BX, WE CAN USE AX TO BX, BUT NOT AL TO BX
  22.     ; IN MOV THE VALUE OF SECOND VARIABLE WILL TRANASFERED INTO FIRST VARIABLE
  23.    
  24.    
  25.     PRINTN ""  ; WE USE THIS TO TAKE A NEW LINE
  26.    
  27.    
  28.     MOV AH,2   ; WE SE THIS TO PRINT OUR OUTPUT, THIS FUNNTION ARE USED TO PRINT
  29.     MOV DL,BL  ; TO PRINT WE MUST USE DL, SO WE TRANSFER THE VALUE BL TO DL TO PRINT... IF WE PREVIOUSLY USE BX.. HERE WE USE DX,BX
  30.     INT 21H    ; INTRUPT THIS COMMAND
  31.    
  32.    
  33.     MOV AX,4CH ; TERMINATED THE CODE AND EXIT
  34.     INT 21H
  35.     MAIN ENDP
  36. END MAIN  
RAW Paste Data