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 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...
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.
1 Design and implement FileCompare program that compares two text input files (file1.txt and file2.txt), line-by-line,...
1 Design and implement FileCompare program that compares two text input files (file1.txt and file2.txt), line-by-line, for equality. Print any lines that are not equivalent indicating the line numbers in both files. The language of implementation is java 2 . Create a program that reads a string input from the user, then determines and prints how many of each lowercase vowels (a, e. i, o, and u) appear in the entire string. Have a separate counter for each vowel. Also...
C++ Part B: (String) Program Description: Write a word search program that searches an input data...
C++ Part B: (String) Program Description: Write a word search program that searches an input data file for a word specified by the user. The program should display the number of times the word appears in the input data file. In addition, the program should count and display the number of grammatical characters in the input data file. Your program must do this by providing the following functions : void processFile(ifstream &inFile, string wordSearch, int &wordCount, int &grammaticalCount) ; (15%)...
Write a program in C that extracts the tokens from a string. Given a string as...
Write a program in C that extracts the tokens from a string. Given a string as input, the program should print on the screen each token on a new line. For example given the following string as input: “hello there my friends” the program should generate: I am a programmer
3. Write function, leastChar(inputString) that takes as input a string of one or more letters (and...
3. Write function, leastChar(inputString) that takes as input a string of one or more letters (and no other characters) and prints 1) the "least" character in the string, where one character is less than another if it occurs earlier in the alphabet (thus 'a' is less than 'C' and both are less than 'y') and 2) the index of the first occurrence of that character. When comparing letters in this problem, ignore case - i.e. 'e' and 'E' should be...
Write a program of wordSearch puzzle that use the following text file as an input. The...
Write a program of wordSearch puzzle that use the following text file as an input. The output should be like this: PIXEL found (left) at (0,9). ( Use JAVA Array ) .Please do not use arrylist and the likes! Hints • The puzzle can be represented as a right-sized two-dimensional array of characters (char). • A String can be converted into a right-sized array of characters via the String method toCharArray. . A word can occur in any of 8...
Java Program : Please save the program with the name ‘Dstring.java’ Write a program that reads...
Java Program : Please save the program with the name ‘Dstring.java’ Write a program that reads a string from the keyboard. If the length of the string is an even number, your program should split the string into two strings of equal length. If the length of the string is odd, your program should split the string into two strings where the first part has one more character than the second part. Your program should output the two strings it...
Write a short RISC-V assembly program that operates on a NULL terminated string of arbitrary size...
Write a short RISC-V assembly program that operates on a NULL terminated string of arbitrary size (use your favourite phrase when you define it with DC for testing). The program (no need to define a function) scans the string and replaces every lower case character with the corresponding upper case. Your program prints the string before and after converting it to upper case.
Vowels and consonants Write a program that reads a word and prints the number of vowels...
Vowels and consonants Write a program that reads a word and prints the number of vowels and consonants in the word. For this exercise assume that ‘a’, ‘e’, ‘i’, ‘o’, ‘u’, and ‘y’ are vowels. For example, if the user enters the input “Harry”, the program should print “The word contains 2 vowels and 3 consonants”.