Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

help, storing input by first character and length into 3-byte entries

in MASM-

##program that prompts users for successive lines of text. Input ends when user enters a line beginning with a period.

&& build of a single BUFFER of the text entered, with the lines adjoined in the order in which they read.

&& After line have been read, build up an index of words found in the text.

**The index consists of items - one for each word - each
consisting of a:

<>a 16-bit value holding the offset within the text
buffer of the first character of the word

<>a 8-bit value hoding the length(in characters) of the
word

&& after index is built display the lists of all the words in the index

assume:=>
*use indirect addressing and or indexed operands
*at most 1000 characters total in the lines read
*at most 500 different words to be indexed
*all letters entered are uppercase
*a word may contain an apostrophe, otherwise, nonletter are
considered word delimeters
*each entered line is at most 100 characters long
*user starts



Jim did what
J->(AT POSITION)0
I->(AT POSITION)1
M->(AT POSITION)2
(SPACE)->(AT POSITION)3
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
INDEX ENTRY~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

position[0]///position[4]///postion[8]
length[3]/////length[3]////length[4]

hints!!
use loop to skip over nonletters
stop when letter is located
record where letter is at, & length
keep moving over nonletters until finding letter

index ----3 byte enteries
1st two byte entries
last entry byte
problem: laying out index area, intrept two byte memory to word using PTR command


MY PROBLEM:
so far i got the buffer to work, i am having problems with the index part.
========================
here is my code so far:=
========================

.data

outcome DWORD ? ;zero is valid; nonzero is invalid
prompt BYTE "Enter successive lines of text:",0

newLine BYTE 0Dh, 0Ah, 0 ;a return

buffer WORD 1000
index WORD 0
.code
MAIN PROC

call Clrscr

mov ecx, 100
mov edx, OFFSET prompt
call WriteString
mov edx, OFFSET buffer

L1:
call ReadString


cmp buffer, 2Eh
je Last
jmp L1


Last: exit ; exit to operating system
main ENDP

;

END main

Sign In or Register to comment.