Assembly: Error when attempting to increment at array index -
here's small snippet of assembly code (tasm) try increment value @ current index of array. idea "freq" array store number (dword size) represents how many times ascii character seen in file. keep code short, "b" stores current byte being read.
declared in data segment freq dd 256 dup (0) b db ? ___________ assume b contains current byte mov bl, b sub bh, bh add bx, bx inc freq[bx]
i receive error @ compilation time @ line containing "inc freq[bx]": error argument operation or instruction has illegal size.
any insight appreciated.
there no inc
can increment dword in 16 bit mode. have synthesize add/adc, such as:
add freq[bx], 1 adc freq[bx + 2], 0
you might need add size override, such word ptr
or change array definition freq dw 512 dup (0)
.
also note have scale index 4, not 2.
Comments
Post a Comment