Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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,

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:

Call clrscr

mov edx, OFFSET prompt1

Call WriteString

Call ReadDec

mov userinput, al

opt1: ;// option 1

cmp userinput, 1

jne opt2

mov edx, OFFSET theString

mov ecx, LENGTHOF theString

Call option1

mov theStringLen, al

jmp starthere

opt2:

cmp userinput, 2

jne opt3

mov edx, OFFSET theString ;//offset Of String To play With

movzx ecx, theStringLen ;//length Of String To play With

Call option2

jmp starthere

opt3: ;//remove all non-letter elements

cmp userinput, 3

jne opt4

mov edx, OFFSET theString ;//offset Of String To play With

movzx ecx, theStringLen ;//length Of String To play With

Call option3

jmp starthere

opt4: ;// Is it a palindrome

cmp userinput, 4

jne opt5

mov edx, OFFSET theString ;//offset Of String To play With

movzx ecx, theStringLen ;//length Of String To play With

Call option4

jmp starthere

opt5:

cmp userinput, 5

jne opt6

mov edx, OFFSET theString ;//offset Of String To play With

Call WriteString

jmp starthere

opt6:

cmp userinput, 6

je theEnd

mov edx, OFFSET oops

Call WriteString

Call waitmsg

jmp starthere

theEnd:

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 user

.data

opt1prompt Byte "Enter a string.", 0Ah, 0Dh, "----> ", 0h

.code

push edx

mov edx, offset opt1prompt

Call WriteString

pop edx

Call ReadString

ret

option1 ENDP

option2 PROC

ret

option2 ENDP

option3 PROC

ret

option3 ENDP

option4 PROC

ret

option4 ENDP

End main

This is menu based assembly language problem, Is there someone to help, option1 is done and need to work on the rest of the option?

Thanks in Advance

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

Excel As Your Database

Authors: Paul Cornell

1st Edition

1590597516, 978-1590597514

Students also viewed these Databases questions

Question

How is productivity obtained in analysis? What tool is best used?

Answered: 1 week ago