Question: This code needs to be fix INCLUDE asmlib.inc . data ; Data segment to store prompts and messages prompt BYTE Enter a character: ,
This code needs to be fix
INCLUDE asmlib.inc
data ; Data segment to store prompts and messages
prompt BYTE "Enter a character:
outpA BYTE is a digit",
outpB BYTE is a vowel",
outpC BYTE is arithmetic",
outpD BYTE "Not a vowel, digit, or arithmetic character. Must be something else.",
code ; Code segment where logic is implemented
main PROC
; Display prompt and get a single character input
mov edx, OFFSET prompt ; Load prompt message
call WriteString ; Print prompt
call ReadChar ; Read single character into AL
; Check if character is a digit
call isDigit
cmp eax, ; Check if eax is digit
je DigitFound ; If yes, jump to DigitFound
; Check if character is a vowel
call isVowel
cmp eax, ; Check if eax is vowel
je VowelFound ; If yes, jump to VowelFound
; Check if character is an arithmetic operator
call isArithmetic
cmp eax, ; Check if eax is arithmetic
je ArithmeticFound ; If yes, jump to ArithmeticFound
; Character is something else
mov edx, OFFSET outpD
call WriteString
jmp EndProgram ; End program
DigitFound:
mov edx, OFFSET outpA
call WriteString
jmp EndProgram
VowelFound:
mov edx, OFFSET outpB
call WriteString
jmp EndProgram
ArithmeticFound:
mov edx, OFFSET outpC
call WriteString
jmp EndProgram
EndProgram:
exit ; Exit the program
main ENDP
; Checks if character in AL is a digit
isDigit PROC
mov eax, ; Initialize eax to assume not a digit
cmp al ; Check if AL
jl NotDigit ; If less, jump to NotDigit
cmp al ; Check if AL
jg NotDigit ; If greater, jump to NotDigit
mov eax, ; Set eax to is a digit
NotDigit:
ret
isDigit ENDP
; Checks if character in AL is a vowel a e i o u A E I, O U
isVowel PROC
mov eax, ; Initialize eax to assume not a vowel
cmp alA
je VowelFound
cmp alE
je VowelFound
cmp alI
je VowelFound
cmp alO
je VowelFound
cmp alU
je VowelFound
cmp ala
je VowelFound
cmp ale
je VowelFound
cmp ali
je VowelFound
cmp alo
je VowelFound
cmp alu
je VowelFound
jmp NotVowel
VowelFound:
mov eax, ; Set eax to is a vowel
NotVowel:
ret
isVowel ENDP
; Checks if character in AL is an arithmetic operator
isArithmetic PROC
mov eax, ; Initialize eax to assume not an arithmetic operator
cmp al
je ArithmeticFound
cmp al
je ArithmeticFound
cmp al
je ArithmeticFound
cmp al
je ArithmeticFound
jmp NotArithmetic
ArithmeticFound:
mov eax, ; Set eax to is an arithmetic operator
NotArithmetic:
ret
isArithmetic ENDP
END main
Please fix the problem
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
