0% found this document useful (0 votes)
91 views11 pages

Case Conversion in Assembly Language Lowercase To Uppercase and Vice Versa

This document presents an overview of case conversion in assembly language, specifically transforming lowercase characters to uppercase and vice versa. It explains the principles of assembly language, ASCII representation, and the logic behind case conversion, along with a sample program code. Additionally, it discusses the tools used for development and concludes with the complexities and advantages of using assembly language.

Uploaded by

parthattarde78
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
91 views11 pages

Case Conversion in Assembly Language Lowercase To Uppercase and Vice Versa

This document presents an overview of case conversion in assembly language, specifically transforming lowercase characters to uppercase and vice versa. It explains the principles of assembly language, ASCII representation, and the logic behind case conversion, along with a sample program code. Additionally, it discusses the tools used for development and concludes with the complexities and advantages of using assembly language.

Uploaded by

parthattarde78
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Case Conversion in

Assembly Language:
Lowercase to Uppercase
and Vice Versa
This presentation delves into the implementation of case
conversionOtransforming lowercase characters to uppercase and vice
versaOusing assembly languageA Tailored for assembly language
students; lowQlevel programmers; and computer science enthusiasts;
it provides a clear; concise understanding of the underlying principles
and practical implementations involvedA We aim to elucidate the
intricacies of manipulating character cases at a fundamental levelA
Introduction to Assembly Language
What is Assembly? CPU-Specific Instruction Sets
Assembly language is a low-level programming language Assembly language is CPU-specific, meaning that the
that directly maps to machine code instructions. Each instruction set varies depending on the processor
instruction corresponds to a specific operation that the CPU architecture (e.g., x86, ARM). Different CPUs have
can perform. This direct mapping provides fine-grained different registers, memory organization, and instruction
control over hardware resources, making it ideal for tasks sets, which necessitates writing different assembly code
requiring maximum performance or direct hardware for each platform. Understanding the target CPU's
access. architecture is crucial for effective assembly
programming.
Understanding ASCII Representation
ASCII Character Encoding Decimal Values for Letters Key Difference
ASCII, the American Standard In ASCII, uppercase letters 'A' The ASCII values for lowercase
Code for Information Interchange, through 'Z' are represented by letters are exactly 32 greater than
is a character encoding standard for decimal values 65 to 90, while their uppercase counterparts. For
electronic communication. It lowercase letters 'a' through 'z' are example, 'a'
represents characters as numbers, represented by 97 to (97) - 'A' (65) = 32. This
ranging from 0 to 122. This numerical representation consistent difference is the basis for
127. Each number corresponds to a is fundamental to case conversion, case conversion logic in assembly
specific character, as it allows for mathematical language.
including letters, numbers, operations to manipulate character
punctuation marks, and cases.

control characters.
The Logic of Case Conversion

1 2 3

Lowercase to Uppercase Uppercase to Lowercase Range Check


To convert a lowercase letter to Conversely, to convert an Before performing the conversion, it
uppercase, you simply subtract 32 uppercase letter to lowercase, you is crucial to check if the character is
from its ASCII value. For example, if add 32 to its ASCII value. For indeed a letter. This is achieved by
you have the character 'a' (97), instance, if you have the character verifying that the character's ASCII
subtracting 32 gives you 65, which is 'A' (65), adding 32 results in 97, value falls within the ranges 'a'-'z' or
'A'. which is 'a'. 'A'-'Z'. This avoids converting
unintended characters such as
numbers or symbols.
Program Code
AMODEL SMALL

ASTACK 100H

ADATA msg db EEnter a string: jE outputHmsg db

13; 10; EConverted string: jE buffer db 100

dupMEjEN

newline db 13; 10; EjE ACODE

MAIN PROC

MOV AX; ¦DATA MOV DS; AX

MOV DX; OFFSET msg MOV AH; 09H

INT 21H
MOV SI; OFFSET buffer

MOV CX; 0

inputHloop:

MOV AH; 01H INT 21H

CMP AL; 13

JE processHstring MOV

KSIL; AL

INC SI INC CX

JMP inputHloop

processHstring:

MOV BYTE PTR KSIL; EjE

MOV SI; OFFSET buffer

convertHloop:

MOV AL; KSIL CMP AL;

EjE

JE displayHresult
CMP AL; EaE

JL checkHuppercase

CMP AL; EzE

JG checkHuppercase

SUB AL; 32

JMP storeHcharacter

checkHuppercase: CMP

AL; EAE

JL storeHcharacter CMP

AL; EZE

JG storeHcharacter ADD

AL; 32

storeHcharacter: MOV

KSIL; AL INC SI

JMP convertHloop
displayHresult:

MOV DX; OFFSET newline MOV

AH; 09H

INT 21H

MOV DX; OFFSET outputHmsg

MOV AH; 09H

INT 21H

MOV AH; 4CH INT 21H MAIN

ENDP END MAIN


PROGRAM OUTPUT
Enter a string: parth
Converted string: PARTH
Applications and Tools Used
1. EMU-8 0 8 6 Microprocessor Emulator
EMU-8086 is an emulator used for writing, assembling, and executing 8086 assembly language programs.

It provides features like registers view, memory dump, step execution, and debugging tools, which help analyze program
execution.

This tool was used to develop and test the case conversion program for converting lowercase to uppercase and vice versa.

2. Windows 11 (Operating System)

Windows 11 was used as the operating system for running EMU-8086.


It provides compatibility with the EMU-8086 emulator, ensuring smooth execution of assembly language programs.
Conclusion
Assembly language offers fine-grained control over hardware and
memory. This allows for efficient and optimized code.

However, it requires a deep understanding of computer architecture. It


can be more complex and time-consuming than high-level languages.

1 Direct Hardware 2 Performance


Control Optimized assembly code
Assembly allows precise can execute faster.
manipulation of system
resources.

3 Complexity
Assembly programming can be intricate and difficult.

You might also like