title: assembly word count in string
body: <p>Writing a program that counts words in the string (user input). I got char count so far but still can't make it to count words. (Searched all internet for exact answer, but couldn't find, Even Russian sites) If anyone will help I will very appreciate. (Using Kip Urvine library, it's a must). 
  Will be enought if someone will show the direction where to dig!</p>
  
  <p>Here is the CODE:</p>
  
  <pre><code>INCLUDE Irvine32.inc
  Get_frequencies PROTO, pString:PTR BYTE, ; points to string
  pTable : PTR DWORD; points to frequency table
  .data
  
  freqTable DWORD 256 DUP(0)
  
  ; aString BYTE 1, 2, "Hello World.", 0
  
  aString BYTE 80 DUP(0), 0
  str1 BYTE "*** CALCULATION PROGRAMM   ***",
  0dh, 0ah, 0dh, 0ah,
  "Enter Your Message: ", 0
  .code
  main PROC
  call Clrscr
  mov edx, OFFSET str1
  call WriteString
  mov ecx, SIZEOF aString - 1
  mov edx, OFFSET aString
  call ReadString
  INVOKE Get_frequencies, ADDR aString, ADDR freqTable
  call DisplayTable
  exit
  main ENDP
  Get_frequencies PROC,
  pString:PTR BYTE, ; points to string
  pTable : PTR DWORD; points to frequencey table
  mov esi, pString
  mov edi, pTable
  cld; clear Direction flag(forward)
  L1: mov eax, 0; clear upper bits of EAX
  lodsb; AL = [ESI], inc ESI
  cmp al, 0; end of string ?
  je Exit_proc; yes: exit
  shl eax, 2; multiply by 4
  inc DWORD PTR[edi + eax]; inc table[AL]
  jmp L1; repeat loop
  Exit_proc :
  ret
  Get_frequencies ENDP
  DisplayTable PROC
  ;
  .data
  colonStr BYTE ": ", 0
  .code
  call Crlf
  mov ecx, LENGTHOF freqTable; entries to show
  mov esi, OFFSET freqTable
  mov ebx, 0; index counter
  L1 : mov eax, [esi]; get frequency count
  cmp eax, 0; count = 0 ?
  jna L2; if so, skip to next entry
  mov eax, ebx; display the index
  call WriteChar
  mov edx, OFFSET colonStr; display ": "
  call WriteString
  mov eax, [esi]; show frequency count
  call WriteDec
  call Crlf
  L2 : add esi, TYPE freqTable; point to next table entry
  inc ebx; increment index
  loop L1
  
  call Crlf
  ret
  DisplayTable ENDP
  END main
  </code></pre>
  
  <p>THE OUTPUT is: 
  COUNTING JUST CHARACTERS. </p>