My Intel assembly syntax is a little byte rusty, but word[vowels+p*2]
is certainly more correct than byte[vowels+p*2]
. You have to multiply by the size of the elements yourself and specify the kind of data read (here, 16-bit quantities).
For the first question, it depends how your assembler interprets ""
after db
and dw
. I do not know about that — I never mixed assembly and 16-bit encodings — but I would assume dw
is correct.
Speaking of which, remember to use instruction MOVZX
instead of the 16-bit registers that the assembler may let you use. Using the 16-bit registers in 32-bit mode generates long instructions that also execute slowly for a variety of reasons. MOVZX
expands the 16-bit value read to occupy an entire 32-bit register, which is the correct way to handle them.