Advertisement
Nahid8195

2nd lab ( Take input in small letter and print Capital letter)

Oct 24th, 2021
2,857
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. .MODEL SMALL   ; IN THIS COURSE ALL MODEL ARE SMALL
  3. .STACK 100H    ; WE ALWAYS USE STACK 100H
  4.  
  5.  
  6. .DATA     ; DATA SEGMENT
  7. CR EQU 0DH   ; MAKE ODH IN CF.. IF WE NEED ODH WE CAN CALL IT USING CR,   CR = ODH
  8. LF EQU 0AH   ; SAME ALSO WE CAN USE OAH BY LF,   LF = OAH
  9.  
  10. MSG1 DB "Enter a Lowwer Case: $"    ; DB - Define Byte. 8 bits,   DW - Define Word. Generally 2 bytes on a typical x86 32-bit system
  11.                          ; $ SIGN IS USE TO END THE STING. IT HELP TO FIND THE STRING ENDING
  12. MSG2 DB CR,LF,"In upper case it is: "   ; WE DO NOT GIVE $ BECAUSE WE WANT TO PRINT THE UPPER CASE ALSO
  13.                                         ; WE USE CR,LF TO PRINT A NEW LINE AFTER 1ST STRING END
  14. RESULT DB ?, "$"  ; WE USE $ SIGN HERE TO PRINT THIS ALO                        
  15.  
  16.  
  17.  
  18.  
  19. .CODE
  20.  
  21. MAIN PROC       ; MAIN CODE START HERE
  22.    
  23.     ;PROGRAMME SEGMENT PREFIX
  24.     MOV AX,@DATA
  25.     MOV DS,AX    ; INITILATION OF DS
  26.    
  27.    
  28.      
  29.      LEA DX,MSG1   ; FOR STRING PRINT WE USE LEA FUNCTION TO LOAD THE STRING ; [FULL MEANING LEA : LOAD EFFICIENT ADRESS]              
  30.      MOV AH,9     ; FOR STRING PRINT WE USE AH,9 WHICH PRINT MY LOADED STRINT WHICH WAS MSG
  31.      INT 21H      ; IT WILL INTRUPT THE WORK.
  32.      
  33.      
  34.      MOV AH,1       ; IT WILL TAKE INPUT A LOWER CASE
  35.      INT 21H        ; THE WORL WILL DONE HERE
  36.      SUB AL,20H     ; IN ASCII CODE LOWER LETTER VALUE - 20 = UPPER LETTER,  SO WE MINIUS 20 FROM INPUT VALUE
  37.      MOV RESULT,AL  ; NOW MOVE THE UPPER CASE VALUE IN RESULT. RESULT CONTAIN NOW THE UPPER CASSE OF THE INPUT
  38.    
  39.      
  40.      
  41.      LEA DX,MSG2   ; NOW LOAD SECOND STRING  TO PRINT
  42.      MOV AH,9      ; IT WILL PRINT THE STRING
  43.      INT 21H       ; MAKE THE COMPUTER TO DO IT
  44.      
  45.      
  46.    
  47.     MOV AX,4CH ; TERMINATED THE CODE AND EXIT
  48.     INT 21H
  49.     MAIN ENDP
  50. END MAIN                                                        
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement