Case conversion Program Assembly Code

Case conversion Program Assembly Code

Case conversion Program Explanation

  • At first we will accept the string from the user and store it in STR 1. Call procedure CONVERT, which will do the case conversion. Display the result.

Algorithm for Program 

 

Step  I           :   Initialize the data segment.

Step II          :   Accept the string from user.

Step III        :   Store the accepted string in STR 1.

Step IV         :   Call procedure CONVERT.

Step V          :   Initialize SI = address of STR 1.

Step VI         :   Initialize DI = address of destination string STR 2.

Step VII       :   Load CL = length of STR 1.

Step VIII     :   Load character from STR 1 into AL.

Step IX        :   Check if the character entered is a letter from A-Z. If not go to step 24

Step X          :   Compare AL with 5AH (i.e. ASCII of upper case). If AL > Greater go to step 13.

Step XI        :   Add 20H to AL to make letter small case.

Step XII       :   Compare AL with 61H (i.e. ASCII of lower case).

Step XIII     :   go to step 21.

Step XIV     :   Move converted letter to destination.

Step XV       :   Increment SI to next character.

Step XVI     :   Increment DI.

Step XVII    :   Decrements counter.

Step XVIII  :   IS CL = 00 ? If not, go to step 8.

Step XIX     :   Display the converted string.

Step XX       :   If letter is smaller case, subtract 20 H to convert it to upper case.

Step XXI     :   Go to step 15.

Step XXII   :   Return back to calling program.

Step XXIII  :   Stop.

Program Code

Program Output 

 

F:\C\PROGRAMS>TASM STRQW

Turbo Assembler  Version 3.0  Copyright (c) 1988, 1991 Borland International

Assembling file:   STRQW.ASM

Error messages:    None

Warning messages:  None

Passes:            1

Remaining memory:  436k

F:\C\PROGRAMS>TLINK STRQW

Turbo Link  Version 3.0 Copyright (c) 1987, 1990 Borland International

F:\C\PROGRAMS>STRQW

ACCEPT THE STRING ABCDE

     abcde

F:\C\PROGRAMS>STRQW

ACCEPT THE STRING aBCdeF

   AbcDEf

F:\C\PROGRAMS>