Upper converstion lower case Assembly Language Lab report

Upper converstion lower case Assembly Language Lab report

Experiment No:
(i)
Experiment Name: OR Gate Logic (An assembly program that can convert an upper case string to a lower case string).
Objectives: To be able to convert an uppercase string to a lower case string.
Apparatus: MICROPROCESSOR EMULATOR 8086, Computer etc
Introduction: The OR gate gets its name from the fact that it behaves after the fashion of the logical inclusive "or." The output is "true" if either or both of the inputs are "true." If both inputs are "false," then the output is "false." In other words, for the output to be 1, at least input one OR two must be 1.
These instructions are used to perform operations where data bits are involved, i.e. operations like logical, shift, etc. We can say that these instructions are logical instructions. In 8086, the destination register may or may not the Accumulator.
Let us see the logical instructions of 8086 microprocessor. Here the D, S and C are destination and source and count respectively. D, S and C can be either register, data or memory address.

Opcode                   
OR
                     

Operand
 D,S

Description
Used to multiply each bit in a byte/word with the corresponding bit in another byte/word.

Procedure:
1. Create: open emu8086 write a program after that save the program with .asm extension.
2. Compile: Emulator
3. Execute: Run
Code: 

1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35

.MODEL SMALL
 .STACK 100H

 .DATA
    PROMPT_1  DB  'Enter the Upper Case Letter : $'
    PROMPT_2  DB  0DH,0AH,'The Lower Case Letter is : $'

 .CODE
   MAIN PROC
     MOV AX, @DATA               
     MOV DS, AX

     LEA DX, PROMPT_1            
     MOV AH, 9
     INT 21H

     MOV AH, 1                   
     INT 21H

     MOV BL, AL                   

     LEA DX, PROMPT_2            
     MOV AH, 9
     INT 21H

     OR BL, 20H                 

     MOV AH, 2                  
     MOV DL, BL
     INT 21H

     MOV AH, 4CH                 
     INT 21H
   MAIN ENDP
 END MAIN


Result:

Conclusion: The program code of converting upper case to lower case string works successfully.


ii)
Experiment Name: XOR Gate Logic (An assembly program that can reverse an upper case string to a lower case string or a lower case string to an upper case string).
Objectives: To be able to reverse an uppercase string to a lower case string or a lower case string to an upper case string.
Apparatus: MICROPROCESSOR EMULATOR 8086, Computer etc
Introduction: The XOR ( exclusive-OR ) gate acts in the same way as the logical "either/or." The output is "true" if either, but not both, of the inputs are "true." The output is "false" if both inputs are "false" or if both inputs are "true." Another way of looking at this circuit is to observe that the output is 1 if the inputs are different, but 0 if the inputs are the same.
In computer programming, the exclusive or swap (sometimes shortened to XOR swap) is an algorithm that uses the exclusive or bitwise operation to swap the values of two variables without using the temporary variable which is normally required.
Opcode

XOR

Operand
D,S

Description

Used to perform Exclusive-OR operation over each bit in a byte/word with the corresponding bit in another byte/word.



Procedure:
1. Create: open emu8086 write a program after that save the program with .asm extension.
2. Compile: Emulator
3. Execute: Run
Code: 

1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35

.MODEL SMALL
 .STACK 100H

 .DATA
    PROMPT_1  DB  'Enter the Upper Case Letter : $'
    PROMPT_2  DB  0DH,0AH,'The Lower Case Letter is : $'

 .CODE
   MAIN PROC
     MOV AX, @DATA               
     MOV DS, AX

     LEA DX, PROMPT_1            
     MOV AH, 9
     INT 21H

     MOV AH, 1                   
     INT 21H

     MOV BL, AL                   

     LEA DX, PROMPT_2            
     MOV AH, 9
     INT 21H

     XOR BL, 20H                 

     MOV AH, 2                  
     MOV DL, BL
     INT 21H

     MOV AH, 4CH                 
     INT 21H
   MAIN ENDP
 END MAIN


Result:

Conclusion: The program code of reverse upper case to lower case or lower case to uppercase string works successfully.


(iii)
Experiment Name: AND Gate Logic (An assembly program that can convert a lower case string to an upper case string).
Objectives: To be able to convert a lower case string to an upper case string.
Apparatus: MICROPROCESSOR EMULATOR 8086, Computer etc
Introduction: An AND gate is an electrical circuit that combines two signals so that the output is on if both signals are present. The output of the AND gate is connected to a base driver which is coupled to the bases of transistors, and alternately switches the transistors at opposite corners of the inverter. These instructions are used to perform operations where data bits are involved, i.e. operations like logical, shift, etc. We can say that these instructions are logical instructions. In 8086, the destination register may or may not the Accumulator.
Let us see the logical instructions of 8086 microprocessor. Here the D, S and C are destination and source and count respectively. D, S and C can be either register, data or memory address.

Opcode
AND

Operand
D,S

Description
Used for adding each bit in a byte/word with the corresponding bit in another byte/word.


Procedure:
1. Create: open emu8086 write a program after that save the program with .asm extension.
2. Compile: Emulator
3. Execute: Run
Code: 


-----------------------------------------------
 .MODEL SMALL
 .STACK 100H

 .DATA
    PROMPT_1  DB  'Enter the Lower Case Letter : $'
    PROMPT_2  DB  0DH,0AH,'The Upper Case Letter is : $'

 .CODE
   MAIN PROC
     MOV AX, @DATA                
     MOV DS, AX

     LEA DX, PROMPT_1            
     MOV AH, 9
     INT 21H

     MOV AH, 1                    
     INT 21H

     MOV BL, AL                   

     LEA DX, PROMPT_2             
     MOV AH, 9
     INT 21H

     AND BL, 0DFH                 
                                 

     MOV AH, 2                   
     MOV DL, BL
     INT 21H

     MOV AH, 4CH                 
     INT 21H
   MAIN ENDP 
 END MAIN
----------------------------------------


Thanks