Nahid8195

LAB 3 (take 3 intials and print them in left mergin)

Oct 25th, 2021 (edited)
1,133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;   Write a program to (a) prompt the user, (b) read first, middle, and
  2. ;   last initials of a person's name, and (c) display them down the
  3. ;   left margin.
  4. ;   Sample execution:
  5. ;   ENTER THREE INITIALS: JFK
  6. ;   J
  7. ;   F
  8. ;   K
  9.  
  10.  
  11. .MODEL SMALL   ; IN THIS COURSE ALL MODEL ARE SMALL
  12. .STACK 100H    ; WE ALWAYS USE STACK 100H
  13.  
  14.  
  15. .DATA     ; DATA SEGMENT
  16.     STR DB 'ENTER THRRE INITIALS: $'        ; to print the line  we store it on STR
  17.     STR1 DB '',0AH,0DH                      ; we give new line
  18.     FIRST DB ?                              ; here we take a variable where we first number
  19.     STR2 DB '',0AH,0DH                      ; here also we give a new line
  20.     SECOND DB ?                             ; here we take a variable where we second number      
  21.     STR3 DB '',0AH,0DH                      ; here also we give a new line
  22.     THIRD DB ?                              ; here we take a variable where we third number
  23.     STR4 DB '$'                             ; here we use $ to end the string
  24.    
  25.    
  26.    
  27. .CODE    ; main code start here
  28.    
  29.     MAIN PROC
  30.     ;PROGRAMME SEGMENT PREFIX
  31.     MOV AX,@DATA
  32.     MOV DS,AX    ; INITILATION OF DS
  33.  
  34.     MOV AH,9     ; the function will use to print string
  35.     LEA DX,STR   ; this print the str value
  36.     INT 21H      ; make this computer to do
  37.  
  38.     MOV AH,1     ; this will use to take input
  39.     INT 21H      ; make this work to get input
  40.     MOV FIRST,AL ; this will take 1st input and store it on first variable
  41.     INT 21H      ; make computer to do this
  42.     MOV SECOND,AL ; this will take 1st input and store it on second variavle
  43.     INT 21H      ; make computer to do this
  44.     MOV THIRD,AL  ; this will take 1st input and store it on third varible
  45.  
  46.     MOV AH,9     ; the function will use to print string
  47.     LEA DX,STR1  ; this print the str1 value
  48.     INT 21H      ; make computer to do this
  49.  
  50.     MOV AH,4CH   ; TERMINATED THE CODE AND EXI
  51.     INT 21H
  52.  
  53.     MAIN ENDP
  54. END MAIN
Add Comment
Please, Sign In to add comment