Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

****USING KIP IRVINE LIBRARY, INCLUDE Irvine32.inc**** Write an assembly language program to input a string from the user, count and display the number of times

****USING KIP IRVINE LIBRARY, "INCLUDE Irvine32.inc"****

Write an assembly language program to input a string from the user, count and display the number of times each word occur in the user input string.

For example if the user types in: "Hello there how are you, there you are Hello Hello you"

Your output should be:

Hello 3

there 2

how 1

are 2

you 3

This is the code that people keep submitting for my question but this does not compile. Can someone tell me what's wrong with this code? Or can someone post the correct answer for this assignment?

INCLUDE Irvine32.inc

Word_count PROTO,

pString: PTR BYTE,

pTable : PTR DWORD

.data

countTable DWORD 256 DUP(0)

inputString BYTE 80 DUP(0), 0

str1 BYTE "Display word count for given string", 0dh,0dh,0dh,0dh,

"please enter string between 1 and 80 characters: ",0

.code

main PROC

call Clrscr

mov edx, OFFSET str1

call WriteString

mov ecx, SIZEOF aString - 1

mov edx, OFFSET aString

call ReadString

INVOKE Word_count, ADDR inputString, ADDR countTable

call DisplayTable

exit

main ENDP

Word_count PROC, pString:PTR BYTE, pTable : PTR DWORD

mov esi, pString

mov edi, pTable

xor eax, eax

L1 :

lodsb

inc DWORD PTR [edi + eax*4]

test al, al

jz L1

Exit_proc:

ret

Word_count ENDP

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_2

Step: 3

blur-text-image_3

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

More Books

Students also viewed these Databases questions

Question

Explain the function and purpose of the Job Level Table.

Answered: 1 week ago