Subject Computer Science Assembly Language Programming

Question

For this program, you will replace all the occurrences of a certain character in a string with another character.

The terminal interaction will look as follows:

String? abcdef
Character To Replace?
Replacement Character?
String With Replaced Character is: abxdef

In this example Character To Replace was input as 'c' and Replacement Character was input as 'x'.

Another example is:

String? abcdcdcdefg
Character To Replace?
Replacement Character?
String With Replaced Character is: abxdxdxdefg

For this program, you MUST use the following Irvine32 procedures:

ReadString
WriteString
ReadChar
CfLf

Solution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

INCLUDE Irvine32.inc

ExitProcess PROTO, dwExitCode:DWORD

.data

msg1 BYTE "String? ", 0 ; message to ask for string
msg2 BYTE "Character to replace? ", 0 ; message to ask for character to replace
msg3 BYTE "Replacement character? ", 0 ; message to ask for replacement character
msg4 BYTE "String with replaced character is: ", 0 ; message to print the result
string BYTE 41 DUP(?) ; string of 40 characters for input
charToReplace BYTE ? ; character to replace
replacementChar BYTE ? ; replacement character   

.code

main PROC

mov edx, OFFSET msg1 ; move memory address of msg1 to edx for printing
call WriteString ; print string
mov edx, OFFSET string; prepare reading buffer
mov ecx, 41; set the size of input string
call ReadString ; read the string...

This is only a preview of the solution. Please use the purchase button to see the entire solution

Assisting Tutor

Related Homework Solutions

Raid Simulation Program Using Assembly Language
Homework Solution
$150.00
Assembly Language
Programming
Computer Science
Algorithms
Strings
Files
XOR
Commands
Input
Output
Bytes
System Kernel
Loop Counter
Pointers
Memory
Variables
Assembly & Data Representation Questions
Homework Solution
$18.00
Mantissa
Sign
Bit
Exponent
Infinity
Assembly
Language
Binary
Instruction
Register
Ebx
Ecx
Edx
Memory
Location
Content
C
Statement
Equivalent
Assembly Language Problems With Fibonacci Numbers
Homework Solution
$30.00
Assembly Language
Computer Science
Programming
Fibonacci Numbers
Arrays
European Mathematics
Indian Mathematics
Sequences
Characters
Strings
Columns
Rows
Values
Memory
Stack
Macros
Boolean
Registers
Get help from a qualified tutor
Live Chats