Question

Read a string from user until the user presses enter. Store the string in memory. Read...

Read a string from user until the user presses enter. Store the string in memory. Read another single character input from user and display the number of occurrences of this character in the string.

by assembly language

Homework Answers

Answer #1

ans for the given problem

PROGRAM:

TXT1 DB 10,13,'ENTER ANY STRING :- $'

TXT2 DB 10,13,'ENTER ANY CHARACTER :- $'

TXT3 DB 10,13,' $'

TXT4 DB 10,13,'NO, CHARACTER FOUND IN THE GIVEN STRING $'

TXT5 DB ' CHARACTER(S) FOUND IN THE GIVEN STRING $'

CHAR DB ?

COUNT DB 0

P1 LABEL BYTE

M1 DB 0FFH

L1 DB ?

P11 DB 0FFH DUP ('$')

DATA ENDS

DISPLAY MACRO MSG

MOV AH,9

LEA DX,MSG

INT 21H

ENDM

CODE SEGMENT

ASSUME CS:CODE,DS:DATA

START:

MOV AX,DATA

MOV DS,AX

DISPLAY TXT1

LEA DX,P1

MOV AH,0AH

INT 21H

DISPLAY TXT2

MOV AH,1

INT 21H

MOV CHAR,AL

DISPLAY TXT3

LEA SI,P11

MOV CL,L1

MOV CH,0

CHECK:

MOV AL,[SI]

CMP CHAR,AL

JNE SKIP

INC COUNT

SKIP:

INC SI

LOOP CHECK

CMP COUNT,0

JE NOTFOUND

DISPLAY TXT3

MOV DL,COUNT

ADD DL,30H

MOV AH,2

INT 21H

DISPLAY TXT5

JMP EXIT

NOTFOUND:

DISPLAY TXT4

EXIT: MOV AH,4CH

INT 21H

CODE ENDS

END START

**************************Thank you***********************

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
MIPS ASSEMBLY Have the user input a string and then be able to make changes to...
MIPS ASSEMBLY Have the user input a string and then be able to make changes to the characters that are in the string until they are ready to stop. We will need to read in several pieces of data from the user, including a string and multiple characters. You can set a maximum size for the user string, however, the specific size of the string can change and you can’t ask them how long the string is (see the sample...
Write an Assembler Program to input a string from the keyboard, store the string in memory....
Write an Assembler Program to input a string from the keyboard, store the string in memory. Your program should check and display if the string contains vowel letters (A, E, I, O, U), Hint: your program should check both lower and upper case
Write a mips assembly language program that asks the user to enter and integer number and...
Write a mips assembly language program that asks the user to enter and integer number and read it. Then ask him to enter a bit position (between 0 and 31) and display the value of that bit.
Write an assembly program which asks user to enter a character from ‘A’ to ‘Z’. If...
Write an assembly program which asks user to enter a character from ‘A’ to ‘Z’. If the user enters any other character, the program asks user to enter the character again. In this way the program inputs 300 characters and stores it in memory location from address $1000 to $112B. Hint: Use CPU register Y as counter
Write a C program that prompts the user to enter a line of text on the...
Write a C program that prompts the user to enter a line of text on the keyboard then echoes the entire line. The program should continue echoing each line until the user responds to the prompt by not entering any text and hitting the return key. Your program should have two functions, writeStr and readLn, in addition to the main function. The text string itself should be stored in a char array in main. Both functions should operate on NUL-terminated...
Write a program that prompts the user to enter a string and displays the number of...
Write a program that prompts the user to enter a string and displays the number of characters it contains, fourth character, and last character. Note: The string may contain blanks. For example: “C++ programming is fun”. You should write a complete program.
Write a program that prompts the user to input a string and outputs the string in...
Write a program that prompts the user to input a string and outputs the string in uppercase letters. (Use dynamic arrays to store the string.) my code below: /* Your code from Chapter 8, exercise 5 is below. Rewrite the following code to using dynamic arrays. */ #include <iostream> #include <cstring> #include <cctype> using namespace std; int main() { //char str[81]; //creating memory for str array of size 80 using dynamic memory allocation char *str = new char[80]; int len;...
This is C. Please write it C. 1) Prompt the user to enter a string of...
This is C. Please write it C. 1) Prompt the user to enter a string of their choosing. Store the text in a string. Output the string. (1 pt) Ex: Enter a sample text: we'll continue our quest in space. there will be more shuttle flights and more shuttle crews and, yes, more volunteers, more civilians, more teachers in space. nothing ends here; our hopes and our journeys continue! You entered: we'll continue our quest in space. there will be...
write an assembly language program for 8085 microprocessor to read consecutive memory locations from 2000 to...
write an assembly language program for 8085 microprocessor to read consecutive memory locations from 2000 to 2FFF & transfer to 4000 to 4FFF,if interrupted display the current count at port5 this is for 8085 microprocessor for interrupt we have to write a program & subroutine
1) In Python Use a while loop to ask the user to enter a series of...
1) In Python Use a while loop to ask the user to enter a series of alphabets. The loop terminates when the user presses enter. Once the loop terminates, display the number of vowels and consonants entered by the user. Hint: keep a running count of the number of characters entered by the user. Keep a running count of the number of vowels. Total number of consonants = total number of characters - total number of vowels. Assume that the...