Case Conversion in Assembly Language Lowercase To Uppercase and Vice Versa
Case Conversion in Assembly Language Lowercase To Uppercase and Vice Versa
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
ASTACK 100H
dupMEjEN
MAIN PROC
INT 21H
MOV SI; OFFSET buffer
MOV CX; 0
inputHloop:
CMP AL; 13
JE processHstring MOV
KSIL; AL
INC SI INC CX
JMP inputHloop
processHstring:
convertHloop:
EjE
JE displayHresult
CMP AL; EaE
JL checkHuppercase
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:
AH; 09H
INT 21H
INT 21H
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.
3 Complexity
Assembly programming can be intricate and difficult.