Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assembly Program Help using Assembly Language for x86 Processors -by Kip Irvine Library Need help finishing this assignment: Simple Assembly Menu with the following options

Assembly Program Help

using Assembly Language for x86 Processors -by Kip Irvine Library

Need help finishing this assignment:

Simple Assembly Menu with the following options

1.Enter a string

2.Convert the string to lower case

3.Remove all non-letter elements

4.Is it a palindrome?

5.Print the string

6.Quit

TITLE menu.asm

include irvine32.inc

clearEAX TEXTEQU clearEBX TEXTEQU clearECX TEXTEQU clearEDX TEXTEQU clearESI TEXTEQU clearEDI TEXTEQU

.data prompt1 byte 'MAIN MENU', 0ah, 0dh, '=========', 0ah, 0dh, '1. Enter a string', 0Ah, 0Dh, '2. Convert the string to lower case', 0Ah, 0Dh, '3. Remove all non-letter elements', 0Ah, 0Dh, '4. Is the string a palindrome?', 0Ah, 0Dh, '5. Print the string', 0Ah, 0Dh, '6. Quit', 0Ah, 0Dh, 0h oops byte 'Invalid Entry. Please try again.', 0h

UserInput byte 0h

theString byte 50 dup(0h),0h theStringlen byte 0h

.code main PROC clearEAX clearEBX clearECX clearEDX clearESI clearEDI

starthere: ; MAIN LOOP call clrscr mov edx, OFFSET prompt1 call WriteString call ReadDec mov userinput, al

opt1: ; option 1 : Enter a string cmp userinput, 1 jne opt2 mov edx, OFFSET theString mov ecx, LENGTHOF theString call option1 mov theStringLen, al jmp starthere

;Menu options

opt2: ; option 2: Convert the string to lower case cmp userinput, 2 jne opt3 mov edx, OFFSET theString ; offset of the string for option 2, the length of user input string movzx ecx, theStringLen ; length of string call option2 jmp starthere

opt3: ; option 3: Remove all non-letter elements cmp userinput, 3 jne opt4 ; if not option 3 go to option 4 mov edx, OFFSET theString ; offset of string movzx ecx, theStringLen ; length of string call option3 jmp starthere

opt4: ; option 4: Is it a palindrome cmp userinput, 4 jne opt5 ; if not option 4 go to option 5 mov edx, OFFSET theString ; offset of string movzx ecx, theStringLen ; length of string call option4 jmp starthere

opt5: ; option 5: Print the String cmp userinput, 5 jne opt6 ; if not option 5 got to option 6 mov edx, OFFSET theString ;offset of string to play with call WriteString jmp starthere

opt6: ; option 6: Quit cmp userinput, 6 je theEnd ; jump if equal mov edx, OFFSET oops ; if user enters an invalid entry from not in the menu options call WriteString call Waitmsg jmp starthere

theEnd: call WaitMsg exit main ENDP ;==================================================== option1 PROC uses EDX ECX ;Desc: Prompts the user to enter a string. ; User entered string will be stored in ; the array passed in EDX ;Receives: edx - offset of the string ; ecx - max length of the string ;Returns: eax - number of chars entered by the user ;===================================================== .data

opt1prompt byte "Please enter a string.", 0Ah, 0Dh, "------> ", 0h

.code push edx mov edx, offset opt1prompt call WriteString pop edx call ReadString ret option1 ENDP

// TO DO

option2 PROC

ret option2 ENDP

option3 PROC

ret option3 ENDP

option4 PROC

ret option4 ENDP

option5 PROC

ret option5 ENDP

option6 PROC

ret option6 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

The Temple Of Django Database Performance

Authors: Andrew Brookins

1st Edition

1734303700, 978-1734303704

More Books

Students also viewed these Databases questions