Question

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

Homework Answers

Answer #1

Program:

.MODEL SMALL

.STACK 64

.DATA

MAXCHAR DB 60;

ACTCHAR DB ?;

STR DB 60 DUP (?);

VOWEL_NO DB 0;

NEWLN DB 0DH,0AH,”$”;

CHECK STR DB 65, 69, 73, 79, 85, 97, 101, 105, 111, 117; {A, B, …. Z = 65, 66 …. 90 : a, b, … z = 97, 98, …122}

.CODE

MAIN PROC

MOV AX, @DATA;                            initialize data segment

MOV DS, AX;                                      register

LEA DX, MAXCHAR;                         compute address of value

MOV AH, 0AH;                                   Getline function

INT 21H;                                               Get input

CALL NEXT LINE;                               New Line

MOV CL, ACTCHAR;

MOV CH, 0;

MOV, 0;

L1:          PUSH CX;                                             Save Register

MOV DL, STR[BX];

MOV CX, 10;

MOV SI, 0;

L3:          CMP DL, CHECK STR[SI];                compare DL and str[si]

JZ L2;                                                     jump to label L2 if CF = 1

INC SI;                                                   Add 1 to contents of SI register

LOOP L3;                                              Repeat until all elements adjusted

JMP L4;                                                 Jump to L4 without any condition

L2:          INC VOWEL_NO;                              Add 1 to content of Vowel no

MOV AH, 02H;                                   Put the immediate number

INT 21H;                                               Get input

L4:          INC BX;                                                 Add 1 to contents of BX register

POP CX;                                                Copy a word from the top of stack to CX

;                                               Increment SP by 2

LOOP L1;                                              Repeat until all elements adjusted

CALL VOWEL COUNT DISP

MOV AX, 4000H;                               Put the immediate number

INT 21H;                                               Get input

MAIN ENDP

NEXT LINE PROC NEAR;

LEA DX, NEWLN;                               compute address of value

MOV AH, 09H;                                   Put the immediate number

INT 21H;

RET;                                                       Return to main line

NEXTLINE ENDP

VOWEL COUNT DISP PROC NEW

MOV CX, 10;                                       Put the immediate number

MOV AL, VOWEL_NO;                    Copy word from Vowel no to AL Register

MOV AH, 0;                                         Put the immediate number

MOV BX, 0;                                         Put the immediate number

LABEL1: MOV DX, 0;                                        Put the immediate number

DIV CX;                                                 Divide doubleword in DX and AX by word in CX.

;                                     Quotient in AX, reminder in DX

ADD DX, 30H;                                     Add immediate number 30H to content of DX.

;                                     Result in AL

PUSH DX;                                             Decrement SP by 2, copy DX to stack

INC BX;                                                 Add 1 to contents of BX register

CMP AX, 0;                                          Compare by subtracting 0 from AX

JA LABEL1;                                           Jump to level LABEL1 if AX above 0

MOV AH, A2H;                                   Put the immediate number

MOV CX, BX;                                       Copy word from BX to CX Register

DISP:     POP DX;                                                Copy a word from the top of stack to DX

;                                               Increment SP by 2

INT 21H;                                               Get Input

LOOP DISP;                                         Repeat until all elements adjusted

RET;                                                       return to main program

VOWEL COUNT DISP ENDP

END MAIN;                                         End of main program

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
Write a JAVA program that reads in a string from standard input and determines the following:...
Write a JAVA program that reads in a string from standard input and determines the following: - How many vowels are in the string (FOR THE PURPOSE OF THIS PROGRAM 'Y' is NOT considered a vowel)? - How many upper case characters are in the string? - How many digits are in the string? - How many white space characters are in the string? - Modify the program to indicate which vowel occurs the most. In the case of a...
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;...
Lab Assignment | Count vowels Write a program that will use a while loop to count...
Lab Assignment | Count vowels Write a program that will use a while loop to count and display the number of vowels in the string provided as input by the end-user. This program will consider the letters a, e, i, o, and u (both upper and lower case) to be vowels. The user may enter a single word, a sentence, a paragraph, or nothing at all as input. Be sure to test each possibility. Python 3 please!
Design and implement an application that reads a string from the user and then determines and...
Design and implement an application that reads a string from the user and then determines and prints how many of each vowel appear in the string. Have a separate counter for each vowel. Also, count and print the number of non-vowel characters. Note: The characters in the string must be considered as case-insensitive. i.e., You must consider both upper and lowercase letters as same. Example Output: Enter a string: hello Number of each vowel in the string: a: 0 e:...
c++ 1. Write a program that takes in a string as an input of any size...
c++ 1. Write a program that takes in a string as an input of any size and replaces all vowel letters in the string with an ‘x’. You must use Logical Operators and implement it using a user-defined function.
Write a program that takes a string of characters (including spaces) as input, computes the frequency...
Write a program that takes a string of characters (including spaces) as input, computes the frequency of each character, sorts them by frequency, and outputs the Huffman code for each character.   When you are writing your program, you should first test it on a string of 7 characters, so you can check it. PLEASE NOTE: Your program must work for any text that has upper and lower case letters digits 0 - 9, commas, periods, and spaces. Please submit the...
4) Write a C program that reads in a string from the keyboard. Use scanf with...
4) Write a C program that reads in a string from the keyboard. Use scanf with the conversion code %s. Recall that the 2nd arg in scanf should be the address of the location in memory into which the inputted string should be stored. Recall that the name of an array without square brackets is the address of the first slot of the array. 5) Write a program that reads in this file (lab5.txt) and counts and displays the number...
Write a Java application a String input by the user and shows whether the string contains...
Write a Java application a String input by the user and shows whether the string contains all 26 letters of the (English version of the Latin) alphabet. For example, "Pack my box with five dozen liquor jugs" contains all 26 letters, but "The quick frown box jumps over the hazy log" does not contain a d. It does not matter whether one or more letters appear more than once. needs, at minimum, asl user to input for the String, then...
Write a java program that repeatedly prompts the user to input a string starting with letters...
Write a java program that repeatedly prompts the user to input a string starting with letters from the English alphabet. The program must stop getting input when the user inputs the string “STOOOOP”. Then the program must display the words starting with each letter from the alphabet in a separate line (e.g. you need to make a new line after all words starting with a specific letter are finished.
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