So I have a txt file of words. I want to read in those words and store them in an array. Then I want to output the array contents to the screen. When I am doing it, I am only getting the first letter of the word in the first index of the array. I am struggling on figuring this out and I could really use some help.
So here is my txt file:
observation
worshipping
description
nondescript
eliminating
survivalist
destructive
infestation
surrounding
persecution
interesting
explanation
recognition
programming
personality
hospitality
distinguish
devastation
nightvision
engineering
x          
When the program hits the x, stop reading in.
The .DATA:
cr      EQU     0dh     ; carriage return character
Lf      EQU     0ah     ; line feed
MAXNBRS EQU     255
LEN     EQU     13
.STACK  4096            ; reserve 4096-byte stack
.DATA                   ; reserve storage for data
inputStrings    DWORD MAXNBRS DUP (?)
count       WORD    ?
inputStr    BYTE    LEN DUP(0),0
prompt      BYTE    "Enter a string: ", 0
prompt2     BYTE    "The number of strings entered is", 0
comp        BYTE    "x          ",0
And then my loop of reading in from the txt file:
readInStrings MACRO array
    lea ebx, array
    mov al, comp
    mov cx, 0
    START_LOOP:
        output prompt       ;enter a string
        input inputStr, 13  ;read in a line
        inc cx              ;increase count
        output inputStr     ;output the string
        output carriage     ;newline
        cmp inputStr, al    ;if string == x
        je END_LOOP         ;end loop
        mov dl, inputStr    ;store string into byte register
        mov [ebx], dl       ;move string into array
        add ebx, 2          ;increase index of array. I dont know how much 
        jmp START_LOOP      ;jmp to begin
    END_LOOP:
        dec cx              ;since we dont want 'x' to be part of out length, dec cx
        itoa count, cx
        output carriage
        output prompt2
        output count
        atoi count
        mov count, ax
        output carriage
        output carriage
ENDM
So I am:
outputting the prompt, then input into inputStr for 13.
increasing count because we read in a new word.
comparing to see if the read was an 'x'
moving the word into BYTE register.
moving the word into the array
increasing the array to next index (pretty sure this is wrong)
Now when I output the first index of the array my output is just 'o' when it should be 'observation'
Can anyone see what I am doing wrong?