Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please I want to fix the code write in assambly language include Irvine32.inc ExitProcess proto,dwExitCode:dword .data ;;; lab5 Quiz data string1msg byte 'please enter a
Please I want to fix the code write in assambly language
include Irvine32.inc
ExitProcess proto,dwExitCode:dword
.data
;;; lab5 Quiz data
string1msg byte 'please enter a first string: ',0
string2msg byte 'please enter a second string: ',0
string1 byte 100 dup(0)
string2 byte 100 dup(0)
sizeofstring1 dword ?
sizeofstring2 dword ?
; messages
stringsnotequal byte 'the two strings are not equal',0dh, 0ah, 0
string1isgreater byte 'String 1 is greater than String 2',0dh, 0ah, 0
string1isless byte 'String 1 is less than String 2',0dh, 0ah, 0
bothstringsareequal byte 'String 1 is equal to String 2',0dh, 0ah, 0
.code
eqgr proc
cmp string2,al
mov edx,offset string1
call writestring
jmp done
elsepart:
mov edx,offset string2
call writestring
done:
ret
eqgr ENDP
main PROC
lea edx, string1msg
call WriteString
; read string 1
mov edx,OFFSET string1 ; point to the buffer
mov ecx,SIZEOF string1 ; specify max characters
call ReadString ; input the string
mov sizeofstring1,eax ; number of characters
lea edx, string2msg
call WriteString
; read string 2
mov edx,OFFSET string2 ; point to the buffer
mov ecx,SIZEOF string2 ; specify max characters
call ReadString ; input the string
mov sizeofstring2,eax ; number of characters
L:
mov string2,al
mov al,string2
cmp string1,al
jne notequal
jge geratthan
jle lessthan
je equal
notequal:
mov edx,offset stringsnotequal
call writestring
call exitprocess
geratthan:
mov edx,offset string1isgreater
call writestring
call crlf
call exitprocess
lessthan:
mov edx,offset string1isless
call writestring
call crlf
call exitprocess
equal:
mov edx,offset bothstringsareequal
call writestring
call crlf
jmp L
invoke ExitProcess,0
main endp
end main
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started