Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help fixing this program in assembly language. Currently the program takes a string from the user and reverses the string and converts the uppercase

Need help fixing this program in assembly language. Currently the program takes a string from the user and reverses the string and converts the uppercase characters to lowercase and the lowercase characters to uppercase. It needs to be adjusted so that each upper-case letter is converted to the lower-case letter following it (eg A will be converted to b instead of 'A' being converted to 'a').

Sample Input/Output:

Enter a string of at most 128 characters: An Input Line!

Here it is, with all lowercases and uppercases flipped, and in reverse order: !ENIm TUPNj Nb

There are 3 upper-case letters after conversion. There are 14 characters in the string.

Program:

INCLUDE Irvine32.inc INCLUDELIB Irvine32.lib

.data input BYTE "Enter a string of at most 128 characters: ", 0 s DWORD 128 DUP(?) sizeS DWORD ? siz DWORD ? input2 BYTE "Here it is, with all lowercases and uppercases flipped, and in reverse order: ", 0ah, 0dh, 0 sumL DWORD 0 input3 BYTE "There are ", 0 input4 BYTE " upper-case letters after conversion.", 0 input5 BYTE "There are ", 0 input6 BYTE " characters in the string.", 0 .code main proc mov edx, OFFSET input call WriteString mov edx, OFFSET s mov ecx, 127 call ReadString

mov edx, OFFSET s call StrLength mov siz, eax mov sizeS, eax

call crlf

mov edx, OFFSET input2 call WriteString mov ebx, -1 ;decrementing ebx before incrementing it again in top top : dec sizeS inc ebx mov eax, sizeS cmp eax, 0 jl next mov esi, OFFSET s add esi, eax mov al, [esi] cmp al, 32 jne l1 l1 : cmp al, 65 jb o_r cmp al, 90 ja o_r add al, 32 call WriteChar jmp top o_r: cmp al, 97 jb el cmp al, 122 ja el sub al, 32 call WriteChar inc sumL jmp top el : call WriteChar jmp top next :

call crlf call crlf

mov edx, OFFSET input3 call WriteString mov eax, sumL call WriteInt mov edx, OFFSET input4 call WriteString

call crlf

mov edx, OFFSET input5 call WriteString mov eax, siz call WriteInt mov edx, OFFSET input6 call WriteString

exit main endp end main

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Ai And The Lottery Defying Odds With Intelligent Prediction

Authors: Gary Covella Ph D

1st Edition

B0CND1ZB98, 979-8223302568

More Books

Students also viewed these Databases questions